aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/JarURLConnection.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2002-12-09 00:04:00 +0000
committerMark Wielaard <mark@gcc.gnu.org>2002-12-09 00:04:00 +0000
commite825ca7ff5b76e07bdcecd4e02fc3e5df792ea72 (patch)
tree6e19dd042b0e115509080d56c741014c959ca437 /libjava/java/net/JarURLConnection.java
parent24632117ce14a2ced57f5ab3fb4551d5c985f04d (diff)
downloadgcc-e825ca7ff5b76e07bdcecd4e02fc3e5df792ea72.zip
gcc-e825ca7ff5b76e07bdcecd4e02fc3e5df792ea72.tar.gz
gcc-e825ca7ff5b76e07bdcecd4e02fc3e5df792ea72.tar.bz2
Connection.java (getJarFile): download and cache remote jar files.
* 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. From-SVN: r59949
Diffstat (limited to 'libjava/java/net/JarURLConnection.java')
-rw-r--r--libjava/java/net/JarURLConnection.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/libjava/java/net/JarURLConnection.java b/libjava/java/net/JarURLConnection.java
index a90c7f3..6f4cd1f 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;
}
}