Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -758,18 +758,21 @@ private static boolean newArrayInstance0(JNIEnvironment jni, Breakpoint bp, JNIV
return true;
}

private static boolean handleResourceRegistration(JNIEnvironment env, JNIObjectHandle clazz, JNIObjectHandle callerClass, String function, JNIMethodId[] stackTrace, String resourceName,
String moduleName) {
private static boolean handleResourceRegistration(JNIEnvironment env, JNIObjectHandle clazz, JNIObjectHandle callerClass, String function, JNIMethodId[] stackTrace, String resourceName) {
if (resourceName == null) {
return true; /* No point in tracing this: resource path is null */
}
traceReflectBreakpoint(env, clazz, nullHandle(), callerClass, function, true, stackTrace, resourceName);
return true;
}

if (moduleName == null) {
traceReflectBreakpoint(env, clazz, nullHandle(), callerClass, function, true, stackTrace, resourceName);
} else {
traceReflectBreakpoint(env, clazz, nullHandle(), callerClass, function, true, stackTrace, moduleName, resourceName);
private static boolean handleResourceRegistrationWithModuleName(JNIEnvironment env, JNIObjectHandle clazz, JNIObjectHandle callerClass, String function, JNIMethodId[] stackTrace,
String resourceName,
String moduleName) {
if (resourceName == null) {
return true; /* No point in tracing this: resource path is null */
}

traceReflectBreakpoint(env, clazz, nullHandle(), callerClass, function, true, stackTrace, moduleName, resourceName);
return true;
}

Expand All @@ -778,7 +781,8 @@ private static boolean findResource(JNIEnvironment jni, JNIObjectHandle thread,
JNIObjectHandle module = getObjectArgument(thread, 1);
JNIObjectHandle name = getObjectArgument(thread, 2);

return handleResourceRegistration(jni, nullHandle(), callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), fromJniString(jni, name), fromJniString(jni, module));
return handleResourceRegistrationWithModuleName(jni, nullHandle(), callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), fromJniString(jni, name),
fromJniString(jni, module));
}

private static boolean getResource(JNIEnvironment jni, JNIObjectHandle thread, Breakpoint bp, InterceptedState state) {
Expand All @@ -801,7 +805,7 @@ private static boolean handleGetResources(JNIEnvironment jni, JNIObjectHandle th
}
}

return handleResourceRegistration(jni, selfClazz, callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), fromJniString(jni, name), null);
return handleResourceRegistration(jni, selfClazz, callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), fromJniString(jni, name));
}

private static boolean getSystemResource(JNIEnvironment jni, JNIObjectHandle thread, Breakpoint bp, InterceptedState state) {
Expand All @@ -816,7 +820,7 @@ private static boolean handleGetSystemResources(JNIEnvironment jni, JNIObjectHan
JNIObjectHandle callerClass = state.getDirectCallerClass();
JNIObjectHandle name = getObjectArgument(thread, 0);

return handleResourceRegistration(jni, nullHandle(), callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), fromJniString(jni, name), null);
return handleResourceRegistration(jni, nullHandle(), callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), fromJniString(jni, name));
}

private static boolean getZipEntry(JNIEnvironment jni, JNIObjectHandle thread, Breakpoint bp, InterceptedState state) {
Expand All @@ -836,7 +840,7 @@ private static boolean getZipEntry(JNIEnvironment jni, JNIObjectHandle thread, B
}
JNIObjectHandle zipFileReceiver = getReceiver(thread);
String zipFileName = fromJniString(jni, Support.callObjectMethod(jni, zipFileReceiver, agent.handles().getJavaUtilZipZipFileGetName(jni)));
if (!agent.classPathEntries.contains(zipFileName)) {
if (zipFileName == null || !agent.classPathEntries.contains(zipFileName)) {
return true;
}

Expand All @@ -846,7 +850,7 @@ private static boolean getZipEntry(JNIEnvironment jni, JNIObjectHandle thread, B
}
JNIObjectHandle callerClass = state.getDirectCallerClass();

return handleResourceRegistration(jni, selfClazz, callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), name, null);
return handleResourceRegistration(jni, selfClazz, callerClass, bp.specification.methodName, state.getFullStackTraceOrNull(), name);
}

private static boolean newProxyInstance(JNIEnvironment jni, JNIObjectHandle thread, Breakpoint bp, InterceptedState state) {
Expand Down