Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christian Kouame2018-06-04 15:13:37 +0000
committerJean-Christian Kouame2018-06-04 20:16:04 +0000
commit82c8fe0cab54dc6252d25a0430aee9cd0ed89276 (patch)
treef9a2b0f35026fb995b33045cef89b15ba2ee33ea
parenta1a114bdf33e77877f98bbf0e2b7f8597fba4ccd (diff)
downloadorg.eclipse.tracecompass-82c8fe0cab54dc6252d25a0430aee9cd0ed89276.tar.gz
org.eclipse.tracecompass-82c8fe0cab54dc6252d25a0430aee9cd0ed89276.tar.xz
org.eclipse.tracecompass-82c8fe0cab54dc6252d25a0430aee9cd0ed89276.zip
tmf.filter: Bug 535397 Catch pattern syntax exception and return null
Reviewed-on: https://git.eclipse.org/r/123291 Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: CI Bot (cherry picked from commit 63f4a5ce3945ccfd9122caf787b29eafa61b692a) Change-Id: I5315e97385aa0d292e9333676907cb28063b7ac8 Signed-off-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com> Reviewed-on: https://git.eclipse.org/r/123933 Tested-by: CI Bot Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/provisional/tmf/core/model/filter/parser/FilterSimpleExpressionCu.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/provisional/tmf/core/model/filter/parser/FilterSimpleExpressionCu.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/provisional/tmf/core/model/filter/parser/FilterSimpleExpressionCu.java
index 4b53dda129..60f39fe8fe 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/provisional/tmf/core/model/filter/parser/FilterSimpleExpressionCu.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/provisional/tmf/core/model/filter/parser/FilterSimpleExpressionCu.java
@@ -12,6 +12,7 @@ import java.util.Objects;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
import org.antlr.runtime.tree.CommonTree;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
@@ -155,8 +156,13 @@ public class FilterSimpleExpressionCu {
private static BiFunction<String, String, Boolean> matchFunc() {
return (i, j) -> {
- Pattern filterPattern = Pattern.compile(j);
- return filterPattern.matcher(i).find();
+ try {
+ Pattern filterPattern = Pattern.compile(j);
+ return filterPattern.matcher(i).find();
+ } catch (PatternSyntaxException e) {
+ Activator.logWarning("The regex syntax is invalid"); //$NON-NLS-1$
+ return false;
+ }
};
}

Back to the top