+ add minor fix to the internal weblogic adapter

This commit is contained in:
Costin Leau 2009-11-12 02:29:08 +00:00
parent 1dc1d5ef9a
commit 4e321b1a3c
1 changed files with 10 additions and 15 deletions

View File

@ -39,7 +39,6 @@ class WebLogicClassPreProcessorAdapter implements InvocationHandler {
private final ClassLoader loader; private final ClassLoader loader;
/** /**
* Creates a new {@link WebLogicClassPreProcessorAdapter}. * Creates a new {@link WebLogicClassPreProcessorAdapter}.
* @param transformer the {@link ClassFileTransformer} to be adapted (must * @param transformer the {@link ClassFileTransformer} to be adapted (must
@ -50,27 +49,25 @@ class WebLogicClassPreProcessorAdapter implements InvocationHandler {
this.loader = loader; this.loader = loader;
} }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if ("equals".equals(method.getName())) { String name = method.getName();
if ("equals".equals(name)) {
return (Boolean.valueOf(proxy == args[0])); return (Boolean.valueOf(proxy == args[0]));
} } else if ("hashCode".equals(name)) {
else if ("hashCode".equals(method.getName())) {
return hashCode(); return hashCode();
} } else if ("toString".equals(name)) {
else if ("initialize".equals(method.getName())) { return toString();
} else if ("initialize".equals(name)) {
initialize((Hashtable) args[0]); initialize((Hashtable) args[0]);
return null; return null;
} } else if ("preProcess".equals(name)) {
else if ("preProcess".equals(method.getName())) {
return preProcess((String) args[0], (byte[]) args[1]); return preProcess((String) args[0], (byte[]) args[1]);
} } else {
else {
throw new IllegalArgumentException("Unknown method: " + method); throw new IllegalArgumentException("Unknown method: " + method);
} }
} }
public void initialize(Hashtable params) { public void initialize(Hashtable params) {
} }
@ -78,13 +75,11 @@ class WebLogicClassPreProcessorAdapter implements InvocationHandler {
try { try {
byte[] result = this.transformer.transform(this.loader, className, null, null, classBytes); byte[] result = this.transformer.transform(this.loader, className, null, null, classBytes);
return (result != null ? result : classBytes); return (result != null ? result : classBytes);
} } catch (IllegalClassFormatException ex) {
catch (IllegalClassFormatException ex) {
throw new IllegalStateException("Cannot transform due to illegal class format", ex); throw new IllegalStateException("Cannot transform due to illegal class format", ex);
} }
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(getClass().getName()); StringBuilder builder = new StringBuilder(getClass().getName());