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

IIOMetadataNode.setAttributeNode: unexpected IIODOMException

    XMLWordPrintable

Details

    • beta2
    • generic
    • generic

    Description



      Name: dkR10031 Date: 05/15/2001


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

      "public Attr setAttributeNode(Attr newAttr) throws DOMException"

      However, the implementation (JDK 1.4.0beta, build b64) of the method
      throws IIODOMException: Node not an IIOAttr! when a legal Attr parameter
      is passed to the method. Note that the spec does not describe IIOAttr
      class.

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

      To reproduce the bug run the following test:

      ------------ test08.java ------------------------
      import javax.imageio.metadata.IIOMetadataNode;
      import org.w3c.dom.Attr;
      import org.w3c.dom.Element;

      public class test08 {

          public static void main(String argv[]) {

      IIOMetadataNode elem = new IIOMetadataNode("elem");
      MyAttrNode attrNode = new MyAttrNode("attr", "2001");

      elem.setAttributeNode(attrNode);
      attrNode.owner = elem;

      System.out.println("Passed");
          }
      }

      class MyAttrNode extends IIOMetadataNode implements Attr {
          public Element owner;
          private String name;
          private String value;


          public MyAttrNode(String name, String value) {
              this.name = name;
              this.value = value;
          }
          public String getName() {
              return name;
          }
          public Element getOwnerElement() {
              return owner;
          }
          public boolean getSpecified() {
              return false;
          }
          public String getValue() {
              return value;
          }
          public void setValue(String value) {
              this.value = value;
          }
      }
      ------------ 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 test08.java

      $ java test08
      Exception in thread "main" javax.imageio.metadata.IIODOMException: Node not an
      IIOAttr!
              at
      javax.imageio.metadata.IIOMetadataNode.setAttributeNode(IIOMetadataNode.java:721)
              at test08.main(test08.java:12)

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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: