This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: ZipEntry(String) with length > 65535
- From: Mark Wielaard <mark at klomp dot org>
- To: java-patches at gcc dot gnu dot org
- Date: 21 Feb 2003 13:52:34 +0100
- Subject: FYI: ZipEntry(String) with length > 65535
- Organization:
Hi,
The following fixes a deficiency in ZipEntry as pointed out by a bug
report against GNU Classpath. The zip format doesn't support very large
file names. There is also a new Mauve test that passes with this fix.
2003-02-21 Mark Wielaard <mark at klomp dot org>
* java/util/zip/ZipEntry.java (ZipEntry(String)): When name is bigger
then 65535 chars throw IllegalArgumentException.
I am committing this to branch and mainline.
Cheers,
Mark
Index: java/util/zip/ZipEntry.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/zip/ZipEntry.java,v
retrieving revision 1.15
diff -u -r1.15 ZipEntry.java
--- java/util/zip/ZipEntry.java 3 Dec 2002 22:06:31 -0000 1.15
+++ java/util/zip/ZipEntry.java 21 Feb 2003 12:49:24 -0000
@@ -84,11 +84,15 @@
* Creates a zip entry with the given name.
* @param name the name. May include directory components separated
* by '/'.
+ *
+ * @exception NullPointerException when name is null.
+ * @exception IllegalArgumentException when name is bigger then 65535 chars.
*/
public ZipEntry(String name)
{
- if (name == null)
- throw new NullPointerException();
+ int length = name.length();
+ if (length > 65535)
+ throw new IllegalArgumentException("name length is " + length);
this.name = name;
}