< prev index next >
src/java.base/share/classes/java/net/SocketPermission.java
Print this page
*** 285,294 ****
--- 285,299 ----
* </pre>
*
* @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));
// name initialized to getHost(host); NPE detected in getHost()
init(getName(), getMask(action));
*** 587,604 ****
// make sure we didn't just match the tail of a word
// like "ackbarfaccept". Also, skip to the comma.
boolean seencomma = false;
while (i >= matchlen && !seencomma) {
! switch(a[i-matchlen]) {
! case ',':
! seencomma = true;
! break;
case ' ': case '\r': case '\n':
case '\f': case '\t':
break;
default:
throw new IllegalArgumentException(
"invalid permission: " + action);
}
i--;
}
--- 592,610 ----
// make sure we didn't just match the tail of a word
// like "ackbarfaccept". Also, skip to the comma.
boolean seencomma = false;
while (i >= matchlen && !seencomma) {
! 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);
}
i--;
}
< prev index next >