ode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Kearns (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ODE-349) OAssign$Literal serialization breaks for large literals
Date Tue, 29 Jul 2008 02:44:31 GMT

    [ https://issues.apache.org/jira/browse/ODE-349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617663#action_12617663
] 

Dan Kearns commented on ODE-349:
--------------------------------

Existing instances would not deserialize. read/writeUTF begin with an unsigned short. I don't
see any obvious way to put a detector switch in. Writing multiple 64k strings with a prepended
flag for the count on the initial string might work, but seems like a nasty hack.

> OAssign$Literal serialization breaks for large literals
> -------------------------------------------------------
>
>                 Key: ODE-349
>                 URL: https://issues.apache.org/jira/browse/ODE-349
>             Project: ODE
>          Issue Type: Bug
>          Components: BPEL Compilation/Parsing
>            Reporter: Dan Kearns
>
> writeUTF has a 64k limit on string size. Here's a fix against an older branch, but it
should work against trunk as well.
> dan@mtop :-)svn diff src/main/java/org/apache/ode/bpel/o/OAssign.java 
> Index: src/main/java/org/apache/ode/bpel/o/OAssign.java
> ===================================================================
> --- src/main/java/org/apache/ode/bpel/o/OAssign.java    (revision 429)
> +++ src/main/java/org/apache/ode/bpel/o/OAssign.java    (working copy)
> @@ -82,13 +82,21 @@
>          private void writeObject(java.io.ObjectOutputStream out)
>                  throws IOException
>          {
> -            out.writeUTF(DOMUtils.domToString(xmlLiteral));
> +         String x = DOMUtils.domToString(xmlLiteral);
> +         int len = x.length();
> +         out.writeInt(len);
> +         out.writeChars(x);
>          }
>  
>          private void readObject(java.io.ObjectInputStream in)
>                  throws IOException
>          {
> -            String domStr = in.readUTF();
> +           int len = in.readInt();
> +           StringBuffer sb = new StringBuffer();
> +           for(int i=0;i<len;++i) {
> +              sb.append(in.readChar());
> +           }
> +           String domStr = sb.toString();
>              try {
>                  xmlLiteral = DOMUtils.stringToDOM(domStr).getOwnerDocument();
>              } catch (Exception ex) {

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


Mime
View raw message