classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] FYI: Fix serialization of Class objects


From: Archie Cobbs
Subject: Re: [cp-patches] FYI: Fix serialization of Class objects
Date: Tue, 18 Jan 2005 17:34:03 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

CMark Wielaard wrote:
> @@ -733,7 +740,37 @@
>    protected Class resolveClass(ObjectStreamClass osc)
>      throws ClassNotFoundException, IOException
>    {
> -    return Class.forName(osc.getName(), true, currentLoader());
> +    try
> +      {
> +     return Class.forName(osc.getName(), true, currentLoader());
> +      }
> +    catch (ClassNotFoundException cnfe)
> +      {
> +     // Maybe it was an primitive class?
> +     String name = osc.getName();
> +     if (name.equals("void"))
> +       return Void.TYPE;
> +     if (name.equals("boolean"))
> +       return Boolean.TYPE;
> +     if (name.equals("byte"))
> +       return Byte.TYPE;
> +     if (name.equals("short"))
> +       return Short.TYPE;
> +     if (name.equals("char"))
> +       return Character.TYPE;
> +     if (name.equals("int"))
> +       return Integer.TYPE;
> +     if (name.equals("long"))
> +       return Long.TYPE;
> +     if (name.equals("float"))
> +       return Float.TYPE;
> +     if (name.equals("double"))
> +       return Double.TYPE;
> +     if (name.equals("void"))
> +       return Void.TYPE;
> +
> +     throw cnfe;
> +      }
>    }

I don't know much about this stuff, but the above code seems to
imply that something is not going to work if I have a class named
e.g., "int" or "long", which is otherwise perfectly valid. Is this
a bug in the serialization protocol spec or in our implementatin?

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


*
Confidentiality Notice: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message.
*





reply via email to

[Prev in Thread] Current Thread [Next in Thread]