<i18n dev> RFR: 8345325: SM cleanup of GetPropertyAction in java.base [v4]

Eirik Bjørsnøs eirbjo at openjdk.org
Tue Dec 3 14:56:44 UTC 2024


On Tue, 3 Dec 2024 14:45:22 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Remove sun/security/action/GetPropertyAction.java and all uses.
>> 
>> Dependent on PR#22418
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove an obsolete comment related to long ago removed useNewThrowable

src/java.base/share/classes/java/lang/StackStreamFactory.java line 84:

> 82:     @Native private static final int FILL_LIVE_STACK_FRAMES    = 0x100;
> 83: 
> 84:     static final boolean isDebug =

This property should probably be compared with true in a case insensitive manner. It may be better to use `Boolean::getBoolean` instead.

Justification:

JDK-8155775 (commit e8cd76568da1b32b26491e80f498cff1409336b7) removed the `getProperty` method which was previously used to read this property:


private static boolean getProperty(String key, boolean value) {
        String s = GetPropertyAction.getProperty(key);
        if (s != null) {
            return Boolean.parseBoolean(s);
        }
        return value;
    }


`isDebug` was initialized with a false default if the system property was null:


final static boolean isDebug = getProperty("stackwalk.debug", false);
``` 

I doubt the change in case handling was intentional, @cl4es may confirm.

Based on the above, I think we should consider using Boolean.getBoolean here, as that is case-insensitive and returns false for null:

Suggestion:

    static final boolean isDebug = Boolean.getBoolean("stackwalk.debug");

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22497#discussion_r1867880288


More information about the i18n-dev mailing list