tmf: Catch ParseSyntaxException in custom text parser wizard
authorPatrick Tasse <patrick.tasse@gmail.com>
Mon, 8 Sep 2014 21:48:49 +0000 (17:48 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Tue, 9 Sep 2014 16:47:12 +0000 (12:47 -0400)
Change-Id: I1ac66cacbc5d1d26ff06dbbe4920d31702cf3704
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/33081
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java

index 0c205d562e86a8e3372b59aad8ff690ce2d13297..c34dc77f3c725b72224727281970671d9a3bd6cd 100644 (file)
@@ -737,14 +737,22 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                                     List<InputLine> nextInputs = currentInput.getNextInputs(countMap);
                                     if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {
                                         for (InputLine input : definition.inputs) {
-                                            matcher = input.getPattern().matcher(log);
+                                            try {
+                                                matcher = input.getPattern().matcher(log);
+                                            } catch (PatternSyntaxException e) {
+                                                continue;
+                                            }
                                             if (matcher.matches()) {
                                                 continue event;
                                             }
                                         }
                                     }
                                     for (InputLine input : nextInputs) {
-                                        matcher = input.getPattern().matcher(log);
+                                        try {
+                                            matcher = input.getPattern().matcher(log);
+                                        } catch (PatternSyntaxException e) {
+                                            continue;
+                                        }
                                         if (matcher.matches()) {
                                             inputText.setStyleRange(new StyleRange(rawPos, length,
                                                     COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
@@ -790,8 +798,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                                     }
                                 }
                                 if (!processed && currentInput != null) {
-                                    matcher = currentInput.getPattern().matcher(log);
-                                    if (matcher.matches()) {
+                                    matcher = null;
+                                    try {
+                                        matcher = currentInput.getPattern().matcher(log);
+                                    } catch (PatternSyntaxException e) {
+                                    }
+                                    if (matcher != null && matcher.matches()) {
                                         inputText.setStyleRange(new StyleRange(rawPos, length,
                                                 COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
                                         updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
This page took 0.030857 seconds and 5 git commands to generate.