Skip to content

Commit 4e321b1

Browse files
author
Costin Leau
committed
+ add minor fix to the internal weblogic adapter
1 parent 1dc1d5e commit 4e321b1

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

org.springframework.context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassPreProcessorAdapter.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class WebLogicClassPreProcessorAdapter implements InvocationHandler {
3939

4040
private final ClassLoader loader;
4141

42-
4342
/**
4443
* Creates a new {@link WebLogicClassPreProcessorAdapter}.
4544
* @param transformer the {@link ClassFileTransformer} to be adapted (must
@@ -50,41 +49,37 @@ public WebLogicClassPreProcessorAdapter(ClassFileTransformer transformer, ClassL
5049
this.loader = loader;
5150
}
5251

53-
5452
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
55-
if ("equals".equals(method.getName())) {
53+
String name = method.getName();
54+
55+
if ("equals".equals(name)) {
5656
return (Boolean.valueOf(proxy == args[0]));
57-
}
58-
else if ("hashCode".equals(method.getName())) {
57+
} else if ("hashCode".equals(name)) {
5958
return hashCode();
60-
}
61-
else if ("initialize".equals(method.getName())) {
59+
} else if ("toString".equals(name)) {
60+
return toString();
61+
} else if ("initialize".equals(name)) {
6262
initialize((Hashtable) args[0]);
6363
return null;
64-
}
65-
else if ("preProcess".equals(method.getName())) {
64+
} else if ("preProcess".equals(name)) {
6665
return preProcess((String) args[0], (byte[]) args[1]);
67-
}
68-
else {
66+
} else {
6967
throw new IllegalArgumentException("Unknown method: " + method);
7068
}
7169
}
7270

73-
7471
public void initialize(Hashtable params) {
7572
}
7673

7774
public byte[] preProcess(String className, byte[] classBytes) {
7875
try {
7976
byte[] result = this.transformer.transform(this.loader, className, null, null, classBytes);
8077
return (result != null ? result : classBytes);
81-
}
82-
catch (IllegalClassFormatException ex) {
78+
} catch (IllegalClassFormatException ex) {
8379
throw new IllegalStateException("Cannot transform due to illegal class format", ex);
8480
}
8581
}
8682

87-
8883
@Override
8984
public String toString() {
9085
StringBuilder builder = new StringBuilder(getClass().getName());

0 commit comments

Comments
 (0)