[LTTng] Fix BufferOverflowException batch importing LTTng UST trace
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 23 Oct 2013 18:18:11 +0000 (14:18 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 24 Oct 2013 17:31:42 +0000 (13:31 -0400)
Bug: 420203

Change-Id: Id0d793b39ad28c80fd04d61bcd2646b419656e9e
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/17699
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.lttng2.ust.core/src/org/eclipse/linuxtools/lttng2/ust/core/trace/LttngUstTrace.java
org.eclipse.linuxtools.lttng2.ust.core/src/org/eclipse/linuxtools/lttng2/ust/core/trace/Messages.java
org.eclipse.linuxtools.lttng2.ust.core/src/org/eclipse/linuxtools/lttng2/ust/core/trace/messages.properties

index 9305dab40a00f5789d7ba05a498dd35f44de6ed9..1dfa23f3a60ed468823f4df833c67ff243179300 100644 (file)
@@ -8,10 +8,13 @@
  *
  * Contributors:
  *   Matthew Khouzam - Initial API and implementation
+ *   Marc-Andre Laperle - Handle BufferOverflowException (Bug 420203)
  **********************************************************************/
 
 package org.eclipse.linuxtools.lttng2.ust.core.trace;
 
+import java.nio.BufferOverflowException;
+
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -43,10 +46,13 @@ public class LttngUstTrace extends CtfTmfTrace {
         try {
             temp = new CTFTrace(path);
         } catch (CTFReaderException e) {
-            status = new Status(IStatus.ERROR,  Activator.PLUGIN_ID, e.toString(), e);
+            status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString(), e);
+            return status;
+        } catch (NullPointerException e) {
+            status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString(), e);
             return status;
-        } catch (NullPointerException e){
-            status = new Status(IStatus.ERROR,  Activator.PLUGIN_ID, e.toString(), e);
+        } catch (final BufferOverflowException e) {
+            status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.LttngUstTrace_TraceReadError + ": " + Messages.LttngUstTrace_MalformedTrace); //$NON-NLS-1$
             return status;
         }
 
index f028b3a926cf27c6a790a4af7c900817f3a2d1b3..bd36c13aeda64e2ce2e065429b65e59560d8aeb4 100644 (file)
@@ -28,6 +28,16 @@ public class Messages extends NLS {
      */
     public static String LttngUstTrace_DomainError;
 
+    /**
+     * Malformed trace (buffer overflow maybe?)
+     */
+    public static String LttngUstTrace_MalformedTrace;
+
+    /**
+     * Trace read error
+     */
+    public static String LttngUstTrace_TraceReadError;
+
     static {
         // initialize resource bundle
         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
index 8f044d7346843285241dbce5fad194b3e390a993..d170bb9a2f12cafb3daf67fa721e1965f198a1a0 100644 (file)
@@ -11,3 +11,5 @@
 ###############################################################################
 
 LttngUstTrace_DomainError=Domain mismatch, the environment should be 'ust'.
+LttngUstTrace_MalformedTrace=Buffer overflow exception, trace is malformed
+LttngUstTrace_TraceReadError=Lttng UST trace read error
\ No newline at end of file
This page took 0.02628 seconds and 5 git commands to generate.