RFR: 8344337: SecurityManager cleanup in java.prefs module [v5]

Andrey Turbanov aturbanov at openjdk.org
Thu Nov 21 06:53:26 UTC 2024


On Wed, 20 Nov 2024 22:43:44 GMT, Brent Christian <bchristi at openjdk.org> wrote:

>> Remove usages of SecurityManager, doPrivildged, and AccessController from the java.prefs module.
>
> Brent Christian has updated the pull request incrementally with one additional commit since the last revision:
> 
>   indentation fixes

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 133:

> 131:         isUserRootWritable = userRootDir.canWrite();
> 132:         String USER_NAME = System.getProperty("user.name");
> 133:         userLockFile = new File (userRootDir,".user.lock." + USER_NAME);

Suggestion:

        userLockFile = new File(userRootDir, ".user.lock." + USER_NAME);

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 177:

> 175:     private static void setupSystemRoot() {
> 176:         String systemPrefsDirName =
> 177:           System.getProperty("java.util.prefs.systemRoot","/etc/.java");

Suggestion:

          System.getProperty("java.util.prefs.systemRoot", "/etc/.java");

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 207:

> 205:         systemLockFile = new File(systemRootDir, ".system.lock");
> 206:         systemRootModFile =
> 207:                        new File (systemRootDir,".systemRootModFile");

Suggestion:

                       new File(systemRootDir, ".systemRootModFile");

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 577:

> 575:                 XmlSupport.importMap(fis, m);
> 576:             }
> 577:         } catch(Exception e) {

Suggestion:

        } catch (Exception e) {

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 580:

> 578:             if (e instanceof InvalidPreferencesFormatException) {
> 579:                 getLogger().warning("Invalid preferences format in "
> 580:                                             +  prefsFile.getPath());

Suggestion:

                                            + prefsFile.getPath());

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 617:

> 615:                 throw new BackingStoreException("Can't rename " +
> 616:                 tmpFile + " to " + prefsFile);
> 617:         } catch(BackingStoreException e) {

Suggestion:

        } catch (BackingStoreException e) {

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 619:

> 617:         } catch(BackingStoreException e) {
> 618:             throw e;
> 619:         } catch(Exception e) {

Suggestion:

        } catch (Exception e) {

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1851455289
PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1851455506
PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1851455757
PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1851455947
PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1851456103
PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1851456204
PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1851456285


More information about the core-libs-dev mailing list