8157490: JCK test vm/jni/DefineClass/dfcl001/dfcl00101m1/dfcl00101m1 crashes when run with -Xlog:classload=info

Null stream->source() no longer causes error with -Xlog:class+load

Reviewed-by: lfoltan, coleenp
This commit is contained in:
Max Ockner 2016-06-13 13:47:21 -04:00
parent 349599133d
commit 680e1a3a28
2 changed files with 6 additions and 10 deletions

View File

@ -5356,15 +5356,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
if (!is_internal()) {
if (log_is_enabled(Info, class, load)) {
ResourceMark rm;
const char* module_name = NULL;
static const size_t modules_image_name_len = strlen(MODULES_IMAGE_NAME);
size_t stream_len = strlen(_stream->source());
// See if _stream->source() ends in "modules"
if (module_entry->is_named() && modules_image_name_len < stream_len &&
(strncmp(_stream->source() + stream_len - modules_image_name_len,
MODULES_IMAGE_NAME, modules_image_name_len) == 0)) {
module_name = module_entry->name()->as_C_string();
}
const char* module_name = (module_entry->name() == NULL) ? UNNAMED_MODULE : module_entry->name()->as_C_string();
if (log_is_enabled(Info, class, load)) {
ik->print_loading_log(LogLevel::Info, _loader_data, module_name, _stream);

View File

@ -3004,7 +3004,11 @@ void InstanceKlass::print_loading_log(LogLevel::type type,
if (cfs != NULL) {
if (cfs->source() != NULL) {
if (module_name != NULL) {
log->print(" source: jrt:/%s", module_name);
if (ClassLoader::is_jrt(cfs->source())) {
log->print(" source: jrt:/%s", module_name);
} else {
log->print(" source: %s", cfs->source());
}
} else {
log->print(" source: %s", cfs->source());
}