public static boolean matchPattern(final @NotNull Pattern pattern, final @NotNull String s) {
    try {
      return pattern.matcher(StringUtil.newBombedCharSequence(s, 300)).matches();
    }
    catch (ProcessCanceledException e) {
      // something wrong with the pattern, infinite cycle?
      Logger.getInstance(JsonSchemaObjectReadingUtils.class).info("Pattern matching canceled");
      return false;
    }
    catch (Exception e) {
      // catch exceptions around to prevent things like:
      // https://bugs.openjdk.org/browse/JDK-6984178
      Logger.getInstance(JsonSchemaObjectReadingUtils.class).info(e);
      return false;
    }
  }
public static boolean matchPattern(final @NotNull Pattern pattern, final @NotNull String s)