equal
deleted
inserted
replaced
285 * </pre> |
285 * </pre> |
286 * |
286 * |
287 * @param host the hostname or IP address of the computer, optionally |
287 * @param host the hostname or IP address of the computer, optionally |
288 * including a colon followed by a port or port range. |
288 * including a colon followed by a port or port range. |
289 * @param action the action string. |
289 * @param action the action string. |
|
290 * |
|
291 * @throws NullPointerException if any parameters are null |
|
292 * @throws IllegalArgumentException if the format of {@code host} is |
|
293 * invalid, or if the {@code action} string is empty, malformed, or |
|
294 * contains an action other than the specified possible actions |
290 */ |
295 */ |
291 public SocketPermission(String host, String action) { |
296 public SocketPermission(String host, String action) { |
292 super(getHost(host)); |
297 super(getHost(host)); |
293 // name initialized to getHost(host); NPE detected in getHost() |
298 // name initialized to getHost(host); NPE detected in getHost() |
294 init(getName(), getMask(action)); |
299 init(getName(), getMask(action)); |
587 |
592 |
588 // make sure we didn't just match the tail of a word |
593 // make sure we didn't just match the tail of a word |
589 // like "ackbarfaccept". Also, skip to the comma. |
594 // like "ackbarfaccept". Also, skip to the comma. |
590 boolean seencomma = false; |
595 boolean seencomma = false; |
591 while (i >= matchlen && !seencomma) { |
596 while (i >= matchlen && !seencomma) { |
592 switch(a[i-matchlen]) { |
597 switch (c = a[i-matchlen]) { |
593 case ',': |
|
594 seencomma = true; |
|
595 break; |
|
596 case ' ': case '\r': case '\n': |
598 case ' ': case '\r': case '\n': |
597 case '\f': case '\t': |
599 case '\f': case '\t': |
598 break; |
600 break; |
599 default: |
601 default: |
|
602 if (c == ',' && i > matchlen) { |
|
603 seencomma = true; |
|
604 break; |
|
605 } |
600 throw new IllegalArgumentException( |
606 throw new IllegalArgumentException( |
601 "invalid permission: " + action); |
607 "invalid permission: " + action); |
602 } |
608 } |
603 i--; |
609 i--; |
604 } |
610 } |