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

Vipin Mv1 vipinmv1 at in.ibm.com
Mon Jul 13 13:43:06 UTC 2020


Hi Lance

Thanks for the detailed review. I will go ahead and look into the required documentation changes.
		
Thanks & Regards				 			
Vipin MV					 			
 										 							 			
 						

-----Lance Andersen <lance.andersen at oracle.com> wrote: -----
To: Vipin Mv1 <vipinmv1 at in.ibm.com>
From: Lance Andersen <lance.andersen at oracle.com>
Date: 07/10/2020 02:27AM
Cc: core-libs-dev at openjdk.java.net
Subject: [EXTERNAL] Re: RFR 6470126 java.util.jar.Attributes#containsKey fails with Strings

Hi Vipin,

Apologies for the delay.


After looking at the bug, which is over 14 years old, the SCCS history of Attributes.java, I am reluctant to suggest we move forward with your proposed change. 

 The  key for an Attributes map entry should be an Attributes.Name object (see Attributes::put). Unfortunately your proposed fix introduces a behavioral change and could possibly break existing applications.  


A  behavioral change to existing  public methods would require approval via a CSR and would require more compressive testing.   I took a quick scan of the JCK tests and of the JTReg tests and I believe your change would cause some of the existing tests to fail.

>From my perspective, it would be better to clarify the Attributes javadoc to make it clearer that an Attributes.Name object is required   (which I believe has not changed since the Attributes class was added to Java SE).



Best
Lance



On Jul 1, 2020, at 12:42 AM, Vipin Mv1 <vipinmv1 at in.ibm.com> wrote:
Hi,

A gentle reminder to please review this patch.

Thanks & Regards
 Vipin MV                                                                 
                                                                                                          
                                                 
                                                 

-----Vipin Mv1/India/IBM wrote: -----
To: core-libs-dev at openjdk.java.net
From: Vipin Mv1/India/IBM
Date: 06/15/2020 11:52AM
Subject: Re: RFR 6470126 java.util.jar.Attributes#containsKey fails with Strings

Hi,

I have addressed the review comments and the patch has been uploaded here:

http://cr.openjdk.java.net/~vtewari/6470126/webrev/index.html

Please let me know your suggestions.

Thanks & Regards                                                                 
Vipin MV                                                                 
                                                                                                          

-----Vipin Mv1/India/IBM wrote: -----
To: core-libs-dev at openjdk.java.net
From: Vipin Mv1/India/IBM
Date: 05/11/2020 05:00PM
Subject: RFR 6470126 java.util.jar.Attributes#containsKey fails with Strings

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


 

Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com


  
 



More information about the core-libs-dev mailing list