Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5092581

Text.getWholeText() does not work correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 5.0
    • xml
    • b56
    • sparc
    • solaris_9

      Name: rmT116609 Date: 08/26/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b60)
      Java HotSpot(TM) Server VM (build 1.5.0-beta3-b60, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      SunOS pegasus 5.9 Generic_117171-02 sun4u sparc SUNW,Sun-Fire-280R Solaris


      A DESCRIPTION OF THE PROBLEM :
      The implementation of Text.getWholeText() by class com.sun.org.apache.xerces.internal.dom.TextImpl does not work correctly.
      It only serches for following sibling text and not preceding sybling text.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached test case

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      foobar
      foobar
      foobar

      ACTUAL -
      foobar
      foobar
      bar


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import org.w3c.dom.*;
      import javax.xml.parsers.*;

      public class DOM3Test {
          public static void main(String[] args) throws Exception {
              Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
              Element element = doc.createElement("element");
              Text foo = doc.createTextNode("foo");
              Text bar = doc.createTextNode("bar");
              
              element.appendChild(foo);
              element.appendChild(bar);
              
              System.out.println(element.getTextContent());
              System.out.println(foo.getWholeText());
              System.out.println(bar.getWholeText());
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Extends the implementation of TextImpl and CDATASectionImpl and implement the getWholeText method correctly.
      (Incident Review ID: 300935)
      ======================================================================
      ###@###.### 11/2/04 21:52 GMT

            sreddysunw Sunitha Reddy (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: