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

Hoist Class.getName() from String concatenation to dodge an issue related to profile pollution #24153

Merged
merged 1 commit into from Dec 6, 2019
Merged
Show file tree
Hide file tree
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 @@ -73,8 +73,8 @@ protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throw
* @return the description
*/
protected String getInvocationDescription(MethodInvocation invocation) {
return "method '" + invocation.getMethod().getName() + "' of class [" +
invocation.getThis().getClass().getName() + "]";
String className = invocation.getThis().getClass().getName();
return "method '" + invocation.getMethod().getName() + "' of class [" + className + "]";
}

}
Expand Up @@ -523,7 +523,8 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
return null;
}
}
String editorName = targetType.getName() + "Editor";
String targetTypeName = targetType.getName();
String editorName = targetTypeName + "Editor";
try {
Class<?> editorClass = cl.loadClass(editorName);
if (!PropertyEditor.class.isAssignableFrom(editorClass)) {
Expand All @@ -539,7 +540,7 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
catch (ClassNotFoundException ex) {
if (logger.isTraceEnabled()) {
logger.trace("No property editor [" + editorName + "] found for type " +
targetType.getName() + " according to 'Editor' suffix convention");
targetTypeName + " according to 'Editor' suffix convention");
}
unknownEditorTypes.add(targetType);
return null;
Expand Down
Expand Up @@ -611,7 +611,9 @@ public static String identityToString(@Nullable Object obj) {
if (obj == null) {
return EMPTY_STRING;
}
return obj.getClass().getName() + "@" + getIdentityHexString(obj);
String className = obj.getClass().getName();
String identityHexString = getIdentityHexString(obj);
return className + '@' + identityHexString;
}

/**
Expand Down
Expand Up @@ -123,8 +123,8 @@ public Mono<Void> filter(ServerWebExchange exchange) {
}

private Mono<Void> invokeFilter(WebFilter current, DefaultWebFilterChain chain, ServerWebExchange exchange) {
return current.filter(exchange, chain)
.checkpoint(current.getClass().getName() + " [DefaultWebFilterChain]");
String currentName = current.getClass().getName();
return current.filter(exchange, chain).checkpoint(currentName + " [DefaultWebFilterChain]");
}

}