diff --git a/src/java.instrument/share/native/libinstrument/InvocationAdapter.c b/src/java.instrument/share/native/libinstrument/InvocationAdapter.c index 9a62d0b1b63..9fbbbe7e341 100644 --- a/src/java.instrument/share/native/libinstrument/InvocationAdapter.c +++ b/src/java.instrument/share/native/libinstrument/InvocationAdapter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -420,14 +420,14 @@ DEF_Agent_OnAttach(JavaVM* vm, char *args, void * reserved) { * Create the java.lang.instrument.Instrumentation instance */ success = createInstrumentationImpl(jni_env, agent); - jplis_assert(success); + jplis_assert_msg(success, "createInstrumentationImpl failed"); /* * Setup ClassFileLoadHook handler. */ if (success) { success = setLivePhaseEventHandlers(agent); - jplis_assert(success); + jplis_assert_msg(success, "setLivePhaseEventHandlers failed"); } /* @@ -439,6 +439,7 @@ DEF_Agent_OnAttach(JavaVM* vm, char *args, void * reserved) { agentClass, options, agent->mAgentmainCaller); + jplis_assert_msg(success, "startJavaAgent failed"); } if (!success) { diff --git a/src/java.instrument/share/native/libinstrument/JPLISAgent.c b/src/java.instrument/share/native/libinstrument/JPLISAgent.c index 4862489b4a9..10b93aa2c98 100644 --- a/src/java.instrument/share/native/libinstrument/JPLISAgent.c +++ b/src/java.instrument/share/native/libinstrument/JPLISAgent.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -448,6 +448,7 @@ startJavaAgent( JPLISAgent * agent, optionsString, &classNameObject, &optionsStringObject); + jplis_assert_msg(success, "commandStringIntoJavaStrings failed"); if (success) { success = invokeJavaAgentMainMethod( jnienv, @@ -455,6 +456,7 @@ startJavaAgent( JPLISAgent * agent, agentMainMethod, classNameObject, optionsStringObject); + jplis_assert_msg(success, "invokeJavaAgentMainMethod failed"); } return success; @@ -614,6 +616,7 @@ invokeJavaAgentMainMethod( JNIEnv * jnienv, errorOutstanding = checkForThrowable(jnienv); if ( errorOutstanding ) { logThrowable(jnienv); + jplis_assert_msg(!errorOutstanding, "Outstanding error when calling method in invokeJavaAgentMainMethod"); } checkForAndClearThrowable(jnienv); }