< prev index next >

src/hotspot/share/classfile/classLoader.cpp

Print this page




 191     *bad_class_name = false;
 192   }
 193 
 194   const char* const last_slash = strrchr(class_name, '/');
 195   if (last_slash == NULL) {
 196     // No package name
 197     return NULL;
 198   }
 199 
 200   char* class_name_ptr = (char*) class_name;
 201   // Skip over '['s
 202   if (*class_name_ptr == '[') {
 203     do {
 204       class_name_ptr++;
 205     } while (*class_name_ptr == '[');
 206 
 207     // Fully qualified class names should not contain a 'L'.
 208     // Set bad_class_name to true to indicate that the package name
 209     // could not be obtained due to an error condition.
 210     // In this situation, is_same_class_package returns false.
 211     if (*class_name_ptr == 'L') {
 212       if (bad_class_name != NULL) {
 213         *bad_class_name = true;
 214       }
 215       return NULL;
 216     }
 217   }
 218 
 219   int length = last_slash - class_name_ptr;
 220 
 221   // A class name could have just the slash character in the name.
 222   if (length <= 0) {
 223     // No package name
 224     if (bad_class_name != NULL) {
 225       *bad_class_name = true;
 226     }
 227     return NULL;
 228   }
 229 
 230   // drop name after last slash (including slash)
 231   // Ex., "java/lang/String.class" => "java/lang"




 191     *bad_class_name = false;
 192   }
 193 
 194   const char* const last_slash = strrchr(class_name, '/');
 195   if (last_slash == NULL) {
 196     // No package name
 197     return NULL;
 198   }
 199 
 200   char* class_name_ptr = (char*) class_name;
 201   // Skip over '['s
 202   if (*class_name_ptr == '[') {
 203     do {
 204       class_name_ptr++;
 205     } while (*class_name_ptr == '[');
 206 
 207     // Fully qualified class names should not contain a 'L'.
 208     // Set bad_class_name to true to indicate that the package name
 209     // could not be obtained due to an error condition.
 210     // In this situation, is_same_class_package returns false.
 211     if (*class_name_ptr == 'L' || *class_name_ptr == 'Q') {
 212       if (bad_class_name != NULL) {
 213         *bad_class_name = true;
 214       }
 215       return NULL;
 216     }
 217   }
 218 
 219   int length = last_slash - class_name_ptr;
 220 
 221   // A class name could have just the slash character in the name.
 222   if (length <= 0) {
 223     // No package name
 224     if (bad_class_name != NULL) {
 225       *bad_class_name = true;
 226     }
 227     return NULL;
 228   }
 229 
 230   // drop name after last slash (including slash)
 231   // Ex., "java/lang/String.class" => "java/lang"


< prev index next >