99import io .dongtai .iast .core .handler .hookpoint .models .policy .PolicyNode ;
1010import io .dongtai .iast .core .utils .AsmUtils ;
1111import io .dongtai .log .DongTaiLog ;
12- import org .objectweb .asm .*;
12+ import org .objectweb .asm .ClassVisitor ;
13+ import org .objectweb .asm .MethodVisitor ;
14+ import org .objectweb .asm .Opcodes ;
1315import org .objectweb .asm .commons .JSRInlinerAdapter ;
1416
1517import java .lang .reflect .Modifier ;
16- import java .util .*;
18+ import java .util .HashSet ;
19+ import java .util .Map ;
20+ import java .util .Set ;
1721
1822/**
1923@@ -29,11 +33,14 @@ public DispatchClassPlugin() {
2933 public ClassVisitor dispatch (ClassVisitor classVisitor , ClassContext classContext , Policy policy ) {
3034 ancestors = classContext .getAncestors ();
3135 className = classContext .getClassName ();
32- Set <String > matchedClassNameSet = policy .getMatchedClass (classContext ,className , ancestors );
36+ Set <String > matchedClassNameSet = policy .getMatchedClass (classContext , className , ancestors );
3337
38+ // 匹配的时候增加日志方便根据类或者策略观测定位问题
3439 if (0 == matchedClassNameSet .size ()) {
40+ DongTaiLog .trace ("class = {}, no matching policy, so ignored." , classContext .getClassName ());
3541 return classVisitor ;
3642 }
43+ DongTaiLog .trace ("class = {}, matching policy classes = {}" , classContext .getClassName (), String .join (", " , matchedClassNameSet ));
3744
3845 classContext .setMatchedClassSet (matchedClassNameSet );
3946 return new ClassVisit (classVisitor , classContext , policy );
0 commit comments