masayoshi.okutsu@Eng 1996-12-20
Class.forName() doesn't work with a non-ASCII character name.
To reproduce, run the following:
Source program:
// no.1
public class classmini1{
public static void main(String args[]){
String className = "\u6f22\u5b57";
String classToString = "class "+className;
\u6f22\u5b57 kanjiClass = new \u6f22\u5b57();
Class c = kanjiClass.getClass();
}
}
//
class \u6f22\u5b57{
public \u6f22\u5b57(){}
public static void kanjitest(){}
}
// no.2
public class classmini2{
public static void main(String args[]){
String className = "\u6f22\u5b57";
try{
Class c = Class.forName(className);
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
}
}
//
class \u6f22\u5b57{
public \u6f22\u5b57(){}
public static void kanjitest(){}
}
Execution:
// no.1
% java classmini1
java.lang.NoClassDefFoundError: ???í´?ÑÚ
at sun.io.CharToByteJIS0208.<clinit>(CharToByteJIS0208.java:33)
// no.2
% java classmini2
java.lang.IllegalArgumentException: "W
at classmini2.main(classmini2.java:5)
- duplicates
-
JDK-4051149 javavm cannot run with multibytes class name
- Closed
-
JDK-4083527 Using non-ASCII Letter for Class name cuases StringIndexOutOfBoundsException
- Closed
-
JDK-4094685 (i18n) The VM does not handle i18n issues related to class file names correctly
- Closed
- relates to
-
JDK-4023101 Class.getMethod()/getDeclaredMethod() doesn't find non-ASCII method name
- Closed
-
JDK-4214889 fails if unicode escapes are used to create a class name in a java source file
- Closed