Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2015-01-05 20:43:56 +0000
committerPatrick Tasse2015-01-05 22:40:53 +0000
commit34cac5f3dc0c72cf79f2d5f2f3c93ee9db53a81f (patch)
tree8ecd3905537cfafff904e307cc801237a66f3c0a
parent60fc89be1dc6b0e3294dafadef912e75fb50e48a (diff)
downloadorg.eclipse.linuxtools-34cac5f3dc0c72cf79f2d5f2f3c93ee9db53a81f.tar.gz
org.eclipse.linuxtools-34cac5f3dc0c72cf79f2d5f2f3c93ee9db53a81f.tar.xz
org.eclipse.linuxtools-34cac5f3dc0c72cf79f2d5f2f3c93ee9db53a81f.zip
tmf: Fix IndexOutOfBoundsException in OffsetDialog
Exception occurred when opening the dialog from an empty experiment or trace folder. Change-Id: Ib230b6ea2e1d934b63e0988554af2983f6170fd0 Reviewed-on: https://git.eclipse.org/r/39002 Tested-by: Hudson CI Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java6
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OffsetTraceHandler.java6
2 files changed, 10 insertions, 2 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java
index b9df3f0b64..5f4d3dc72c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2015 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -75,6 +75,10 @@ public class ClearTraceOffsetHandler extends AbstractHandler {
}
}
+ if (traceElements.isEmpty()) {
+ return null;
+ }
+
Shell shell = HandlerUtil.getActiveShellChecked(event);
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.CANCEL | SWT.OK);
mb.setText(Messages.ClearTraceOffsetHandler_Title);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OffsetTraceHandler.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OffsetTraceHandler.java
index 564e9debb9..9a1d0b2861 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OffsetTraceHandler.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OffsetTraceHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2015 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -79,6 +79,10 @@ public class OffsetTraceHandler extends AbstractHandler {
}
}
+ if (traceElements.isEmpty()) {
+ return null;
+ }
+
final Map<TmfTraceElement, Long> offsets = new LinkedHashMap<>(traceElements.size());
for (TmfTraceElement trace : traceElements) {
offsets.put(trace, 0L);

Back to the top