[jira] [Updated] (XMLBEANS-487) Entity replacement in wrong place when expansion coincides with buffer growth

2012-09-07 Thread JIRA

 [ 
https://issues.apache.org/jira/browse/XMLBEANS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesper Steen Møller updated XMLBEANS-487:
-

Attachment: patch.txt

I found the bug. When resizing the buffer, and the buffer is split (i.e. with 
the hole in the middle), and the 'i' position was in the newest part of the 
buffer (i.e. before the hole), the, i was adjusted incorrectly.

Patch containing a fix and a test case. I added some comments about the 
adjustments which were not immediately obvious (to me, anyway).

> Entity replacement in wrong place when expansion coincides with buffer growth
> -
>
> Key: XMLBEANS-487
> URL: https://issues.apache.org/jira/browse/XMLBEANS-487
> Project: XMLBeans
>  Issue Type: Bug
>  Components: XmlObject
>Affects Versions: Version 2.6
>Reporter: Jesper Steen Møller
> Attachments: patch.txt, TestEntityNearBufferGrowth.java
>
>
> When serializing an object to XML using newReader(), some of the entity 
> replacements for '&' appear in the wrong places, giving invalid XML.
> Example:
> Hall & Oates
> could be serialized as:
> Hall & Oates
> The bug depends on the sequence of the read()-calls, the size of the 
> requested buffer, and the content. We're using the newReader to feed a Xalan 
> transformation, and in some tens of millions different transformations, this 
> has happened just a few times -- but this time, we've isolated the problem, 
> which is attached as a stand-alone test case.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

-
To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org



[jira] [Updated] (XMLBEANS-487) Entity replacement in wrong place when expansion coincides with buffer growth

2012-09-06 Thread JIRA

 [ 
https://issues.apache.org/jira/browse/XMLBEANS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesper Steen Møller updated XMLBEANS-487:
-

Attachment: TestEntityNearBufferGrowth.java

This is a test case which triggers the error. The error is quite rare and 
depends on both the XML and the sequence of the reads.
The newReader() is read in two parts, first 28 characters (INITIAL_READ), then 
the rest. If the value of INITIAL_READ is changed to e.g. 2, or if the second 
read is smaller that apprx 4 k, then the error doesn't occur.

The bad substituition appears to happen when a call to replace (to deal with & 
-> &) has triggered allocation of a larger buffer.

> Entity replacement in wrong place when expansion coincides with buffer growth
> -
>
> Key: XMLBEANS-487
> URL: https://issues.apache.org/jira/browse/XMLBEANS-487
> Project: XMLBeans
>  Issue Type: Bug
>  Components: XmlObject
>Affects Versions: Version 2.6
>Reporter: Jesper Steen Møller
> Attachments: TestEntityNearBufferGrowth.java
>
>
> When serializing an object to XML using newReader(), some of the entity 
> replacements for '&' appear in the wrong places, giving invalid XML.
> Example:
> Hall & Oates
> could be serialized as:
> Hall & Oates
> The bug depends on the sequence of the read()-calls, the size of the 
> requested buffer, and the content. We're using the newReader to feed a Xalan 
> transformation, and in some tens of millions different transformations, this 
> has happened just a few times -- but this time, we've isolated the problem, 
> which is attached as a stand-alone test case.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

-
To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org