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

Entity replacement in wrong place when expansion coincides with buffer growth

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Version 2.6
    • Version 5.0.1
    • XmlObject
    • 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. TestEntityNearBufferGrowth.java
          25 kB
          Jesper Steen Møller
        2. patch.txt
          27 kB
          Jesper Steen Møller

        Activity

          People

            kiwiwings Andreas Beeker
            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