catch process canceled exception of pattern match calculation - fix review comment...
authorirengrig <Irina.Chernushina@jetbrains.com>
Mon, 14 Nov 2016 10:11:12 +0000 (11:11 +0100)
committerirengrig <Irina.Chernushina@jetbrains.com>
Mon, 14 Nov 2016 11:35:02 +0000 (12:35 +0100)
json/src/com/jetbrains/jsonSchema/impl/JsonSchemaObject.java

index b5ef3b1e50b29b685a05eac14d256d49a7d4c6cd..5b6b128783af7ebc3684b9c1780619090e1837c8 100644 (file)
@@ -1,5 +1,6 @@
 package com.jetbrains.jsonSchema.impl;
 
+import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.containers.SLRUMap;
 import org.jetbrains.annotations.NotNull;
@@ -509,10 +510,14 @@ public class JsonSchemaObject {
     final List<String> strings = new ArrayList<>(myPatternProperties.keySet());
     Collections.sort(strings);
     for (final String pattern : strings) {
-      final boolean matches = Pattern.compile(adaptSchemaPattern(pattern)).matcher(StringUtil.newBombedCharSequence(name, 1000)).matches();
-      if (matches) {
-        myCachedPatternProperties.put(name, pattern);
-        return myPatternProperties.get(pattern);
+      try {
+        final boolean matches = Pattern.compile(adaptSchemaPattern(pattern)).matcher(StringUtil.newBombedCharSequence(name, 1000)).matches();
+        if (matches) {
+          myCachedPatternProperties.put(name, pattern);
+          return myPatternProperties.get(pattern);
+        }
+      } catch (ProcessCanceledException e) {
+        //ignored
       }
     }
     myCachedPatternProperties.put(name, "");