tmf: Bug 497038: Custom parser field names conflict with built-in tags
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / parsers / custom / CustomXmlTrace.java
index 1ac4a245cf898b0dffdc63bb8271f931b6ad83b8..e562fd880e6f232d9669e073e17fc10654222ded 100644 (file)
@@ -37,6 +37,7 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.tracecompass.tmf.core.io.BufferedRandomAccessFile;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.Tag;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
@@ -517,12 +518,16 @@ public class CustomXmlTrace extends TmfTrace implements ITmfPersistentlyIndexabl
     }
 
     private void parseElement(final Element element, final CustomXmlEvent event, final CustomXmlInputElement inputElement) {
-        if (inputElement.getInputName() != null && !inputElement.getInputName().equals(CustomXmlTraceDefinition.TAG_IGNORE)) {
-            event.parseInput(parseElement(element, new StringBuffer()).toString(), inputElement.getInputName(), inputElement.getInputAction(), inputElement.getInputFormat());
+        String eventType = inputElement.getEventType();
+        if (eventType != null && event.getType() instanceof CustomEventType) {
+            ((CustomEventType) event.getType()).setName(eventType);
+        }
+        if (!inputElement.getInputTag().equals(Tag.IGNORE)) {
+            event.parseInput(parseElement(element, new StringBuffer()).toString(), inputElement.getInputTag(), inputElement.getInputName(), inputElement.getInputAction(), inputElement.getInputFormat());
         }
         if (inputElement.getAttributes() != null) {
             for (final CustomXmlInputAttribute attribute : inputElement.getAttributes()) {
-                event.parseInput(element.getAttribute(attribute.getAttributeName()), attribute.getInputName(), attribute.getInputAction(), attribute.getInputFormat());
+                event.parseInput(element.getAttribute(attribute.getAttributeName()), attribute.getInputTag(), attribute.getInputName(), attribute.getInputAction(), attribute.getInputFormat());
             }
         }
         final NodeList childNodes = element.getChildNodes();
This page took 0.025141 seconds and 5 git commands to generate.