From 813302e55527ef2b767d331847359e08133ed276 Mon Sep 17 00:00:00 2001 From: megala21 Date: Thu, 5 Oct 2017 13:55:34 +0530 Subject: [PATCH] Refactoring --- .../impl/PlatformManagementAPIImpl.java | 2 +- .../core/impl/PlatformStorageManagerImpl.java | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/PlatformManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/PlatformManagementAPIImpl.java index 46ddae38c4..32984446e0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/PlatformManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/PlatformManagementAPIImpl.java @@ -141,7 +141,7 @@ public class PlatformManagementAPIImpl implements PlatformManagementAPI { + tenantId, e); return APIUtil.getResponse(e, Response.Status.NOT_FOUND); } catch (PlatformStorageManagementException e) { - log.error("Platform Storage Management Exception while trying to update the icon for the platform : " + id + log.error("Platform Storage Management Exception while trying to get the icon for the platform : " + id + " for the tenant : " + tenantId, e); return APIUtil.getResponse(e, Response.Status.NOT_FOUND); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformStorageManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformStorageManagerImpl.java index d748d79afc..d0b71fcd2d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformStorageManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformStorageManagerImpl.java @@ -69,12 +69,12 @@ public class PlatformStorageManagerImpl implements PlatformStorageManager { + "directly to the deployment location inside icon folder"); } if (platform.isShared() && tenantId != MultitenantConstants.SUPER_TENANT_ID) { - throw new PlatformStorageManagementException("Platform " + platformIdentifier + " is a share platform from " - + "super-tenant. Only the super-tenant users can modify it"); + throw new PlatformStorageManagementException("Platform " + platformIdentifier + + " is a shared platform from super-tenant. Only the super-tenant users can modify it"); } if (log.isDebugEnabled()) { - log.debug("Artifact Directory Path for saving the artifacts related with application " - + platformIdentifier + " is " + storagePath); + log.debug("Artifact Directory Path for saving the artifacts related with application " + platformIdentifier + + " is " + storagePath); } StorageManagementUtil.createArtifactDirectory(storagePath); if (iconFileStream != null) { @@ -82,8 +82,8 @@ public class PlatformStorageManagerImpl implements PlatformStorageManager { saveFile(iconFileStream, storagePath + File.separator + platform.getId()); } catch (IOException e) { throw new ApplicationStorageManagementException( - "IO Exception while saving the icon file in the server for the platform " - + platformIdentifier, e); + "IO Exception while saving the icon file in the server for the platform " + platformIdentifier, + e); } } } @@ -127,8 +127,8 @@ public class PlatformStorageManagerImpl implements PlatformStorageManager { String imageArtifactPath = storagePath + platform.getId(); if (platform.isShared() && tenantId != MultitenantConstants.SUPER_TENANT_ID) { - throw new PlatformStorageManagementException("Platform " + platformIdentifier + " is a share platform from " - + "super-tenant. Only the super-tenant users can modify it"); + throw new PlatformStorageManagementException("Platform " + platformIdentifier + " is a shared platform " + + "from super-tenant. Only the super-tenant users can modify it"); } if (platform.isFileBased()) { throw new PlatformStorageManagementException("Platform " + platformIdentifier + " is a file based one. " @@ -154,13 +154,14 @@ public class PlatformStorageManagerImpl implements PlatformStorageManager { PlatformManager platformManager = DataHolder.getInstance().getPlatformManager(); platform = platformManager.getPlatform(tenantId, identifier); } catch (PlatformManagementException e) { - throw new PlatformStorageManagementException("Platform Management Exception while getting the platform " - + "related with the identifier " + identifier); + throw new PlatformStorageManagementException( + "Platform Management Exception while getting the platform " + "related with the identifier " + + identifier); } if (platform == null) { throw new PlatformStorageManagementException("Platform does not exist with the identifier " + identifier); } - return platform; + return platform; } }