-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #560 from lostsnow/beta
bump version to 1.12.0
- Loading branch information
Showing
33 changed files
with
673 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ release | |
# for jenv | ||
.java-version | ||
|
||
jmh-result.json | ||
|
||
dongtai-api.jar | ||
dongtai-core.jar | ||
dongtai-grpc.jar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
dongtai-common/src/main/java/io/dongtai/iast/common/constants/AgentConstant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,7 @@ | |
|
||
import java.lang.dongtai.SpyDispatcherHandler; | ||
import java.lang.instrument.Instrumentation; | ||
import java.util.ArrayList; | ||
import java.util.ListIterator; | ||
import java.util.*; | ||
|
||
/** | ||
* @author [email protected] | ||
|
@@ -71,6 +70,7 @@ public static void install(String mode, String propertiesFilePath, Integer agent | |
DongTaiLog.info("DongTai Engine is successfully installed to the JVM, and it takes {} s", | ||
stopWatch.getTime() / 1000); | ||
DongTaiLog.info("DongTai Agent Version: {}, DongTai Server: {}", AgentConstant.VERSION_VALUE, cfg.getBaseUrl()); | ||
inject(inst); | ||
new ServiceDirReport().send(); | ||
} catch (Throwable e) { | ||
DongTaiLog.error(ErrorCode.get("ENGINE_INSTALL_FAILED"), e); | ||
|
@@ -134,4 +134,37 @@ private void destroy() { | |
} | ||
} | ||
|
||
|
||
private static void redefineJavaBaseModule(Instrumentation instrumentation) { | ||
if (doesSupportModules()) { | ||
try { | ||
Instrumentation.class.getMethod("redefineModule", Class.forName("java.lang.Module"), Set.class, Map.class, Map.class, Set.class, Map.class).invoke(instrumentation, getModule(Object.class), Collections.emptySet(), Collections.emptyMap(), Collections.singletonMap("java.lang", Collections.singleton(getModule(EngineManager.class))), Collections.emptySet(), Collections.emptyMap()); | ||
} catch (Exception e) { | ||
DongTaiLog.error(ErrorCode.REDEFINE_MODULE_FAILED,e); | ||
} | ||
} | ||
} | ||
|
||
public static boolean doesSupportModules() { | ||
try { | ||
Class.forName("java.lang.Module"); | ||
return true; | ||
} catch (ClassNotFoundException e) { | ||
return false; | ||
} | ||
} | ||
|
||
private static Object getModule(Class<?> clazz) { | ||
try { | ||
return Class.class.getMethod("getModule", new Class[0]).invoke(clazz, new Object[0]); | ||
} catch (Exception e) { | ||
throw new IllegalStateException("There was a problem while getting the module of the class", e); | ||
} | ||
} | ||
public static void inject(Instrumentation inst) { | ||
if (doesSupportModules()) { | ||
redefineJavaBaseModule(inst); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.