aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/URLClassLoader.java
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2000-08-20 17:49:12 +0000
committerAnthony Green <green@gcc.gnu.org>2000-08-20 17:49:12 +0000
commitf2e541ce26c87f29e2a2798b85674725a6aa094a (patch)
treea667239f51829ad45d70131f03d739cc10cb341b /libjava/java/net/URLClassLoader.java
parent1175b9b4c50acab6a26f3fa5ce7299cae62b5008 (diff)
downloadgcc-f2e541ce26c87f29e2a2798b85674725a6aa094a.zip
gcc-f2e541ce26c87f29e2a2798b85674725a6aa094a.tar.gz
gcc-f2e541ce26c87f29e2a2798b85674725a6aa094a.tar.bz2
URLClassLoader.java: Find the JarEntry via the JarFile.
Sun Aug 20 09:51:48 2000 Anthony Green <green@redhat.com> * java/net/URLClassLoader.java: Find the JarEntry via the JarFile. * java/net/JarURLConnection.java: getEntry doesn't take any arguments. Return null if element is null. * java/util/zip/ZipFile.java (getInputStream): Read the compressed size from the archive, not the inflated size. * java/util/jar/JarFile.java (getEntry): Don't recurse. Call java.util.zip.ZipFile.getEntry. * gij.cc (help): Change sourceware reference to sources.redhat.com. From-SVN: r35821
Diffstat (limited to 'libjava/java/net/URLClassLoader.java')
-rw-r--r--libjava/java/net/URLClassLoader.java27
1 files changed, 13 insertions, 14 deletions
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index 8e467ad..441b7ca 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -20,8 +20,8 @@ public class URLClassLoader extends ClassLoader
// `path' contains simply the URL's we're using for the searching.
private Vector path;
- // If path[n] is a zip/jar, then this holds a JarURLConnection for that thing,
- // otherwise, path[n] is null.
+ // If path[n] is a zip/jar, then this holds a JarURLConnection for
+ // that thing, otherwise, path[n] is null.
private Vector info;
private URLStreamHandler getHandler0 (String protocol)
@@ -115,10 +115,10 @@ public class URLClassLoader extends ClassLoader
try {
JarURLConnection conn = (JarURLConnection) info.elementAt (i);
-
+
if (conn != null)
{
- if (conn.getJarEntry (name) != null)
+ if (conn.getJarFile().getJarEntry (name) != null)
return new URL(u, name, getHandler0 (u.getProtocol()));
}
else
@@ -187,15 +187,15 @@ public class URLClassLoader extends ClassLoader
try
{
- InputStream is = getResourceAsStream (name.replace ('.', '/') + ".class");
-
- if (is == null)
+ URL u = getResource (name.replace ('.', '/') + ".class");
+
+ if (u == null)
throw new ClassNotFoundException (name);
-
- // Here we have to rely on available() to provide the length of
- // the class; which might not be exactly right in some cases...
-
- int len = is.available ();
+
+ URLConnection connection = u.openConnection ();
+ InputStream is = connection.getInputStream ();
+
+ int len = connection.getContentLength ();
byte[] data = new byte[len];
int left = len;
@@ -216,6 +216,5 @@ public class URLClassLoader extends ClassLoader
throw new ClassNotFoundException(name);
}
}
-
}