On Fri, 13 Sep 2024 06:56:20 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> It would look like this:
>> 
>> 
>>     static int powerOfPropertyOr(String name, int defaultPower) {
>>         final String property = 
>> GetPropertyAction.privilegedGetProperty(PROPERTY_PATH + name, 
>> Integer.toString(defaultPower));
>>         try {
>>             return 1 << Math.clamp(Integer.parseInt(property), 0, 
>> Integer.SIZE - 2);
>>         } catch (NumberFormatException _) {
>>             // ignore
>>         }
>>         return defaultPower;
>>     }
>>     ```
>
> https://bugs.openjdk.org/browse/JDK-8340089

I think there's a oversight here. What we meant was a separate GetIntegerAction 
class instead of GetPropertyAction. The code would then look like:


final int power = 
sun.security.action.GetIntegerAction.privilegedGetProperty(PROPERTY_PATH + 
name, defaultPower);
return 1 << Math.clamp(power, 0, Integer.SIZE - 2);

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

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

Reply via email to