[SRADA-1095] Fix application list building fail for an empty package.
authorGihun Chang <gihun.chang@samsung.com>
Thu, 1 Sep 2016 09:18:56 +0000 (18:18 +0900)
committergihun chang <gihun.chang@samsung.com>
Thu, 8 Sep 2016 12:54:24 +0000 (21:54 +0900)
* If a pakcage dosen't have any UI or SVC application inside the package
DA is failed to create application reset. Need a defence code for it.

* This patch is for Platform Dynamic Analzyer that lists whole apps on the
target.

Change-Id: Ifdcfb2b0c7088ea67b65c91842cdbdeded8a81dc

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/PackageInfo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java

index 4b8d8a6..924a22e 100644 (file)
@@ -93,6 +93,12 @@ public class PackageInfo {
 
        // TODO: ensure main app is the first app in package
        public AppInfo getMainApp() {
+
+               if(appInfos.size() == 0){
+                       System.err.println("The empty package. ID: "+ id.toString());
+                       return null;
+               }
+
                return appInfos.get(0);
        }
 
index a39249e..6f12ebf 100644 (file)
@@ -1090,7 +1090,7 @@ public enum Toolbar {
                for (Map.Entry<String, PackageInfo> entry : pkgInfos.entrySet()) {
                        PackageInfo pkg = entry.getValue();
                        AppInfo mainapp = pkg.getMainApp();
-                       if (!ApplistManager.isInBlackList(mainapp)) {
+                       if (mainapp != null && !ApplistManager.isInBlackList(mainapp)) {
                                String label = mainapp.getLabel();
                                if (label.isEmpty()) {
                                        label = mainapp.getExecFileName();