DO NOT REPLY [Bug 34090] - org.apache.catalina.util.CustomObjectInputStream causes problems

2005-03-22 Thread bugzilla
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


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Resolution||WONTFIX
 Status|NEW |RESOLVED




--- Additional Comments From [EMAIL PROTECTED]  2005-03-22 11:05 ---
Unfortunately, I think this will not going to be fixed for a variety of reasons.
Calling the superclass, which seems the only acceptable solution, might cause
random problems (although feel free to test it; if you manage to convince me
that it is safe because you tested it extensively, then I might commit the 
change).

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

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



Re: DO NOT REPLY [Bug 34090] - org.apache.catalina.util.CustomObjectInputStream causes problems

2005-03-22 Thread Remy Maucherat
Jeanfrancois Arcand wrote:
Hi,
here is the answer I got from management:
 Hi Remy -  This is Jim.  We (Sun) can't relicense use of copywritten 
Sun code from the JDK outside of the JDK itself without extensive use of 
lawyers, and the Apache board.  So, it would be better to find another 
solution.  This isn't significantly different than JBoss' position that 
Apache can't use JBoss code, so I'm sure it's not too big a suprise.  If 
I'm misunderstanding what's been requested, please let me know.
Ok, thanks. Then unserialization of sessions may be slightly broken. Of 
course, it really does not matter ;)

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


Re: DO NOT REPLY [Bug 34090] - org.apache.catalina.util.CustomObjectInputStream causes problems

2005-03-21 Thread Remy Maucherat
[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 -	1.4
+++ CustomObjectInputStream.java	21 Mar 2005 16:47:25 -
@@ -21,6 +21,7 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectStreamClass;
 import java.lang.reflect.Proxy;
+import java.util.HashMap;

 /**
  * Custom subclass of codeObjectInputStream/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]


DO NOT REPLY [Bug 34090] - org.apache.catalina.util.CustomObjectInputStream causes problems

2005-03-21 Thread bugzilla
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 21:16 ---
(In reply to comment #1)
 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.

After a lot of investigation, I've found the underlying problem. Catalina's
CustomObjectInputStream seems to be unable to deserialize the Class-Objects of
the build-in types like Integer.TYPE or Long.TYPE. Other Class-Objects cause no
problems. After eliminanting this Class-Object from our code, the session is
restored successfully on Tomcat startup. 
I would classify this as a bug, because the Class-Objects of the build-in types
should be serializable. The standard ObjectInputStream has no problem with these
Class-Objects.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

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



Re: DO NOT REPLY [Bug 34090] - org.apache.catalina.util.CustomObjectInputStream causes problems

2005-03-21 Thread Jeanfrancois Arcand

Remy Maucherat wrote:
[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.
Hi,
here is the answer I got from management:
 Hi Remy -  This is Jim.  We (Sun) can't relicense use of copywritten 
Sun code from the JDK outside of the JDK itself without extensive use of 
lawyers, and the Apache board.  So, it would be better to find another 
solution.  This isn't significantly different than JBoss' position that 
Apache can't use JBoss code, so I'm sure it's not too big a suprise.  If 
I'm misunderstanding what's been requested, please let me know.

-- Jeanfrancois


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.java10 Mar 2005 23:54:45 -1.4
+++ CustomObjectInputStream.java21 Mar 2005 16:47:25 -
@@ -21,6 +21,7 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectStreamClass;
 import java.lang.reflect.Proxy;
+import java.util.HashMap;
 /**
  * Custom subclass of codeObjectInputStream/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]