RFR 6470126 java.util.jar.Attributes#containsKey fails with Strings

Vipin Mv1 vipinmv1 at in.ibm.com
Mon May 11 11:30:48 UTC 2020


Hi,

Please review the fix for the following issue.

https://bugs.openjdk.java.net/browse/JDK-6470126


diff -r 53568400fec3 src/java.base/share/classes/java/util/jar/Attributes.java
--- a/src/java.base/share/classes/java/util/jar/Attributes.java Thu Mar 26 15:26:51 2020 +0000
+++ b/src/java.base/share/classes/java/util/jar/Attributes.java Mon May 11 15:00:01 2020 +0530
@@ -205,7 +205,10 @@
      * @return true if this Map contains the specified attribute name
      */
     public boolean containsKey(Object name) {
-        return map.containsKey(name);
+        if(String.class.isInstance(name))
+            return map.containsKey(Name.of((String)name));
+        else
+            return map.containsKey(name);
     }
 
     /**

Thanks & Regards
Vipin Menon



More information about the core-libs-dev mailing list