Skip to content

Commit 37107fc

Browse files
committed
8296007: crash in runtime/DefineClass/NullClassBytesTest.java
Reviewed-by: dcubed, dholmes
1 parent 4999f2c commit 37107fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/hotspot/jtreg/runtime/DefineClass/libNullClassBytesTest.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
#include <jni.h>
2525

26-
JNIEXPORT void JNICALL
26+
JNIEXPORT jclass JNICALL
2727
Java_NullClassBytesTest_nativeDefineClass(JNIEnv *env, jclass klass, jstring className, jobject ldr,
2828
jbyte* class_bytes, jint length) {
2929
if (class_bytes == NULL) {
@@ -32,8 +32,8 @@ Java_NullClassBytesTest_nativeDefineClass(JNIEnv *env, jclass klass, jstring cla
3232
if (cls != 0) {
3333
(*env)->ThrowNew(env, cls, "class_bytes are null");
3434
}
35-
return;
35+
return NULL;
3636
}
3737
const char* c_name = (*env)->GetStringUTFChars(env, className, NULL);
38-
(*env)->DefineClass(env, c_name, ldr, class_bytes, length);
38+
return (*env)->DefineClass(env, c_name, ldr, class_bytes, length);
3939
}

0 commit comments

Comments
 (0)