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 <vipin...@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@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@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
> 

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> 
<http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| 
Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
lance.ander...@oracle.com <mailto:lance.ander...@oracle.com>



Reply via email to