Fix potential StackOverFlowError on regexp (#1193)
Fix potential StackOverFlowError on regexp
This commit is contained in:
commit
8757ba0a81
|
@ -42,16 +42,25 @@ public class TraceConfigInstrumentation implements Instrumenter {
|
|||
+ PACKAGE_CLASS_NAME_REGEX
|
||||
+ "\\["
|
||||
+ METHOD_LIST_REGEX
|
||||
+ "\\]\\s*;?\\s*";
|
||||
+ "\\]";
|
||||
|
||||
private final Map<String, Set<String>> classMethodsToTrace;
|
||||
|
||||
private boolean validateConfigString(String configString) {
|
||||
for (String segment : configString.split(";")) {
|
||||
if (!segment.trim().matches(CONFIG_FORMAT)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public TraceConfigInstrumentation() {
|
||||
final String configString = Config.get().getTraceMethods();
|
||||
if (configString == null || configString.trim().isEmpty()) {
|
||||
classMethodsToTrace = Collections.emptyMap();
|
||||
|
||||
} else if (!configString.matches(CONFIG_FORMAT)) {
|
||||
} else if (!validateConfigString(configString)) {
|
||||
log.warn(
|
||||
"Invalid trace method config '{}'. Must match 'package.Class$Name[method1,method2];*'.",
|
||||
configString);
|
||||
|
|
Loading…
Reference in New Issue