tmf.xml: Fix validate event in TmfXmlBasicTransition
authorJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Wed, 13 Jul 2016 17:44:54 +0000 (13:44 -0400)
committerJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Thu, 21 Jul 2016 20:01:31 +0000 (16:01 -0400)
Previously, if the user do not specify an event in a transition, the
validation always yields false, which is not true. This patch returns
true instead.

Change-Id: I2ec0afb344c3e4fb51366168cca8ebac6c7cb30f
Signed-off-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/77272
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Hudson CI
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/core/model/TmfXmlBasicTransition.java

index 70d1b3675104c69b064f0af64481e62c51adfbc3..df8d7aa45208c2093862322c6a0e0e4e47c66f3e 100644 (file)
@@ -42,9 +42,11 @@ public class TmfXmlBasicTransition {
     public TmfXmlBasicTransition(Element element) {
         final @NonNull String events = element.getAttribute(TmfXmlStrings.EVENT);
         fAcceptedEvents = new ArrayList<>();
-        for (String eventName : Arrays.asList(events.split(TmfXmlStrings.OR_SEPARATOR))) {
-            String name = WILDCARD_PATTERN.matcher(eventName).replaceAll(".*"); //$NON-NLS-1$
-            fAcceptedEvents.add(Pattern.compile(name));
+        if (!events.isEmpty()) {
+            for (String eventName : Arrays.asList(events.split(TmfXmlStrings.OR_SEPARATOR))) {
+                String name = WILDCARD_PATTERN.matcher(eventName).replaceAll(".*"); //$NON-NLS-1$
+                fAcceptedEvents.add(Pattern.compile(name));
+            }
         }
         final @NonNull String conditions = element.getAttribute(TmfXmlStrings.COND);
         fCond = conditions.isEmpty() ? new ArrayList<>() : Arrays.asList(conditions.split(TmfXmlStrings.AND_SEPARATOR));
@@ -81,6 +83,9 @@ public class TmfXmlBasicTransition {
     private boolean validateEvent(ITmfEvent event) {
         String eventName = event.getName();
 
+        if (fAcceptedEvents.isEmpty()) {
+            return true;
+        }
         /*
          * This validates the event name with the accepted regular expressions
          */
This page took 0.026204 seconds and 5 git commands to generate.