Re: [mule-scm] [mule] [15876] branches/mule-2.2.x/core/src/test/resources: MULE-4567/EE-1705 MuleSession converts all stored property objects to java.lang.String

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [mule-scm] [mule] [15876] branches/mule-2.2.x/core/src/test/resources: MULE-4567/EE-1705 MuleSession converts all stored property objects to java.lang.String

by Dirk Olmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> --- branches/mule-2.2.x/core/src/main/java/org/mule/util/IOUtils.java 2009-10-26 14:16:23 UTC (rev 15875)
> +++ branches/mule-2.2.x/core/src/main/java/org/mule/util/IOUtils.java 2009-10-26 20:01:01 UTC (rev 15876)
> @@ -12,9 +12,16 @@
[...]

> +    public static byte[] serialize(Serializable obj) throws IOException
> +    {
> +        ByteArrayOutputStream stream = new ByteArrayOutputStream();
> +        ObjectOutput serialStream = new ObjectOutputStream(stream);
> +        serialStream.writeObject(obj);
> +        return stream.toByteArray();
> +    }
> +
> +    public static Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
> +    {
> +        InputStream stream = new ByteArrayInputStream(bytes);
> +        ObjectInput serialStream = new ObjectInputStream(stream);
> +        return serialStream.readObject();
> +    }
>  }

Travis, any reason not to use SerializationUtils which has exactly this
code (plus better exception handling)?

-dirk

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email