-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
beta
-
sparc
-
solaris_2.5
Name: sdC67446 Date: 09/23/98
The specification for
java.awt.datatransfer.DataFlavor.isMimeTypeEqual(String mimeType) and
java.awt.datatransfer.DataFlavor.isMimeTypeEqual(DataFlavor dataFlavor)
doesn't specify behavior if input param == null.
Currently methods throw NullPointerException.
Should be fixed for consistency.
The doc says:
-------------------------------------------------------------
public boolean isMimeTypeEqual(java.lang.String mimeType)
Is the string representation of the MIME type passed
in equivalent to the MIME type of this DataFlavor.
This may involve adding default attributes for some
MIME types (like adding charset=US-ASCII to
text/plain MIME types that have no charset parameter specified)
public final boolean isMimeTypeEqual(DataFlavor dataFlavor)
Returns:
if the MimeTypes are equal
The test demonstrating the bug:
------------------------------------------------------------
import java.awt.datatransfer.*;
public class Test {
public static void main(String[] args) {
DataFlavor df = new DataFlavor();
try {
System.out.println(df.isMimeTypeEqual((DataFlavor)null));
} catch (Exception e) {
System.out.println(e);
}
try {
System.out.println(df.isMimeTypeEqual((String)null));
} catch (Exception e) {
System.out.println(e);
}
};
}
Test output:
------------------------------------------------------------
java.lang.NullPointerException
java.lang.NullPointerException
------------------------------------------------------------
======================================================================