[EMAIL PROTECTED] wrote:
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34090>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34090

------- Additional Comments From [EMAIL PROTECTED]  2005-03-21 17:40 -------
Whatever it is you are doing is absolutely scary. I tried to see if calling the
superclass helps and does not cause regressions or problems, as the field you
mention cannot be used.

If I commit this, does Sun see it as a legal problem ? Simply calling the superclass could create issues, and I don't want to try it.


Index: CustomObjectInputStream.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CustomObjectInputStream.java,v
retrieving revision 1.4
diff -u -r1.4 CustomObjectInputStream.java
--- CustomObjectInputStream.java 10 Mar 2005 23:54:45 -0000 1.4
+++ CustomObjectInputStream.java 21 Mar 2005 16:47:25 -0000
@@ -21,6 +21,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.lang.reflect.Proxy;
+import java.util.HashMap;


 /**
  * Custom subclass of <code>ObjectInputStream</code> that loads from the
@@ -37,6 +38,23 @@


/** + * List of primitive classes. + */ + private static final HashMap primitiveTypes = new HashMap(); + static { + primitiveTypes.put("boolean", boolean.class); + primitiveTypes.put("byte", byte.class); + primitiveTypes.put("char", char.class); + primitiveTypes.put("double", double.class); + primitiveTypes.put("float", float.class); + primitiveTypes.put("int", int.class); + primitiveTypes.put("long", long.class); + primitiveTypes.put("short", short.class); + primitiveTypes.put("void", void.class); + } + + + /** * The class loader we will use to resolve classes. */ private ClassLoader classLoader = null; @@ -70,7 +88,17 @@ */ public Class resolveClass(ObjectStreamClass classDesc) throws ClassNotFoundException, IOException { - return Class.forName(classDesc.getName(), false, classLoader); + try { + return Class.forName(classDesc.getName(), false, classLoader); + } catch (ClassNotFoundException e) { + // Trying again for the case of primitives + Class result = (Class) primitiveTypes.get(classDesc.getName()); + if (result != null) { + return result; + } else { + throw e; + } + } }

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to