Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize CGLIB proxied class names #1575

Merged
merged 1 commit into from Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -77,11 +77,19 @@ protected void setTransactionName(Transaction transaction, String methodName, Cl
}

private String getControllerName(String methodName, Class<?> controller) {
String controllerName = isUseFullPackageName() ? controller.getName() : controller.getSimpleName();
int indexOf = controllerName.indexOf(TO_REMOVE);
if (indexOf > 0) {
controllerName = controllerName.substring(0, indexOf);
}
Class<?> originalClass = getOriginalClassIfProxied(controller);
String controllerName = isUseFullPackageName() ? originalClass.getName() : originalClass.getSimpleName();
return '/' + controllerName + '/' + methodName;
}

private Class<?> getOriginalClassIfProxied(Class<?> clazz) {
if (clazz.getName().contains("$$")) {
Class<?> superclass = clazz.getSuperclass();
if (superclass != null && superclass != Object.class) {
return superclass;
}
}

return clazz;
}
}