aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-20 17:49:12 +0000
committergreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-20 17:49:12 +0000
commit57b0b1025d6ee33cfb8c6a7d18153e12f35063b5 (patch)
treea667239f51829ad45d70131f03d739cc10cb341b
parent819726c29fff3824967402e769133d2865ea8721 (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35821 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog16
-rw-r--r--libjava/gij.cc6
-rw-r--r--libjava/java/net/JarURLConnection.java10
-rw-r--r--libjava/java/net/URLClassLoader.java27
-rw-r--r--libjava/java/util/jar/JarFile.java2
-rw-r--r--libjava/java/util/zip/ZipFile.java2
6 files changed, 40 insertions, 23 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2638d0d7b53..119cd52afed 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,19 @@
+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.
+
2000-08-19 Tom Tromey <tromey@cygnus.com>
* java/util/zip/ZipInputStream.java (createZipEntry):
diff --git a/libjava/gij.cc b/libjava/gij.cc
index 948ea03c3a9..54674a9d2c8 100644
--- a/libjava/gij.cc
+++ b/libjava/gij.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -31,7 +31,7 @@ help ()
printf (" --ms=NUMBER set initial heap size\n");
printf (" --mx=NUMBER set maximum heap size\n");
printf (" --version print version number, then exit\n");
- printf ("\nSee http://sourceware.cygnus.com/java/ for information on reporting bugs\n");
+ printf ("\nSee http://sources.redhat.com/java/ for information on reporting bugs\n");
exit (0);
}
@@ -39,7 +39,7 @@ static void
version ()
{
printf ("gij (GNU libgcj) version %s\n\n", VERSION);
- printf ("Copyright (C) 1999 Free Software Foundation.\n");
+ printf ("Copyright (C) 1999, 2000 Free Software Foundation.\n");
printf ("This is free software; see the source for copying conditions. There is NO\n");
printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
exit (0);
diff --git a/libjava/java/net/JarURLConnection.java b/libjava/java/net/JarURLConnection.java
index 86a7291ac37..60adfcd9c61 100644
--- a/libjava/java/net/JarURLConnection.java
+++ b/libjava/java/net/JarURLConnection.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -148,11 +148,13 @@ public abstract class JarURLConnection extends URLConnection
return null;
}
- public JarEntry getJarEntry (String name)
- throws java.io.IOException
+ public JarEntry getJarEntry () throws java.io.IOException
{
JarFile jarfile = null;
+ if (element == null)
+ return null;
+
if (! doInput)
throw new ProtocolException("Can't open JarEntry if doInput is false");
@@ -286,7 +288,7 @@ public abstract class JarURLConnection extends URLConnection
if (element == null)
len = jarFileURLConnection.getContentLength ();
else
- len = getJarEntry (element).getSize ();
+ len = getJarEntry ().getSize ();
String line = "Content-length: " + len;
hdrVec.addElement(line);
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index 8e467ad6b80..441b7cae420 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);
}
}
-
}
diff --git a/libjava/java/util/jar/JarFile.java b/libjava/java/util/jar/JarFile.java
index 3f1823a00b4..bcf7dd89b2e 100644
--- a/libjava/java/util/jar/JarFile.java
+++ b/libjava/java/util/jar/JarFile.java
@@ -232,7 +232,7 @@ public class JarFile extends ZipFile {
public ZipEntry getEntry(String name) {
ZipEntry entry = super.getEntry(name);
if (entry != null) {
- JarEntry jarEntry = new JarEntry(getEntry(name));
+ JarEntry jarEntry = new JarEntry(super.getEntry(name));
if (manifest != null) {
jarEntry.attr = manifest.getAttributes(name);
// XXX jarEntry.certs
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java
index 78257869fe9..22ed74b6e78 100644
--- a/libjava/java/util/zip/ZipFile.java
+++ b/libjava/java/util/zip/ZipFile.java
@@ -121,7 +121,7 @@ public class ZipFile implements ZipConstants
public InputStream getInputStream(ZipEntry ze) throws IOException
{
- byte[] buffer = new byte[(int) ze.getSize()];
+ byte[] buffer = new byte[(int) ze.getCompressedSize()];
/* Read the size of the extra field, and skip to the start of the
data. */