< prev index next >
src/java.base/share/classes/java/net/SocketPermission.java
Print this page
*** 281,291 ****
* nr = new SocketPermission("204.160.241.0", "connect");
* nr = new SocketPermission("localhost:1024-65535", "listen");
* nr = new SocketPermission("204.160.241.0:1024-65535", "connect");
* </pre>
*
! * @param host the hostname or IPaddress of the computer, optionally
* including a colon followed by a port or port range.
* @param action the action string.
*/
public SocketPermission(String host, String action) {
super(getHost(host));
--- 281,291 ----
* nr = new SocketPermission("204.160.241.0", "connect");
* nr = new SocketPermission("localhost:1024-65535", "listen");
* nr = new SocketPermission("204.160.241.0:1024-65535", "connect");
* </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.
*/
public SocketPermission(String host, String action) {
super(getHost(host));
*** 315,325 ****
int ind;
if (host.charAt(0) != '[') {
if ((ind = host.indexOf(':')) != host.lastIndexOf(':')) {
/* More than one ":", meaning IPv6 address is not
* in RFC 2732 format;
! * We will rectify user errors for all unambiguious cases
*/
StringTokenizer st = new StringTokenizer(host, ":");
int tokens = st.countTokens();
if (tokens == 9) {
// IPv6 address followed by port
--- 315,325 ----
int ind;
if (host.charAt(0) != '[') {
if ((ind = host.indexOf(':')) != host.lastIndexOf(':')) {
/* More than one ":", meaning IPv6 address is not
* in RFC 2732 format;
! * We will rectify user errors for all unambiguous cases
*/
StringTokenizer st = new StringTokenizer(host, ":");
int tokens = st.countTokens();
if (tokens == 9) {
// IPv6 address followed by port
*** 959,969 ****
that.getCanonName();
}
return (that.cname.endsWith(this.cname));
}
! // comapare IP addresses
if (this.addresses == null) {
this.getIP();
}
if (that.addresses == null) {
--- 959,969 ----
that.getCanonName();
}
return (that.cname.endsWith(this.cname));
}
! // compare IP addresses
if (this.addresses == null) {
this.getIP();
}
if (that.addresses == null) {
< prev index next >