You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/05/15 17:30:03 UTC
svn commit: r656701 - in /tomcat/tc6.0.x/trunk: STATUS.txt
java/org/apache/catalina/tribes/io/ReplicationStream.java
webapps/docs/changelog.xml
Author: fhanik
Date: Thu May 15 08:30:03 2008
New Revision: 656701
URL: http://svn.apache.org/viewvc?rev=656701&view=rev
Log:
fix bug
https://issues.apache.org/bugzilla/show_bug.cgi?id=42662
Modified:
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/io/ReplicationStream.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=656701&r1=656700&r2=656701&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May 15 08:30:03 2008
@@ -56,11 +56,6 @@
+0: remm: do we really want to fix these sort of "bugs" ?
-1:
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42662
- http://svn.apache.org/viewvc?view=rev&revision=645184
- +1: fhanik, markt, pero
- -1:
-
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44595
http://svn.apache.org/viewvc?view=rev&revision=645428
+1: jfclere, rjung, fhanik, remm, pero
@@ -169,7 +164,7 @@
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44988
Use new Java 5 syntax for debugger options
- Patch provided by C�drik Lime
+ Patch provided by Cedrik Lime
http://svn.apache.org/viewvc?rev=655992&view=rev
+1: markt, remm
-1:
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/io/ReplicationStream.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/io/ReplicationStream.java?rev=656701&r1=656700&r2=656701&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/io/ReplicationStream.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/io/ReplicationStream.java Thu May 15 08:30:03 2008
@@ -22,6 +22,8 @@
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
@@ -42,7 +44,6 @@
*/
private ClassLoader[] classLoaders = null;
-
/**
* Construct a new instance of CustomObjectInputStream
*
@@ -71,23 +72,69 @@
public Class resolveClass(ObjectStreamClass classDesc)
throws ClassNotFoundException, IOException {
String name = classDesc.getName();
- boolean tryRepFirst = name.startsWith("org.apache.catalina.tribes");
try {
- try
- {
- if ( tryRepFirst ) return findReplicationClass(name);
- else return findExternalClass(name);
- }
- catch ( Exception x )
- {
- if ( tryRepFirst ) return findExternalClass(name);
- else return findReplicationClass(name);
- }
+ return resolveClass(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
+ */
+ @Override
+ 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());
Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=656701&r1=656700&r2=656701&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu May 15 08:30:03 2008
@@ -35,6 +35,9 @@
<section name="Tomcat 6.0.17 (remm)">
<subsection name="Catalina">
<changelog>
+ <fix><bug>42662</bug>
+ properly resolve reflection proxies during session replication
+ </fix>
<fix>
<bug>29936</bug>: Create digesters and parsers earlier so we aren't
using the webapp class loader when we create them. (markt)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org