diff options
author | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-07 16:31:42 +0000 |
---|---|---|
committer | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-07 16:31:42 +0000 |
commit | d8d674a19a9f3d2f17427e7a7b5217e2c15880cf (patch) | |
tree | 4342fb258227c31c859682720d4d979a6df73063 /libjava/java/net/SocketPermission.java | |
parent | 964944fc854c1dd723f7b8150d0deac634aabdbb (diff) |
This commit was manufactured by cvs2svn to create taghammer-3_3-merge-20030407
'hammer-3_3-merge-20030407'.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/hammer-3_3-merge-20030407@65335 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/SocketPermission.java')
-rw-r--r-- | libjava/java/net/SocketPermission.java | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/libjava/java/net/SocketPermission.java b/libjava/java/net/SocketPermission.java index 18fb7ef2f1f..6fa65f8793a 100644 --- a/libjava/java/net/SocketPermission.java +++ b/libjava/java/net/SocketPermission.java @@ -276,62 +276,62 @@ public final class SocketPermission extends Permission // Get ours if (hostport.indexOf(":") == -1) { - ourfirstport = 0; - ourlastport = 65535; + ourfirstport = 0; + ourlastport = 65535; } else { - // FIXME: Needs bulletproofing. - // This will dump if hostport if all sorts of bad data was passed to - // the constructor - String range = hostport.substring(hostport.indexOf(":") + 1); - if (range.startsWith("-")) - ourfirstport = 0; - else if (range.indexOf("-") == -1) - ourfirstport = Integer.parseInt(range); - else - ourfirstport = - Integer.parseInt(range.substring(0, range.indexOf("-"))); - - if (range.endsWith("-")) - ourlastport = 65535; - else if (range.indexOf("-") == -1) - ourlastport = Integer.parseInt(range); - else - ourlastport = - Integer.parseInt(range. - substring(range.indexOf("-") + 1, - range.length())); + // FIXME: Needs bulletproofing. + // This will dump if hostport if all sorts of bad data was passed to + // the constructor + String range = hostport.substring(hostport.indexOf(":") + 1); + if (range.startsWith("-")) + ourfirstport = 0; + else if (range.indexOf("-") == -1) + ourfirstport = Integer.parseInt(range); + else + ourfirstport = + Integer.parseInt(range.substring(0, range.indexOf("-"))); + + if (range.endsWith("-")) + ourlastport = 65535; + else if (range.indexOf("-") == -1) + ourlastport = Integer.parseInt(range); + else + ourlastport = + Integer.parseInt(range. + substring(range.indexOf("-") + 1, + range.length())); } // Get theirs if (p.hostport.indexOf(":") == -1) { - theirfirstport = 0; - ourlastport = 65535; + theirfirstport = 0; + ourlastport = 65535; } else { - // This will dump if hostport if all sorts of bad data was passed to - // the constructor - String range = p.hostport.substring(hostport.indexOf(":") + 1); - if (range.startsWith("-")) - theirfirstport = 0; - else if (range.indexOf("-") == -1) - theirfirstport = Integer.parseInt(range); - else - theirfirstport = - Integer.parseInt(range.substring(0, range.indexOf("-"))); - - if (range.endsWith("-")) - theirlastport = 65535; - else if (range.indexOf("-") == -1) - theirlastport = Integer.parseInt(range); - else - theirlastport = - Integer.parseInt(range. - substring(range.indexOf("-") + 1, - range.length())); + // This will dump if hostport if all sorts of bad data was passed to + // the constructor + String range = p.hostport.substring(hostport.indexOf(":") + 1); + if (range.startsWith("-")) + theirfirstport = 0; + else if (range.indexOf("-") == -1) + theirfirstport = Integer.parseInt(range); + else + theirfirstport = + Integer.parseInt(range.substring(0, range.indexOf("-"))); + + if (range.endsWith("-")) + theirlastport = 65535; + else if (range.indexOf("-") == -1) + theirlastport = Integer.parseInt(range); + else + theirlastport = + Integer.parseInt(range. + substring(range.indexOf("-") + 1, + range.length())); } // Now check them @@ -361,17 +361,17 @@ public final class SocketPermission extends Permission String ourcanonical = null, theircanonical = null; try { - ourcanonical = InetAddress.getByName(ourhost).getHostName(); - theircanonical = InetAddress.getByName(theirhost).getHostName(); + ourcanonical = InetAddress.getByName(ourhost).getHostName(); + theircanonical = InetAddress.getByName(theirhost).getHostName(); } catch (UnknownHostException e) { - // Who didn't resolve? Just assume current address is canonical enough - // Is this ok to do? - if (ourcanonical == null) - ourcanonical = ourhost; - if (theircanonical == null) - theircanonical = theirhost; + // Who didn't resolve? Just assume current address is canonical enough + // Is this ok to do? + if (ourcanonical == null) + ourcanonical = ourhost; + if (theircanonical == null) + theircanonical = theirhost; } if (ourcanonical.equals(theircanonical)) @@ -380,9 +380,9 @@ public final class SocketPermission extends Permission // Well, last chance. Try for a wildcard if (ourhost.indexOf("*.") != -1) { - String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); - if (theircanonical.endsWith(wild_domain)) - return (true); + String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); + if (theircanonical.endsWith(wild_domain)) + return (true); } // Didn't make it |