From 7a8b6aa6ff1178434f8b82b829b9a62d13650aa5 Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 9 Dec 2002 00:04:00 +0000 Subject: * gnu/gcj/protocol/jar/Connection.java (getJarFile): download and cache remote jar files. * gnu/gcj/runtime/VMClassLoader.java: Don't construct jar URL, only add File.separator to URL when it is a directory. * java/lang/ClassLoader.java: Add Classpath javadoc. (parent): final. (getParent): Add (disabled) security check. (findLibrary): New default method. * java/net/JarURLConnection.java (getManifest): Implement. (getInputStream): Only create InputStream when entry exists. (getHeaders): Only use jarFileURLConnection or JarEntry to set length when they exist. * java/net/URLClassLoader.java: New/Rewritten version from Classpath. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59949 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/net/JarURLConnection.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'libjava/java/net/JarURLConnection.java') diff --git a/libjava/java/net/JarURLConnection.java b/libjava/java/net/JarURLConnection.java index a90c7f33037..6f4cd1fe7ea 100644 --- a/libjava/java/net/JarURLConnection.java +++ b/libjava/java/net/JarURLConnection.java @@ -134,7 +134,11 @@ public abstract class JarURLConnection extends URLConnection if (jarfile != null) { // this is the easy way... - return jarfile.getInputStream (jarfile.getEntry (element)); + ZipEntry entry = jarfile.getEntry(element); + if (entry != null) + return jarfile.getInputStream (entry); + else + return null; } else { @@ -320,12 +324,17 @@ public abstract class JarURLConnection extends URLConnection // to add others later and for consistency, we'll implement it this way. // Add the only header we know about right now: Content-length. - long len; + long len = -1; if (element == null) - len = jarFileURLConnection.getContentLength (); + if (jarFileURLConnection != null) + len = jarFileURLConnection.getContentLength (); else - len = getJarEntry ().getSize (); + { + JarEntry entry = getJarEntry(); + if (entry != null) + len = entry.getSize (); + } String line = "Content-length: " + len; hdrVec.addElement(line); @@ -381,7 +390,6 @@ public abstract class JarURLConnection extends URLConnection { JarFile file = getJarFile (); - // FIXME: implement this - return null; + return (file != null) ? file.getManifest() : null; } } -- cgit v1.2.3