On Fri, 13 Sep 2024 06:49:31 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/foreign/SegmentBulkOperations.java 
>> line 313:
>> 
>>> 311:     // The returned value is in the interval [0, 2^30]
>>> 312:     static int powerOfPropertyOr(String name, int defaultPower) {
>>> 313:         final String property = 
>>> GetPropertyAction.privilegedGetProperty(PROPERTY_PATH + name);
>> 
>> Hello Per, 
>> `sun.security.action.GetIntegerAction.privilegedGetProperty(PROPERTY_PATH + 
>> name, defaultPower)` could avoid the null checks and the try blocks here.
>
> Yes, the 2-arg GetIntegerAction.privilegedGetProperty would be better here, 
> and it would retain the existing behavior for when the property value can't 
> be parsed as a number.

I think we need the try block anyhow as we have to deal with a String. But 
might be slightly better. We could revisit this later.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20983#discussion_r1758277278

Reply via email to