[Title] NullPointer exception bug fixed
authorjooyoul_lee <jy.exe.lee@samsung.com>
Thu, 2 Jan 2014 02:51:22 +0000 (11:51 +0900)
committerjooyoul_lee <jy.exe.lee@samsung.com>
Thu, 2 Jan 2014 02:51:22 +0000 (11:51 +0900)
[Desc.] LeakDetector
[Issue]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/leaks/LeakDetector.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/leaks/LeakTable.java

index c5496db..fbe7dea 100644 (file)
@@ -362,7 +362,7 @@ public class OpenTraceHandler extends AbstractHandler {
                                        }\r
                                } else {\r
                                        leakDectector.getLeakHash()\r
-                                                       .put(leakData.getKey(), leakData);\r
+                                                       .put((long)leakData.getKey(), leakData);\r
                                }\r
                        }\r
                }\r
index 6cf20a9..be75b4d 100644 (file)
@@ -44,8 +44,8 @@ public class LeakDetector {
        public final static int API_TYPE_CLOSE = 1;
        public final static int API_TYPE_REALLOC = 2;
 
-       HashMap<Integer, LeakData> leakHash;
-       HashMap<Integer, LeakData> childHash;
+       HashMap<Long, LeakData> leakHash;
+       HashMap<Long, LeakData> childHash;
        private int leakSeq = 0;
 
        public LeakDetector() {
@@ -57,16 +57,16 @@ public class LeakDetector {
                return leakList;
        }
 
-       public HashMap<Integer, LeakData> getLeakHash() {
+       public HashMap<Long, LeakData> getLeakHash() {
                if (null == leakHash) {
-                       leakHash = new HashMap<Integer, LeakData>();
+                       leakHash = new HashMap<Long, LeakData>();
                }
                return leakHash;
        }
 
-       public HashMap<Integer, LeakData> getChildHash() {
+       public HashMap<Long, LeakData> getChildHash() {
                if (null == childHash) {
-                       childHash = new HashMap<Integer, LeakData>();
+                       childHash = new HashMap<Long, LeakData>();
                }
                return childHash;
        }
@@ -142,19 +142,19 @@ public class LeakDetector {
                        chk = LeakCheckList.getLeakCheckList().get(apiName);
                }
 
-               HashMap<Integer, LeakData> leaks = getLeakHash();
+               HashMap<Long, LeakData> leaks = getLeakHash();
                if (chk.getApiType() == API_TYPE_OPEN) {
                        // if (chk.isCheckUserCall()) {
                        // checkUserFuncLeakData(logData, chk);
                        // } else {
                        LeakData newLeak = new LeakData(logData, this);
-                       leaks.put(logData.getKey(), newLeak);
+                       leaks.put((long)logData.getKey(), newLeak);
                        // }
                } else if (chk.getApiType() == API_TYPE_CLOSE) {
                        int key = log.getKey();
                        LeakData freeData = getChildHash().get(key);
                        if (null != freeData) {
-                               LeakData parent = leaks.get(freeData.getParentKey());
+                               LeakData parent = leaks.get((long)freeData.getParentKey());
                                parent.removeChild(key);
                                getChildHash().remove(key);
                                if (parent.getChildren().isEmpty()) {
@@ -172,13 +172,17 @@ public class LeakDetector {
                        String inputParam = ((ProbeCommonData) log).getArgs();
                        String[] splitInputParam = inputParam.split("\\,"); //$NON-NLS-1$
                        String param = new String(splitInputParam[0]);
-                       int rmKey = -1;
-                       if (param.contains("0x")) {
-                               rmKey = Integer.decode(param);
-                       } else {
-                               rmKey = Integer.parseInt(splitInputParam[0]);
+                       long rmKey = -1;
+                       try {
+                               if (param.contains("0x")) {
+                                       rmKey = Long.decode(param);
+                               } else {
+                                       rmKey = Integer.parseInt(splitInputParam[0]);
+                               }
+                               leaks.remove(rmKey);
+                       } catch (NumberFormatException e) {
+                               e.printStackTrace();
                        }
-                       leaks.remove(rmKey);
 
                        // internal check
                        // if (chk.isCheckUserCall()) {
@@ -187,7 +191,7 @@ public class LeakDetector {
                        // String key = input[chk.getKeyIndex()];
                        // leaks.put(key, new LeakData(key, input, this));
                        int key = log.getKey();
-                       leaks.put(key, new LeakData(log, this));
+                       leaks.put((long)key, new LeakData(log, this));
                        // }
                }
        }
index 37d62a4..3f8d89f 100644 (file)
@@ -125,7 +125,7 @@ public class LeakTable extends DATreeComposite {
        @Override
        public List<TreeInput> makeTreeInput() {
                List<TreeInput> output = new ArrayList<TreeInput>();
-               HashMap<Integer, LeakData> leaks = null;
+               HashMap<Long, LeakData> leaks = null;
                if (isRange) {
                        leaks = RangeDataManager.getInstance().getLeakDetector()
                                        .getLeakHash();