@@ -210,7 +210,7 @@ private static boolean forName(JNIEnvironment jni, JNIObjectHandle thread, Break
210
210
JNIObjectHandle name = getObjectArgument (thread , 0 );
211
211
String className = fromJniString (jni , name );
212
212
if (className == null ) {
213
- return false ; /* No point in tracing this. */
213
+ return true ; /* No point in tracing this. */
214
214
}
215
215
traceReflectBreakpoint (jni , bp .clazz , nullHandle (), callerClass , bp .specification .methodName , null , state .getFullStackTraceOrNull (), className );
216
216
return true ;
@@ -573,13 +573,27 @@ private static boolean newArrayInstance0(JNIEnvironment jni, Breakpoint bp, JNIV
573
573
return true ;
574
574
}
575
575
576
+ private static boolean handleResourceRegistration (JNIEnvironment env , JNIObjectHandle clazz , JNIObjectHandle callerClass , String function , JNIMethodId [] stackTrace , String resourceName ,
577
+ String moduleName ) {
578
+ if (resourceName == null ) {
579
+ return true ; /* No point in tracing this: resource path is null */
580
+ }
581
+
582
+ if (moduleName == null ) {
583
+ traceReflectBreakpoint (env , clazz , nullHandle (), callerClass , function , true , stackTrace , resourceName );
584
+ } else {
585
+ traceReflectBreakpoint (env , clazz , nullHandle (), callerClass , function , true , stackTrace , moduleName , resourceName );
586
+ }
587
+
588
+ return true ;
589
+ }
590
+
576
591
private static boolean findResource (JNIEnvironment jni , JNIObjectHandle thread , Breakpoint bp , InterceptedState state ) {
577
592
JNIObjectHandle callerClass = state .getDirectCallerClass ();
578
593
JNIObjectHandle module = getObjectArgument (thread , 1 );
579
594
JNIObjectHandle name = getObjectArgument (thread , 2 );
580
- traceReflectBreakpoint (jni , nullHandle (), nullHandle (), callerClass , bp .specification .methodName , true , state .getFullStackTraceOrNull (),
581
- fromJniString (jni , module ), fromJniString (jni , name ));
582
- return true ;
595
+
596
+ return handleResourceRegistration (jni , nullHandle (), callerClass , bp .specification .methodName , state .getFullStackTraceOrNull (), fromJniString (jni , name ), fromJniString (jni , module ));
583
597
}
584
598
585
599
private static boolean getResource (JNIEnvironment jni , JNIObjectHandle thread , Breakpoint bp , InterceptedState state ) {
@@ -601,8 +615,8 @@ private static boolean handleGetResources(JNIEnvironment jni, JNIObjectHandle th
601
615
selfClazz = nullHandle ();
602
616
}
603
617
}
604
- traceReflectBreakpoint ( jni , selfClazz , nullHandle (), callerClass , bp . specification . methodName , true , state . getFullStackTraceOrNull (), fromJniString ( jni , name ));
605
- return true ;
618
+
619
+ return handleResourceRegistration ( jni , selfClazz , callerClass , bp . specification . methodName , state . getFullStackTraceOrNull (), fromJniString ( jni , name ), null ) ;
606
620
}
607
621
608
622
private static boolean getSystemResource (JNIEnvironment jni , JNIObjectHandle thread , Breakpoint bp , InterceptedState state ) {
@@ -615,9 +629,9 @@ private static boolean getSystemResources(JNIEnvironment jni, JNIObjectHandle th
615
629
616
630
private static boolean handleGetSystemResources (JNIEnvironment jni , JNIObjectHandle thread , Breakpoint bp , InterceptedState state ) {
617
631
JNIObjectHandle callerClass = state .getDirectCallerClass ();
618
- JNIObjectHandle name = getReceiver (thread );
619
- traceReflectBreakpoint ( jni , nullHandle (), nullHandle (), callerClass , bp . specification . methodName , true , state . getFullStackTraceOrNull (), fromJniString ( jni , name ));
620
- return true ;
632
+ JNIObjectHandle name = getObjectArgument (thread , 0 );
633
+
634
+ return handleResourceRegistration ( jni , nullHandle (), callerClass , bp . specification . methodName , state . getFullStackTraceOrNull (), fromJniString ( jni , name ), null ) ;
621
635
}
622
636
623
637
private static boolean newProxyInstance (JNIEnvironment jni , JNIObjectHandle thread , Breakpoint bp , InterceptedState state ) {
0 commit comments