# HG changeset patch # User ksrini # Date 1446054686 0 # Wed Oct 28 17:51:26 2015 +0000 # Node ID 2affcbf37227039e69efcd5bd79f907059cf4b0c # Parent 5c1d06cd7d7b68bf3bc0018553f4022f60d7a6e1 8068033: JNI exception pending in jdk/src/share/bin/java.c Reviewed-by: mchung, serb diff --git a/src/macosx/bin/java_md_macosx.c b/src/macosx/bin/java_md_macosx.c --- a/src/macosx/bin/java_md_macosx.c +++ b/src/macosx/bin/java_md_macosx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1068,6 +1068,7 @@ void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm) { jvmInstance = vm; SetMainClassForAWT(env, mainClass); + CHECK_EXCEPTION_RETURN(); ShowSplashScreen(); } diff --git a/src/share/bin/java.c b/src/share/bin/java.c --- a/src/share/bin/java.c +++ b/src/share/bin/java.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -459,6 +459,7 @@ * of the application class. */ PostJVMInit(env, appClass, vm); + CHECK_EXCEPTION_LEAVE(1); /* * The LoadMainClass not only loads the main class, it will also ensure * that the main method's signature is correct, therefore further checking diff --git a/src/share/bin/java.h b/src/share/bin/java.h --- a/src/share/bin/java.h +++ b/src/share/bin/java.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -256,6 +256,13 @@ #define NULL_CHECK(NC_check_pointer) \ NULL_CHECK_RETURN_VALUE(NC_check_pointer, ) +#define CHECK_EXCEPTION_RETURN() \ + do { \ + if ((*env)->ExceptionOccurred(env)) { \ + return; \ + } \ + } while (JNI_FALSE) + /* * For JNI calls : * - check for thrown exceptions