From 9902f583bdec38cae2ce2c5af1e153efb8df878a Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Sat, 25 Oct 2014 18:36:30 +0400 Subject: [PATCH] Throw NPE when regex pattern is null --- .../java/org/teavm/classlib/java/util/regex/TPattern.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java index 2f28f3f34..34b373310 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java @@ -297,14 +297,13 @@ public final class TPattern implements Serializable { * @see #UNIX_LINES */ public static TPattern compile(String pattern, int flags) throws TPatternSyntaxException { - + if (pattern == null) { + throw new NullPointerException("Patter is null"); + } if ((flags != 0) && ((flags | flagsBitMask) != flagsBitMask)) { - throw new IllegalArgumentException(""); } - TAbstractSet.counter = 1; - return new TPattern().compileImpl(pattern, flags); }