Throw NPE when regex pattern is null

This commit is contained in:
konsoletyper 2014-10-25 18:36:30 +04:00
parent a0493055a8
commit 9902f583bd

View File

@ -297,14 +297,13 @@ public final class TPattern implements Serializable {
* @see #UNIX_LINES * @see #UNIX_LINES
*/ */
public static TPattern compile(String pattern, int flags) throws TPatternSyntaxException { 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)) { if ((flags != 0) && ((flags | flagsBitMask) != flagsBitMask)) {
throw new IllegalArgumentException(""); throw new IllegalArgumentException("");
} }
TAbstractSet.counter = 1; TAbstractSet.counter = 1;
return new TPattern().compileImpl(pattern, flags); return new TPattern().compileImpl(pattern, flags);
} }