-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
kestrel
-
sparc
-
solaris_2.6
-
Verified
Name: ksC84122 Date: 12/28/98
java.util.jar.Attributes.Name(String name) accepts empty String as
a parameter and creates a new object in JDK-1.2fcs.
However the JavaDoc for Attributes.Name(String name)says that
constructor throws "IllegalArgumentException - if the attribute name was invalid".
The constructor should recognize empty name as invalid attribute name and throw
IllegalArgumentException per Attribute.Name definition in JavaDoc:
"The Attributes.Name class represents an attribute name stored in this Map. Attribute names are
case-insensitive and restricted to the ASCII characters in the set [0-9a-zA-Z_-]."
Empty attribute name makes no sense and should not be allowed.
An example to reproduce this:
===== Test20.java ========
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
public class Test20 {
public static void main (String argv[]) {
try {
new Attributes.Name("");
} catch (IllegalArgumentException iae) {
System.out.println("Passed");
return;
}
System.out.println("Failed: IllegalArgumentException expected");
return;
}
}
========= Sample run (JDK-1.2fcs) ==========
#>java Test20
Failed: IllegalArgumentException expected
======================================================================