Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjie-fourth committed May 13, 2023
1 parent ea4844e commit 5b073d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@

使用javaAgent,动态的Mock某些方法的方法。
使用javaAgent,动态的Mock某些方法的方法。
```shell
java -javaagent:./agent/target/agent-1.0.jar -jar ./test-application/target/test-application-1.0.jar
```
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.github.fourth.mocksystem.agent;

import javassist.*;

import java.io.IOException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;

import java.lang.instrument.ClassFileTransformer;
import java.security.ProtectionDomain;

Expand Down Expand Up @@ -54,8 +56,8 @@ public byte[] transform(ClassLoader loader, String className, Class<?> classBein

byteCode = cc.toBytecode();
cc.detach();
} catch (NotFoundException | CannotCompileException | IOException e) {
MockSystemAgent.LOGGER.error("Exception" + e.toString());
} catch (Exception e) {
MockSystemAgent.LOGGER.error("Exception" + e);
}
}
return byteCode;
Expand Down

0 comments on commit 5b073d4

Please sign in to comment.