diff --git a/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/TestableClassTransformer.java b/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/TestableClassTransformer.java index ea5d4c4..a8a992e 100644 --- a/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/TestableClassTransformer.java +++ b/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/TestableClassTransformer.java @@ -41,7 +41,6 @@ public class TestableClassTransformer implements ClassFileTransformer { /** * Just avoid spend time to scan those surely non-user classes Should keep these lists as tiny as possible */ - private final String[] WHITELIST_PREFIXES = new String[] {"com/alibaba/testable/demo/"}; private final String[] BLACKLIST_PREFIXES = new String[] {"jdk/", "java/", "javax/", "sun/", "com/sun/", "org/apache/maven/", "com/alibaba/testable/", "junit/", "org/junit/", "org/testng/"}; @@ -83,6 +82,7 @@ public class TestableClassTransformer implements ClassFileTransformer { } catch (Throwable t) { LogUtil.warn("Failed to transform class " + className); LogUtil.diagnose(t.toString()); + LogUtil.diagnose(ThreadUtil.getFirstRelatedStackLine(t)); } finally { LogUtil.resetLogLevel(); } @@ -153,11 +153,6 @@ public class TestableClassTransformer implements ClassFileTransformer { } return true; } else { - for (String prefix : WHITELIST_PREFIXES) { - if (className.startsWith(prefix)) { - return false; - } - } for (String prefix : BLACKLIST_PREFIXES) { if (className.startsWith(prefix)) { return true; diff --git a/testable-agent/src/main/java/com/alibaba/testable/agent/util/ThreadUtil.java b/testable-agent/src/main/java/com/alibaba/testable/agent/util/ThreadUtil.java new file mode 100644 index 0000000..f42e867 --- /dev/null +++ b/testable-agent/src/main/java/com/alibaba/testable/agent/util/ThreadUtil.java @@ -0,0 +1,19 @@ +package com.alibaba.testable.agent.util; + +/** + * @author flin + */ +public class ThreadUtil { + + private static final String PKG_TESTABLE_AGENT = "com.alibaba.testable.agent."; + + public static String getFirstRelatedStackLine(Throwable t) { + for (StackTraceElement e : t.getStackTrace()) { + if (e.getClassName().startsWith(PKG_TESTABLE_AGENT)) { + return e.toString(); + } + } + return ""; + } + +}