From 2c7577f41c76af9517fd3c8999c3eb31b5c6301d Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Mon, 4 Jan 2016 13:57:24 -0500 Subject: [PATCH] analysis: fix @NonNull issues with SystemCallLatencyStatisticsViewer Change-Id: I2d14203943774a9447f618a76d300e509a2e212d Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/63495 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- .../SystemCallLatencyStatisticsViewer.java | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/SystemCallLatencyStatisticsViewer.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/SystemCallLatencyStatisticsViewer.java index 397c085148..cab1913ccd 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/SystemCallLatencyStatisticsViewer.java +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/latency/statistics/SystemCallLatencyStatisticsViewer.java @@ -52,13 +52,13 @@ public class SystemCallLatencyStatisticsViewer extends AbstractSegmentStoreStati * @return the statistics analysis module */ @Override - @Nullable protected TmfAbstractAnalysisModule createStatisticsAnalysiModule() { + protected @Nullable TmfAbstractAnalysisModule createStatisticsAnalysiModule() { SystemCallLatencyStatisticsAnalysisModule module = new SystemCallLatencyStatisticsAnalysisModule(); return module; } @Override - @Nullable protected ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { + protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { if (isSelection || (start == end)) { return null; } @@ -73,23 +73,24 @@ public class SystemCallLatencyStatisticsViewer extends AbstractSegmentStoreStati module.waitForCompletion(); - SegmentStoreStatistics entry = module.getTotalStats(); - TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); //$NON-NLS-1$ - List entryList = root.getChildren(); - - TmfTreeViewerEntry child = new SegmentStoreStatisticsEntry(checkNotNull(Messages.LatencyStatistics_TotalLabel), checkNotNull(entry)); - entryList.add(child); - - HiddenTreeViewerEntry syscalls = new HiddenTreeViewerEntry(checkNotNull(SYSCALL_LEVEL)); - child.addChild(syscalls); - - Map perSyscallStats = module.getPerSyscallStats(); - if (perSyscallStats != null) { - Iterator> stats = perSyscallStats.entrySet().iterator(); - while (stats.hasNext()) { - Entry statsEntry = stats.next(); - syscalls.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue())); + final SegmentStoreStatistics entry = module.getTotalStats(); + if (entry != null) { + + List entryList = root.getChildren(); + + TmfTreeViewerEntry child = new SegmentStoreStatisticsEntry(checkNotNull(Messages.LatencyStatistics_TotalLabel), entry); + entryList.add(child); + HiddenTreeViewerEntry syscalls = new HiddenTreeViewerEntry(SYSCALL_LEVEL); + child.addChild(syscalls); + + Map perSyscallStats = module.getPerSyscallStats(); + if (perSyscallStats != null) { + Iterator> stats = perSyscallStats.entrySet().iterator(); + while (stats.hasNext()) { + Entry statsEntry = stats.next(); + syscalls.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue())); + } } } return root; -- 2.34.1