You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2005/03/21 17:40:41 UTC

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

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 remm@apache.org  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.

-- 
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


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

Posted by Remy Maucherat <re...@apache.org>.
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


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

Posted by Jeanfrancois Arcand <jf...@apache.org>.

Remy Maucherat wrote:
> bugzilla@apache.org 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 remm@apache.org  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.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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


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

Posted by Remy Maucherat <re...@apache.org>.
bugzilla@apache.org 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 remm@apache.org  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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org