From: jungwook.ryu Date: Tue, 7 Jul 2015 07:35:04 +0000 (+0900) Subject: Exception handling Charts(Heap allocation, Process Size) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8873cb256cfbaeaca9b413407ed37ab215255b35;p=sdk%2Ftools%2Fdynamic-analyzer.git Exception handling Charts(Heap allocation, Process Size) - Do not create chart for invalid process Change-Id: Iae875713eeba8492497e17f1367733d3630abdec Signed-off-by: jungwook.ryu --- diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java index 048b9e0..47b9840 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java @@ -38,6 +38,7 @@ import org.tizen.dynamicanalyzer.common.Global; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.project.BinaryInfo; import org.tizen.dynamicanalyzer.project.LibraryObject; +import org.tizen.dynamicanalyzer.project.ProcessInformation; import org.tizen.dynamicanalyzer.project.ProcessMemoryMap; import org.tizen.dynamicanalyzer.project.Project; import org.tizen.dynamicanalyzer.protocol.ProtocolConstants; @@ -50,6 +51,7 @@ import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter; import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBTable; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar; +import org.tizen.dynamicanalyzer.util.Logger; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; import org.tizen.dynamicanalyzer.utils.Formatter; import org.tizen.dynamicanalyzer.widgets.chart.DAChart; @@ -95,8 +97,13 @@ public class HeapChart extends TimelineChart { Project project = Global.getProject(); List binDataList = BinarySettingManager.getInstance() .getBinarySettingList(); - ProcessMemoryMap pmap = project.getProcessInformation(pid).getProcessMemoryMap( - Toolbar.INSTANCE.getTime()); + + ProcessInformation pinfo = project.getProcessInformation(pid); + if (pinfo == null) { + Logger.error("ProcessInformation is Null!! Invalid PID : " + pid ); + return null; + } + ProcessMemoryMap pmap = pinfo.getProcessMemoryMap(Toolbar.INSTANCE.getTime()); if (pmap != null) { for (BinarySettingData binData : binDataList) { String libraryPath = binData.getBinaryPath(); @@ -185,6 +192,10 @@ public class HeapChart extends TimelineChart { */ if (seriesPerProcessMap.isEmpty()) { Map seriesMap = createChartSeries(pid); + if (seriesMap == null) { + Logger.error("Invalid PID : " + pid); + return; + } seriesPerProcessMap.put(pid, seriesMap); setChartSeries(chart, seriesMap); final String processName = AnalyzerUtil.getProcessName(pid.intValue()); @@ -195,6 +206,10 @@ public class HeapChart extends TimelineChart { */ else if (seriesPerProcessMap.get(pid) == null) { final Map seriesMap = createChartSeries(pid); + if (seriesMap == null) { + Logger.error("Invalid PID : " + pid); + return; + } seriesPerProcessMap.put(pid, seriesMap); Display.getDefault().syncExec(new Runnable() { @Override diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java index 9dbadcf..b136f39 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java @@ -151,7 +151,10 @@ public class ProcessMemoryChart extends TimelineChart { Iterator iterProcessData = processDataMap.keySet().iterator(); while (iterProcessData.hasNext()) { final Integer pid = iterProcessData.next(); - + final String processName = AnalyzerUtil.getProcessName(pid.intValue()); + if (processName == null) { + return; + } /* * First process, use parentBoardItem. */ @@ -181,7 +184,6 @@ public class ProcessMemoryChart extends TimelineChart { final DAChartBoardItem curBoard = processChartboardMap.get(pid); String oldProcessName = processNameMap.get(pid); - final String processName = AnalyzerUtil.getProcessName(pid.intValue()); if (oldProcessName == null || !oldProcessName.equals(processName)) { curBoard.getChart().setInformation(processName + " / PID : " + pid.intValue()); }