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

setAttribute does not change the value of an existing attribute

    Details

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

      Description



      Name: dkR10031 Date: 05/11/2001


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

      "If an attribute with that name is already present in
       the element, its value is changed to be that of the value parameter."

      However, the implementation (JDK 1.4.0beta, build b64) of the method
      seems to not replace the value of an existing attribute with the new
      value.

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

      To reproduce the bug run the following test:

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

      class test06 {

          public static void main(String argv[]) {
              String attr = "attr";
              String value = "2001";
              String actValue;
          
              IIOMetadataNode parent = new IIOMetadataNode("parent");
              parent.setAttribute(attr, "string");
              parent.setAttribute(attr, value);
              
              actValue = parent.getAttribute(attr);
              if (! actValue.equals(value))
                  System.out.println("Failed: invalid value: " + actValue);
              else
                  System.out.println("Passed");
          }
      }
      ------------ 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 test06.java

      $ java test06
      Failed: invalid value: string

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

        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: