diff -r 9b67dd88a931 -r 71fef5fae9cc src/java.base/share/classes/java/net/SocketPermission.java --- a/src/java.base/share/classes/java/net/SocketPermission.java Mon Oct 14 18:48:10 2019 -0700 +++ b/src/java.base/share/classes/java/net/SocketPermission.java Wed Oct 16 14:32:17 2019 -0700 @@ -287,6 +287,11 @@ * @param host the hostname or IP address of the computer, optionally * including a colon followed by a port or port range. * @param action the action string. + * + * @throws NullPointerException if any parameters are null + * @throws IllegalArgumentException if the format of {@code host} is + * invalid, or if the {@code action} string is empty, malformed, or + * contains an action other than the specified possible actions */ public SocketPermission(String host, String action) { super(getHost(host)); @@ -589,14 +594,15 @@ // like "ackbarfaccept". Also, skip to the comma. boolean seencomma = false; while (i >= matchlen && !seencomma) { - switch(a[i-matchlen]) { - case ',': - seencomma = true; - break; + switch (c = a[i-matchlen]) { case ' ': case '\r': case '\n': case '\f': case '\t': break; default: + if (c == ',' && i > matchlen) { + seencomma = true; + break; + } throw new IllegalArgumentException( "invalid permission: " + action); }