diff options
author | Michael Koch <konqueror@gmx.de> | 2003-02-13 07:33:40 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-02-13 07:33:40 +0000 |
commit | 05008212fbb49fbae7f5a320f9028ea647a2e73f (patch) | |
tree | 89ae8d65c0802ce86c5d1345cb30f8f9daef8b39 /libjava/java/net/SocketPermission.java | |
parent | 4e3243ef0e18e11a7b463d78613a25adb49ace94 (diff) | |
download | gcc-05008212fbb49fbae7f5a320f9028ea647a2e73f.zip gcc-05008212fbb49fbae7f5a320f9028ea647a2e73f.tar.gz gcc-05008212fbb49fbae7f5a320f9028ea647a2e73f.tar.bz2 |
2003-02-13 Michael Koch <konqueror@gmx.de>
* java/net/NetPermission.java
(NetPermission): Make doucmentation match the method declaration.
* java/net/NetworkInterface.java
(equals): Reformated for GNU coding style.
* java/net/ServerSocket.java: Merged with classpath.
* java/net/Socket.java: Partly merged with classpath (Added some @since).
* java/net/SocketImpl.java
(localPort): Merged with classpath (initialize with -1).
* java/net/SocketPermission.java: Merged with classpath (reindented).
* java/net/URLDecoder.java: Merged with classpath (reindented).
From-SVN: r62824
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 18fb7ef..6fa65f8 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 |