[ 
https://issues.apache.org/activemq/browse/CAMEL-1309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=49098#action_49098
 ] 

Guillaume Nodet commented on CAMEL-1309:
----------------------------------------

Yes, the problem is that there are possible null fields that throw exceptions 
when serialized.
The problem is that writeUTF barfs when given a null string.
Here is a patch I was planning to commit asap:

{code}
    public void writeExternal(ObjectOutput out) throws IOException {
        int b = ((text != null ? 0x01 : 0x00) + (encoding != null ? 0x02 : 0x00)
                            + (getPublicId() != null ? 0x04 : 0x00) + 
(getSystemId() != null ? 0x08 : 0x00));
        out.writeByte(b);
        if ((b & 0x01) != 0) {
            out.writeUTF(text);
        }
        if ((b & 0x02) != 0) {
            out.writeUTF(encoding);
        }
        if ((b & 0x04) != 0) {
            out.writeUTF(getPublicId());
        }
        if ((b & 0x08) != 0) {
            out.writeUTF(getSystemId());
        }
    }

    public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
        int b = in.readByte();
        if ((b & 0x01) != 0) {
            text = in.readUTF();
        }
        if ((b & 0x02) != 0) {
            encoding = in.readUTF();
        }
        if ((b & 0x04) != 0) {
            setPublicId(in.readUTF());
        }
        if ((b & 0x08) != 0) {
            setSystemId(in.readUTF());
        }
    }
{code}

> StringSource is not serializable
> --------------------------------
>
>                 Key: CAMEL-1309
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1309
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Guillaume Nodet
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to