aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/util/zip/ZipEntry.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/util/zip/ZipEntry.java')
-rw-r--r--libjava/java/util/zip/ZipEntry.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/libjava/java/util/zip/ZipEntry.java b/libjava/java/util/zip/ZipEntry.java
index c9f1b1d7d44..5284d793f6c 100644
--- a/libjava/java/util/zip/ZipEntry.java
+++ b/libjava/java/util/zip/ZipEntry.java
@@ -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;
}
@@ -365,7 +369,7 @@ public class ZipEntry implements ZipConstants, Cloneable
*/
public void setComment(String comment)
{
- if (comment.length() > 0xffff)
+ if (comment != null && comment.length() > 0xffff)
throw new IllegalArgumentException();
this.comment = comment;
}