-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P5
-
Affects Version/s: 1.3.0
-
Component/s: client-libs
-
None
-
beta
-
generic
-
generic
The following report was sent by email:
Package java.awt.datatransfer
Class MimeTypeParameterList
Method hashCode
File java\awt\datatransfer\MimeTypeParameterList.java, line 51
public int hashCode() {
int code = Integer.MAX_VALUE/45; // "random" value for empty lists
String paramName = null;
for (Enumeration enum = this.getNames();
(enum.hasMoreElements()); paramName = (String)enum.nextElement()){
code += paramName.hashCode();
code += this.get(paramName).hashCode();
}
return code;
} // hashCode()
Expression
paramName = (String)enum.nextElement()
is executed only AFTER first loop iteration; on first iteration paramName is
always null, therefore the next line
code += paramName.hashCode();
must cause NullPointer error.
Package java.awt.datatransfer
Class MimeTypeParameterList
Method hashCode
File java\awt\datatransfer\MimeTypeParameterList.java, line 51
public int hashCode() {
int code = Integer.MAX_VALUE/45; // "random" value for empty lists
String paramName = null;
for (Enumeration enum = this.getNames();
(enum.hasMoreElements()); paramName = (String)enum.nextElement()){
code += paramName.hashCode();
code += this.get(paramName).hashCode();
}
return code;
} // hashCode()
Expression
paramName = (String)enum.nextElement()
is executed only AFTER first loop iteration; on first iteration paramName is
always null, therefore the next line
code += paramName.hashCode();
must cause NullPointer error.