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

CharacterData::substringData incorrectly throw INDEX_SIZE_ERR

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 1.0
    • xml

      jdk 6.0.
      CharacterData::substringData incorrectly throw INDEX_SIZE_ERR.

      For example, the following code shouldn't throw DOMException.
      "
      Text text = document.createTextNode("tests");
      text.substringData(5, 1); --> should be valid. but in jdk 6.0, DOMException is thrown.
      "
      According the spec, DOMException is throw when offset is greater than the number of 16-bit units in data.
      In the above code, offset in substringData method is the same as number of 16-bit units in text node. Thus, no Exception should be thrown.


      String substringData(int offset,
                           int count)
                           throws DOMException
      "Throws:
          DOMException - INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.
      "

            joehw Joe Wang
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: