mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maarten Bosteels" <mbosteels....@gmail.com>
Subject Re: use isPrimitive() instead of comparing the string to a list of primitives
Date Thu, 07 Feb 2008 09:25:24 GMT
Hi Stivo,

Thanks for the patch !
I will have a look at it.

Maarten

On Feb 7, 2008 9:56 AM, Stivo <spykiller@gmx.net> wrote:

>
> I figured out how to make a patch so here goes.
> I ran the maven test with it, and it ran fine.
>
> Index: C:/Users/Stivo/workspacenew/mina
> trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java
> ===================================================================
> --- C:/Users/Stivo/workspacenew/mina
> trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java   (revision
> 619305)
> +++ C:/Users/Stivo/workspacenew/mina
> trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java   (working
> copy)
> @@ -306,20 +306,6 @@
>         return newCapacity;
>     }
>
> -    protected static final Set<String> primitiveTypeNames = new
> HashSet<String>();
> -
> -    static {
> -        primitiveTypeNames.add("void");
> -        primitiveTypeNames.add("boolean");
> -        primitiveTypeNames.add("byte");
> -        primitiveTypeNames.add("char");
> -        primitiveTypeNames.add("short");
> -        primitiveTypeNames.add("int");
> -        primitiveTypeNames.add("long");
> -        primitiveTypeNames.add("float");
> -        primitiveTypeNames.add("double");
> -    }
> -
>     /**
>      * Creates a new instance.  This is an empty constructor.
>      */
> Index: C:/Users/Stivo/workspacenew/mina
> trunk/core/src/main/java/org/apache/mina/common/AbstractIoBuffer.java
> ===================================================================
> --- C:/Users/Stivo/workspacenew/mina
> trunk/core/src/main/java/org/apache/mina/common/AbstractIoBuffer.java
> (revision 619305)
> +++ C:/Users/Stivo/workspacenew/mina
> trunk/core/src/main/java/org/apache/mina/common/AbstractIoBuffer.java
> (working copy)
> @@ -1608,8 +1608,7 @@
>                 @Override
>                 protected void writeClassDescriptor(ObjectStreamClass
> desc)
>                         throws IOException {
> -                    String className = desc.getName();
> -                    if (primitiveTypeNames.contains(className)) {
> +                       if (desc.forClass().isPrimitive()) {
>                         write(0);
>                         super.writeClassDescriptor(desc);
>                     } else {
>
> --
> View this message in context:
> http://www.nabble.com/use-isPrimitive%28%29-instead-of-comparing-the-string-to-a-list-of-primitives-tp15267788s16868p15329675.html
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message