Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-487

Entity replacement in wrong place when expansion coincides with buffer growth

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Version 2.6
    • Fix Version/s: Version 5.0.1
    • Component/s: XmlObject
    • Labels:
      None

      Description

      When serializing an object to XML using newReader(), some of the entity replacements for '&' appear in the wrong places, giving invalid XML.

      Example:
      <a q='aaaaaaaaaaaaaaaaa'><t>Hall & Oates</t></a>
      could be serialized as:
      <a q='aaaaaaaa&aaaaaaaa'><t>Hall & Oates</t></a>

      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.

        Attachments

        1. patch.txt
          27 kB
          Jesper Steen Møller
        2. TestEntityNearBufferGrowth.java
          25 kB
          Jesper Steen Møller

          Activity

            People

            • Assignee:
              kiwiwings Andreas Beeker
              Reporter:
              jespersm Jesper Steen Møller
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m