diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-22 05:48:32 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-22 05:48:32 +0000 |
commit | 9a557b44aa0f5381cde0b8f65006061d2f61ea66 (patch) | |
tree | a26b2d5e0d8681e6614ce948326ed658a0d55071 /libjava/java | |
parent | 77bcfcbed0cd6f2088daa57911bc50d1218938b4 (diff) | |
download | ppe42-gcc-9a557b44aa0f5381cde0b8f65006061d2f61ea66.tar.gz ppe42-gcc-9a557b44aa0f5381cde0b8f65006061d2f61ea66.zip |
2003-09-22 Michael Koch <konqueror@gmx.de>
* java/net/JarURLConnection.java
(JarURLConnection): Modifed code to match classpath more, fixed comment.
(getCertificates): Made it more error prone.
(getMainAttributes): Likewise.
(getAttributes): Implemented.
(getManifest): Reformatted code.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71643 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/net/JarURLConnection.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/libjava/java/net/JarURLConnection.java b/libjava/java/net/JarURLConnection.java index b8e9de07c52..d90ea0cc376 100644 --- a/libjava/java/net/JarURLConnection.java +++ b/libjava/java/net/JarURLConnection.java @@ -103,21 +103,21 @@ public abstract class JarURLConnection extends URLConnection * * @specnote This constructor is protected since JDK 1.4 */ - protected JarURLConnection(URL url) + protected JarURLConnection (URL url) throws MalformedURLException { - super(url); + super (url); String spec = url.getFile(); - int bang = spec.indexOf ("!/", 0); + int bang = spec.indexOf ("!/"); if (bang == -1) throw new MalformedURLException (url + ": No `!/' in spec."); - // Extact the url for the jar itself. - jarFileURL = new URL(spec.substring (0, bang)); + // Extract the url for the jar itself. + jarFileURL = new URL (spec.substring (0, bang)); // Get the name of the element, if any. - element = (bang+2==spec.length() ? null : spec.substring (bang+2)); + element = (spec.length() == (bang + 2) ? null : spec.substring (bang + 2)); } /** @@ -428,7 +428,9 @@ public abstract class JarURLConnection extends URLConnection */ public Certificate[] getCertificates () throws IOException { - return getJarEntry ().getCertificates (); + JarEntry entry = getJarEntry(); + + return entry != null ? entry.getCertificates() : null; } /** @@ -441,7 +443,9 @@ public abstract class JarURLConnection extends URLConnection */ public Attributes getMainAttributes () throws IOException { - return getManifest ().getMainAttributes (); + Manifest manifest = getManifest(); + + return manifest != null ? manifest.getMainAttributes() : null; } /** @@ -455,8 +459,9 @@ public abstract class JarURLConnection extends URLConnection */ public Attributes getAttributes () throws IOException { - // FIXME: implement this - return null; + JarEntry entry = getJarEntry(); + + return entry != null ? entry.getAttributes() : null; } /** @@ -469,8 +474,8 @@ public abstract class JarURLConnection extends URLConnection */ public Manifest getManifest () throws IOException { - JarFile file = getJarFile (); + JarFile file = getJarFile(); - return (file != null) ? file.getManifest() : null; + return file != null ? file.getManifest() : null; } } |