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

setAttribute fails to throw DOMException

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: dkR10031 Date: 05/14/2001


      Specification of the method
      javax.imageio.metadata.IIOMetadataNode.setAttribute says:

      "Throws:
               DOMException - INVALID_CHARACTER_ERR: Raised if the
               specified name contains an illegal character."

      And XML specification defines the legal characters:

      [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | /* any Unicode character, excluding
                   [#xE000-#xFFFD] | [#x10000-#x10FFFF] the surrogate blocks, FFFE, and
                                                            FFFF. */


      However, the implementation (JDK 1.4.0beta, build b64) of the method
      does not throw DOMException when given name contains illegal character
      \uFFFE.

      This bug affects new JCK test:
      api/javax_imageio/metadata/IIOMetadataNode/index.html#setAttribute

      To reproduce the bug run the following test:

      ------------ test07.java ------------------------
      import javax.imageio.metadata.IIOMetadataNode;

      class test07 {

          public static void main(String argv[]) {

              IIOMetadataNode parent = new IIOMetadataNode("parent");

              try {
                  parent.setAttribute("attr\uFFFE", "2001");
              } catch(org.w3c.dom.DOMException e) {
                  if (e.code != org.w3c.dom.DOMException.INVALID_CHARACTER_ERR) {
                      System.out.println("Failed: invalid exception code: " + e.code);
                  } else {
                      System.out.println("Passed");
                  }
                  return;
              }
              System.out.println("Failed: failed to throw DOMException");
          }
      }
      ------------ Logs -----------------------------
      $ java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b64)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b64, mixed mode)

      $ javac test07.java

      $ java test07
      Failed: failed to throw DOMException

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              dricesunw Daniel Rice (Inactive)
              Reporter:
              dimasunw Dima Dima (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: