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

java.util.jar.Attributes put() method not consistent with specification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.2
    • 1.2.0
    • tools
    • jar
    • 1.2.2
    • sparc
    • solaris_2.5.1, solaris_2.6


      gordon.jackson@east 1998-08-12

      java.util.jar.Attributes specifies the following:

          /**
           * Associates the specified value with the specified attribute name
           * (key) in this Map. If the Map previously contained a mapping for
           * the attribute name, the old value is replaced.
           *
           * @param name the attribute name
           * @param value the attribute value
           * @return the previous value of the attribute, or null if none
           * @exception ClassCastException if the name is not a Attributes.Name
           * or the value is not a String
           */
          public Object put(Object name, Object value) {
      return map.put(name, value);
          }

      The bug is that above method neither checks to ensure that the name/value
      are as they are specified to be - Attributes.Name/String - nor does it
      throw a ClassCastException if they are not.

      In this case, the method implementation is inconsistent with the javadoc generated API.

            zlisunw Zhenghua Li (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: