< prev index next >

src/hotspot/share/classfile/classLoader.cpp

Print this page

 186     return NULL;
 187   }
 188 
 189   int utf_len = name->utf8_length();
 190   const jbyte* base = (const jbyte*)name->base();
 191   const jbyte* start = base;
 192   const jbyte* end = UTF8::strrchr(start, utf_len, JVM_SIGNATURE_SLASH);
 193   if (end == NULL) {
 194     return NULL;
 195   }
 196   // Skip over '['s
 197   if (*start == JVM_SIGNATURE_ARRAY) {
 198     do {
 199       start++;
 200     } while (start < end && *start == JVM_SIGNATURE_ARRAY);
 201 
 202     // Fully qualified class names should not contain a 'L'.
 203     // Set bad_class_name to true to indicate that the package name
 204     // could not be obtained due to an error condition.
 205     // In this situation, is_same_class_package returns false.
 206     if (*start == JVM_SIGNATURE_CLASS) {
 207       if (bad_class_name != NULL) {
 208         *bad_class_name = true;
 209       }
 210       return NULL;
 211     }
 212   }
 213   // A class name could have just the slash character in the name,
 214   // in which case start > end
 215   if (start >= end) {
 216     // No package name
 217     if (bad_class_name != NULL) {
 218       *bad_class_name = true;
 219     }
 220     return NULL;
 221   }
 222   return SymbolTable::new_symbol(name, start - base, end - base);
 223 }
 224 
 225 // Given a fully qualified package name, find its defining package in the class loader's
 226 // package entry table.

 186     return NULL;
 187   }
 188 
 189   int utf_len = name->utf8_length();
 190   const jbyte* base = (const jbyte*)name->base();
 191   const jbyte* start = base;
 192   const jbyte* end = UTF8::strrchr(start, utf_len, JVM_SIGNATURE_SLASH);
 193   if (end == NULL) {
 194     return NULL;
 195   }
 196   // Skip over '['s
 197   if (*start == JVM_SIGNATURE_ARRAY) {
 198     do {
 199       start++;
 200     } while (start < end && *start == JVM_SIGNATURE_ARRAY);
 201 
 202     // Fully qualified class names should not contain a 'L'.
 203     // Set bad_class_name to true to indicate that the package name
 204     // could not be obtained due to an error condition.
 205     // In this situation, is_same_class_package returns false.
 206     if (*start == JVM_SIGNATURE_CLASS || *start == JVM_SIGNATURE_INLINE_TYPE) {
 207       if (bad_class_name != NULL) {
 208         *bad_class_name = true;
 209       }
 210       return NULL;
 211     }
 212   }
 213   // A class name could have just the slash character in the name,
 214   // in which case start > end
 215   if (start >= end) {
 216     // No package name
 217     if (bad_class_name != NULL) {
 218       *bad_class_name = true;
 219     }
 220     return NULL;
 221   }
 222   return SymbolTable::new_symbol(name, start - base, end - base);
 223 }
 224 
 225 // Given a fully qualified package name, find its defining package in the class loader's
 226 // package entry table.
< prev index next >