tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeanfrancois Arcand <jfarc...@apache.org>
Subject Re: DO NOT REPLY [Bug 34090] - org.apache.catalina.util.CustomObjectInputStream causes problems
Date Tue, 22 Mar 2005 02:16:51 GMT


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


Mime
View raw message