tmf: Fix unprocessed custom event content
authorPatrick Tasse <patrick.tasse@gmail.com>
Tue, 24 Nov 2015 23:13:14 +0000 (18:13 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Thu, 26 Nov 2015 18:53:06 +0000 (13:53 -0500)
If the custom event content is read before the event timestamp, it could
be undefined as the event data hasn't be processed yet. This can happen
in test code.

Change-Id: Idab415eb8015f1a7035bee11582d0baad89cad5b
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/61204
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomEvent.java

index 9abb0102089496e53f824e9d76cad5fb4b39e308..e06481fcb791b203fc2f40e7bc1d22e962772510 100644 (file)
@@ -137,6 +137,9 @@ public class CustomEvent extends TmfEvent {
 
     @Override
     public ITmfEventField getContent() {
+        if (fData != null) {
+            processData();
+        }
         return customEventContent;
     }
 
@@ -230,8 +233,7 @@ public class CustomEvent extends TmfEvent {
                 fColumnData[i++] = new TmfEventField(outputColumn.name, (value != null ? value : ""), null); //$NON-NLS-1$
             }
         }
-        CustomEventContent curContent = (CustomEventContent) getContent();
-        setContent(new CustomEventContent(curContent.getName(), curContent.getValue(), fColumnData));
+        setContent(new CustomEventContent(customEventContent.getName(), customEventContent.getValue(), fColumnData));
         fData = null;
     }
 
This page took 0.028235 seconds and 5 git commands to generate.