last again nicer making
This commit is contained in:
parent
3414c3d510
commit
84374f5d0d
1 changed files with 3 additions and 4 deletions
|
|
@ -6,7 +6,6 @@ import java.lang.constant.ClassDesc;
|
||||||
import java.lang.constant.MethodTypeDesc;
|
import java.lang.constant.MethodTypeDesc;
|
||||||
import java.lang.instrument.ClassDefinition;
|
import java.lang.instrument.ClassDefinition;
|
||||||
import java.lang.instrument.ClassFileTransformer;
|
import java.lang.instrument.ClassFileTransformer;
|
||||||
import java.lang.instrument.IllegalClassFormatException;
|
|
||||||
import java.lang.instrument.Instrumentation;
|
import java.lang.instrument.Instrumentation;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
@ -14,9 +13,9 @@ import java.security.ProtectionDomain;
|
||||||
|
|
||||||
public class Agent {
|
public class Agent {
|
||||||
|
|
||||||
private static final String MESSAGE = "--- Exceptional agent active";
|
@SuppressWarnings("DataFlowIssue")
|
||||||
|
|
||||||
public static void premain(String agentArgs, Instrumentation instrumentation) throws Exception {
|
public static void premain(String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||||
|
System.err.println("--->Exceptional agent active");
|
||||||
// add transformer
|
// add transformer
|
||||||
instrumentation.addTransformer(new ClassFileTransformer() {
|
instrumentation.addTransformer(new ClassFileTransformer() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -25,7 +24,7 @@ public class Agent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] transform(Module module, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
|
public byte[] transform(Module module, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
|
||||||
return instrumentThrowable(className, classfileBuffer);
|
return instrumentThrowable(className, classfileBuffer);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue