equal
deleted
inserted
replaced
4954 // This method is also called from the modular system APIs in modules.cpp |
4954 // This method is also called from the modular system APIs in modules.cpp |
4955 // to verify the validity of module and package names. |
4955 // to verify the validity of module and package names. |
4956 bool ClassFileParser::verify_unqualified_name(const char* name, |
4956 bool ClassFileParser::verify_unqualified_name(const char* name, |
4957 unsigned int length, |
4957 unsigned int length, |
4958 int type) { |
4958 int type) { |
|
4959 if (length == 0) return false; // Must have at least one char. |
4959 for (const char* p = name; p != name + length; p++) { |
4960 for (const char* p = name; p != name + length; p++) { |
4960 switch(*p) { |
4961 switch(*p) { |
4961 case '.': |
4962 case '.': |
4962 case ';': |
4963 case ';': |
4963 case '[': |
4964 case '[': |
5103 // Format check signature |
5104 // Format check signature |
5104 if (c != NULL) { |
5105 if (c != NULL) { |
5105 int newlen = c - (char*) signature; |
5106 int newlen = c - (char*) signature; |
5106 bool legal = verify_unqualified_name(signature, newlen, LegalClass); |
5107 bool legal = verify_unqualified_name(signature, newlen, LegalClass); |
5107 if (!legal) { |
5108 if (!legal) { |
5108 classfile_parse_error("Class name contains illegal character " |
5109 classfile_parse_error("Class name is empty or contains illegal character " |
5109 "in descriptor in class file %s", |
5110 "in descriptor in class file %s", |
5110 CHECK_0); |
5111 CHECK_0); |
5111 return NULL; |
5112 return NULL; |
5112 } |
5113 } |
5113 return signature + newlen + 1; |
5114 return signature + newlen + 1; |