Re: [PATCH] 8165751: NPE in Signature with java.security.debug=provider

2016-12-13 Thread Sean Mullan
On 12/13/16 1:43 PM, Adam Petcher wrote: Here is the latest diff that simply adds a null check to the existing code. When the provider is null, the debug output will be "...algorithm from: (no provider)". The test code is the same as the last diff. Looks good to me. --Sean diff --git a/src

Re: [PATCH] 8165751: NPE in Signature with java.security.debug=provider

2016-12-13 Thread Adam Petcher
Here is the latest diff that simply adds a null check to the existing code. When the provider is null, the debug output will be "...algorithm from: (no provider)". The test code is the same as the last diff. diff --git a/src/java.base/share/classes/java/security/Signature.java b/src/java.base

Re: [PATCH] 8165751: NPE in Signature with java.security.debug=provider

2016-12-13 Thread Sean Mullan
On 12/13/16 11:30 AM, Adam Petcher wrote: Thanks for the review. After thinking about this some more, I don't like the idea of using Optional for a member variable due to the limitations of this class and the lack of support for this usage of it. I'll send out a new diff that uses a standard nul

Re: [PATCH] 8165751: NPE in Signature with java.security.debug=provider

2016-12-13 Thread Adam Petcher
Thanks for the review. After thinking about this some more, I don't like the idea of using Optional for a member variable due to the limitations of this class and the lack of support for this usage of it. I'll send out a new diff that uses a standard null check. See below for other comments.

Re: [PATCH] 8165751: NPE in Signature with java.security.debug=provider

2016-12-12 Thread Wang Weijun
Hi Adam The only behavior change is with the debug output, right? Is this a new pattern that internal optional fields should be defined as an Optional? And, when there is no provider the string form "from: " looks strange, I would rather make it "from nowhere". I would also move the space befo

Re: [PATCH] 8165751: NPE in Signature with java.security.debug=provider

2016-12-12 Thread Adam Petcher
Okay. I changed getProvider() to return this.provider.orElse(null), which will allow this method to return null. For consistency, I allow all other providers (in Instance and Service) to be null using Optional.ofNullable(). Hopefully, I found and fixed all the whitespace issues, too. Here is th

Re: [PATCH] 8165751: NPE in Signature with java.security.debug=provider

2016-12-12 Thread Sean Mullan
On 12/8/16 11:17 AM, Adam Petcher wrote: Subclasses of Signature may have a null provider. In this case, the debug logging code will throw a NPE when attempting to call getName() on it. Since this member may be null, I would like to change its type to Optional to ensure that code checks whether