diff options
author | Michael Koch <konqueror@gmx.de> | 2002-12-21 12:10:04 +0000 |
---|---|---|
committer | Michael Koch <konqueror@gmx.de> | 2002-12-21 12:10:04 +0000 |
commit | 44c24b8928ad51bd426fc79e0fbb247d01767729 (patch) | |
tree | f3ccf36fca6cf793f4daa790c865b260e2f4b0f9 | |
parent | ab1b9b95b4e37ad2ca45e29529bf9f05c97ea54a (diff) | |
download | classpath-44c24b8928ad51bd426fc79e0fbb247d01767729.tar.gz |
2002-12-21 Michael Koch <konqueror@gmx.de>
* java/net/SocketPermission.java:
Reindented.
* java/net/URLDecoder.java
(decode): Added throws IOException.
* java/nio/channels/FileLock.java
(release): Added throws IOException.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | java/net/SocketPermission.java | 112 | ||||
-rw-r--r-- | java/net/URLDecoder.java | 8 | ||||
-rw-r--r-- | java/nio/channels/FileLock.java | 4 |
4 files changed, 72 insertions, 61 deletions
@@ -1,5 +1,14 @@ 2002-12-21 Michael Koch <konqueror@gmx.de> + * java/net/SocketPermission.java: + Reindented. + * java/net/URLDecoder.java + (decode): Added throws IOException. + * java/nio/channels/FileLock.java + (release): Added throws IOException. + +2002-12-21 Michael Koch <konqueror@gmx.de> + * java/net/HttpURLConnection.java (HTTP_NOT_IMPLEMENTED): Must be public. * java/net/ServerSocket.java diff --git a/java/net/SocketPermission.java b/java/net/SocketPermission.java index 18fb7ef2f..6fa65f879 100644 --- a/java/net/SocketPermission.java +++ b/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 diff --git a/java/net/URLDecoder.java b/java/net/URLDecoder.java index d3379217c..0a9067160 100644 --- a/java/net/URLDecoder.java +++ b/java/net/URLDecoder.java @@ -78,16 +78,16 @@ public class URLDecoder * * @return the converted String */ - public static String decode(String s) throws Exception + public static String decode(String s) { try { - return decode(s, "UTF-8"); + return decode(s, "UTF-8"); } catch (UnsupportedEncodingException uee) { - // Should never happen since UTF-8 encoding should always be supported - return s; + // Should never happen since UTF-8 encoding should always be supported + return s; } } diff --git a/java/nio/channels/FileLock.java b/java/nio/channels/FileLock.java index 883c17cf0..1b4595e5c 100644 --- a/java/nio/channels/FileLock.java +++ b/java/nio/channels/FileLock.java @@ -37,6 +37,8 @@ exception statement from your version. */ package java.nio.channels; +import java.io.IOException; + /** * @since 1.4 */ @@ -76,7 +78,7 @@ public abstract class FileLock * @exception IOException If an error occurs * @exception ClosedChannelException If the locked channel is no longer open. */ - public abstract void release (); + public abstract void release () throws IOException; /** * Returns the file channel upon whose file this lock is held. |