ZipEntry.java (ZipEntry(String)): When name is bigger then 65535 chars throw IllegalA...
authorMark Wielaard <mark@klomp.org>
Fri, 21 Feb 2003 14:08:40 +0000 (14:08 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Fri, 21 Feb 2003 14:08:40 +0000 (14:08 +0000)
       * java/util/zip/ZipEntry.java (ZipEntry(String)): When name is bigger
       then 65535 chars throw IllegalArgumentException.

From-SVN: r63222

libjava/ChangeLog
libjava/java/util/zip/ZipEntry.java

index 2663795eed5da9f16bdf7820984d29cf8dcb2232..c27bd8b5a0b9c3e102af8f1766b9356e9c947a9d 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-21  Mark Wielaard  <mark@klomp.org>
+
+       * java/util/zip/ZipEntry.java (ZipEntry(String)): When name is bigger
+       then 65535 chars throw IllegalArgumentException.
+
 2003-02-21  Mark Wielaard  <mark@klomp.org>
 
        * java/util/zip/ZipFile.java (finalize): New method.
index c9f1b1d7d44374d32ebce863f0d2757fbc088c3e..b70585049dcaa1d1ff0b06789e8886cb821d3ffd 100644 (file)
@@ -84,11 +84,15 @@ public class ZipEntry implements ZipConstants, Cloneable
    * 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;
   }