Author: markt
Date: Fri Aug 12 13:47:10 2011
New Revision: 1157107
URL: http://svn.apache.org/viewvc?rev=1157107&view=rev
Log:
Undo accidental changes included in 1157000
Modified:
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicationStream.java
tomcat/tc5.5.x/trunk/container/modules/groupcom/src/share/org/apache/catalina/tribes/io/ReplicationStream.java
Modified:
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicationStream.java
URL:
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicationStream.java?rev=1157107&r1=1157106&r2=1157107&view=diff
==============================================================================
---
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicationStream.java
(original)
+++
tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicationStream.java
Fri Aug 12 13:47:10 2011
@@ -22,8 +22,6 @@ import java.io.InputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
/**
* Custom subclass of <code>ObjectInputStream</code> that loads from the
@@ -88,43 +86,6 @@ public final class ReplicationStream ext
}
}
- /**
- * ObjectInputStream.resolveProxyClass has some funky way of using
- * the incorrect class loader to resolve proxy classes, let's do it our
way instead
- */
- protected Class resolveProxyClass(String[] interfaces)
- throws IOException, ClassNotFoundException {
-
- ClassLoader latestLoader = classLoader;
- ClassLoader nonPublicLoader = null;
- boolean hasNonPublicInterface = false;
-
- // define proxy in class loader of non-public interface(s), if any
- Class[] classObjs = new Class[interfaces.length];
- for (int i = 0; i < interfaces.length; i++) {
- Class cl = this.findWebappClass(interfaces[i]);
- if (latestLoader == null) latestLoader = cl.getClassLoader();
- if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
- if (hasNonPublicInterface) {
- if (nonPublicLoader != cl.getClassLoader()) {
- throw new IllegalAccessError(
- "conflicting non-public interface class loaders");
- }
- } else {
- nonPublicLoader = cl.getClassLoader();
- hasNonPublicInterface = true;
- }
- }
- classObjs[i] = cl;
- }
- try {
- return Proxy.getProxyClass(hasNonPublicInterface ? nonPublicLoader
- : latestLoader, classObjs);
- } catch (IllegalArgumentException e) {
- throw new ClassNotFoundException(null, e);
- }
- }
-
public Class findReplicationClass(String name)
throws ClassNotFoundException, IOException {
return Class.forName(name, false, getClass().getClassLoader());
Modified:
tomcat/tc5.5.x/trunk/container/modules/groupcom/src/share/org/apache/catalina/tribes/io/ReplicationStream.java
URL:
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/groupcom/src/share/org/apache/catalina/tribes/io/ReplicationStream.java?rev=1157107&r1=1157106&r2=1157107&view=diff
==============================================================================
---
tomcat/tc5.5.x/trunk/container/modules/groupcom/src/share/org/apache/catalina/tribes/io/ReplicationStream.java
(original)
+++
tomcat/tc5.5.x/trunk/container/modules/groupcom/src/share/org/apache/catalina/tribes/io/ReplicationStream.java
Fri Aug 12 13:47:10 2011
@@ -22,8 +22,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
/**
* Custom subclass of <code>ObjectInputStream</code> that loads from the
@@ -73,68 +71,23 @@ public final class ReplicationStream ext
public Class resolveClass(ObjectStreamClass classDesc)
throws ClassNotFoundException, IOException {
String name = classDesc.getName();
+ boolean tryRepFirst = name.startsWith("org.apache.catalina.tribes");
try {
- return resolveClass(name);
+ try
+ {
+ if ( tryRepFirst ) return findReplicationClass(name);
+ else return findExternalClass(name);
+ }
+ catch ( Exception x )
+ {
+ if ( tryRepFirst ) return findExternalClass(name);
+ else return findReplicationClass(name);
+ }
} catch (ClassNotFoundException e) {
return super.resolveClass(classDesc);
}
}
- public Class resolveClass(String name)
- throws ClassNotFoundException, IOException {
-
- boolean tryRepFirst = name.startsWith("org.apache.catalina.tribes");
- try {
- if (tryRepFirst)
- return findReplicationClass(name);
- else
- return findExternalClass(name);
- } catch (Exception x) {
- if (tryRepFirst)
- return findExternalClass(name);
- else
- return findReplicationClass(name);
- }
- }
-
- /**
- * ObjectInputStream.resolveProxyClass has some funky way of using
- * the incorrect class loader to resolve proxy classes, let's do it our
way instead
- */
- protected Class resolveProxyClass(String[] interfaces)
- throws IOException, ClassNotFoundException {
-
- ClassLoader latestLoader = (classLoaders!=null &&
classLoaders.length==0)?null:classLoaders[0];
- ClassLoader nonPublicLoader = null;
- boolean hasNonPublicInterface = false;
-
- // define proxy in class loader of non-public interface(s), if any
- Class[] classObjs = new Class[interfaces.length];
- for (int i = 0; i < interfaces.length; i++) {
- Class cl = this.resolveClass(interfaces[i]);
- if (latestLoader==null) latestLoader = cl.getClassLoader();
- if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
- if (hasNonPublicInterface) {
- if (nonPublicLoader != cl.getClassLoader()) {
- throw new IllegalAccessError(
- "conflicting non-public interface class
loaders");
- }
- } else {
- nonPublicLoader = cl.getClassLoader();
- hasNonPublicInterface = true;
- }
- }
- classObjs[i] = cl;
- }
- try {
- return Proxy.getProxyClass(hasNonPublicInterface ? nonPublicLoader
- : latestLoader, classObjs);
- } catch (IllegalArgumentException e) {
- throw new ClassNotFoundException(null, e);
- }
- }
-
-
public Class findReplicationClass(String name)
throws ClassNotFoundException, IOException {
Class clazz = Class.forName(name, false, getClass().getClassLoader());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]