988 JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name)) |
988 JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name)) |
989 JVMWrapper("JVM_FindLoadedClass"); |
989 JVMWrapper("JVM_FindLoadedClass"); |
990 ResourceMark rm(THREAD); |
990 ResourceMark rm(THREAD); |
991 |
991 |
992 Handle h_name (THREAD, JNIHandles::resolve_non_null(name)); |
992 Handle h_name (THREAD, JNIHandles::resolve_non_null(name)); |
993 Handle string = java_lang_String::internalize_classname(h_name, CHECK_NULL); |
993 char* str = java_lang_String::as_utf8_string(h_name()); |
994 |
994 |
995 const char* str = java_lang_String::as_utf8_string(string()); |
|
996 // Sanity check, don't expect null |
995 // Sanity check, don't expect null |
997 if (str == NULL) return NULL; |
996 if (str == NULL) return NULL; |
998 |
997 |
999 const int str_len = (int)strlen(str); |
998 // Internalize the string, converting '.' to '/' in string. |
|
999 char* p = (char*)str; |
|
1000 while (*p != '\0') { |
|
1001 if (*p == '.') { |
|
1002 *p = '/'; |
|
1003 } |
|
1004 p++; |
|
1005 } |
|
1006 |
|
1007 const int str_len = (int)(p - str); |
1000 if (str_len > Symbol::max_length()) { |
1008 if (str_len > Symbol::max_length()) { |
1001 // It's impossible to create this class; the name cannot fit |
1009 // It's impossible to create this class; the name cannot fit |
1002 // into the constant pool. |
1010 // into the constant pool. |
1003 return NULL; |
1011 return NULL; |
1004 } |
1012 } |