From 9ea3be060e2854192ab1486031dba1a45892ad8b Mon Sep 17 00:00:00 2001 From: sinthuja Date: Thu, 7 Sep 2017 19:44:48 +0530 Subject: [PATCH] Fixing the NPE in the application toString operation. --- .../device/application/mgt/common/Application.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java index 4ec135b074..246089b2a7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java @@ -213,7 +213,7 @@ public class Application { this.user = user; } - public void setScreenShotCount (int screenShotCount) { + public void setScreenShotCount(int screenShotCount) { this.screenShotCount = screenShotCount; } @@ -223,7 +223,11 @@ public class Application { @Override public String toString() { - return "UUID : " + uuid + "\tName : " + name + "\tShort Description : " - + shortDescription + "\tLifecycle State : " + currentLifecycle.getLifecycleState(); + String app = "UUID : " + uuid + "\tName : " + name + "\tShort Description : " + + shortDescription; + if (currentLifecycle != null) { + app += "\tLifecycle State : " + currentLifecycle.getLifecycleState(); + } + return app; } }