-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2.2
-
sparc
-
solaris_2.5
Name: sdC67446 Date: 09/22/98
The methods equals(DataFlavor df), equals(String mt), equals(Object
mt) of class java.awt.datatransfer.DataFlavor throw
NullPointerException if class instance was created with constructor
DataFlavor().
The doc says:
--------------------------------------------------
public boolean equals(DataFlavor dataFlavor)
Returns:
if the DataFlavors represent the same type.
public boolean equals(java.lang.Object o)
Returns:
if the objects are equal
Overrides:
equals in class java.lang.Object
public boolean equals(java.lang.String s)
Returns:
if the String (MimeType) is equal
Here is the test demonstrating the bug:
-----------------Test.java------------------------
import java.awt.datatransfer.*;
public class Test {
public static void main(String[] args) {
DataFlavor df = new DataFlavor();
try {
System.out.println(df.equals((Object)new DataFlavor()));
} catch (Exception e) {
System.out.println("equals(Object): "+e);
}
try {
System.out.println(df.equals(new DataFlavor()));
} catch (Exception e) {
System.out.println("equals(DataFlavor): "+e);
}
try {
System.out.println(df.equals("application/postscript;class=java.awt.datatransfer.DataFlavor"));
} catch (Exception e) {
System.out.println("equals(String) "+e);
}
}
}
---------Output from the test---------------------
equals(Object): java.lang.NullPointerException
equals(DataFlavor): java.lang.NullPointerException
equals(String): java.lang.NullPointerException
--------------------------------------------------
======================================================================
- relates to
-
JDK-4335134 java.awt.datatransfer.DataFlavor.equals throws NullPointerException
-
- Closed
-
-
JDK-4334102 java.awt.datatransfer.DataFlavor.equals throws NullPointerException
-
- Closed
-