-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
beta
-
sparc
-
solaris_2.5
Name: sdC67446 Date: 09/15/98
The constructor DataFlavor(String mimeType) doesn't throw
IllegalArgumentException if input param doesn't specify class.
The doc says:
--------------------------------------------------
public DataFlavor(java.lang.String mimeType)
throws java.lang.ClassNotFoundException
construct a DataFlavor from a Mime Type string.
The string must specify a "class=" parameter in order
to succeed in constructing a DataFlavor.
Parameters:
mimeType - the string used to identify the MIME type
for this flavor. If the the mimeType does not
specify a "class=" parameter, or if the class is
not successfully loaded, then an
IllegalArgumentException is thrown.
The test demonstrating the bug:
-----------------Test.java------------------------
import java.awt.datatransfer.*;
public class Test {
public static void main(String[] args) {
DataFlavor df = null;
try {
System.out.println("1/");
df = new DataFlavor("application/postscript");
} catch (Exception e) {
System.out.println(e);
}
try {
System.out.println("2/");
df = new DataFlavor("application/postscript;class=java.nowhere.Nobody");
} catch (Exception e) {
System.out.println(e);
}
try {
System.out.println("3/");
df = new DataFlavor("application/postscript;class=");
} catch (Exception e) {
System.out.println(e);
}
}
}
---------Output from the test---------------------
1/
2/
java.lang.ClassNotFoundException: java.nowhere.Nobody
3/
java.lang.IllegalArgumentException: failed to parse:application/postscript;class=
--------------------------------------------------
======================================================================