src/solaris/classes/java/util/prefs/FileSystemPreferences.java

Print this page
rev 3186 : 6880112: Project Coin: Port JDK core library code to use diamond operator

*** 352,362 **** * is sync'ed by overwriting our prefsCache with the preference map last * written out to disk (by the other VM), and then replaying this change * log against that map. The resulting map is then written back * to the disk. */ ! final List<Change> changeLog = new ArrayList<Change>(); /** * Represents a change to a preference. */ private abstract class Change { --- 352,362 ---- * is sync'ed by overwriting our prefsCache with the preference map last * written out to disk (by the other VM), and then replaying this change * log against that map. The resulting map is then written back * to the disk. */ ! final List<Change> changeLog = new ArrayList<>(); /** * Represents a change to a preference. */ private abstract class Change {
*** 505,515 **** return null; } }); if (newNode) { // These 2 things guarantee node will get wrtten at next flush/sync ! prefsCache = new TreeMap<String, String>(); nodeCreate = new NodeCreate(); changeLog.add(nodeCreate); } } --- 505,515 ---- return null; } }); if (newNode) { // These 2 things guarantee node will get wrtten at next flush/sync ! prefsCache = new TreeMap<>(); nodeCreate = new NodeCreate(); changeLog.add(nodeCreate); } }
*** 548,558 **** try { loadCache(); } catch(Exception e) { // assert lastSyncTime == 0; ! prefsCache = new TreeMap<String, String>(); } } /** * Attempt to load prefsCache from the backing store. If the attempt --- 548,558 ---- try { loadCache(); } catch(Exception e) { // assert lastSyncTime == 0; ! prefsCache = new TreeMap<>(); } } /** * Attempt to load prefsCache from the backing store. If the attempt
*** 565,575 **** private void loadCache() throws BackingStoreException { try { AccessController.doPrivileged( new PrivilegedExceptionAction<Void>() { public Void run() throws BackingStoreException { ! Map<String, String> m = new TreeMap<String, String>(); long newLastSyncTime = 0; try { newLastSyncTime = prefsFile.lastModified(); FileInputStream fis = new FileInputStream(prefsFile); XmlSupport.importMap(fis, m); --- 565,575 ---- private void loadCache() throws BackingStoreException { try { AccessController.doPrivileged( new PrivilegedExceptionAction<Void>() { public Void run() throws BackingStoreException { ! Map<String, String> m = new TreeMap<>(); long newLastSyncTime = 0; try { newLastSyncTime = prefsFile.lastModified(); FileInputStream fis = new FileInputStream(prefsFile); XmlSupport.importMap(fis, m);
*** 579,589 **** getLogger().warning("Invalid preferences format in " + prefsFile.getPath()); prefsFile.renameTo( new File( prefsFile.getParentFile(), "IncorrectFormatPrefs.xml")); ! m = new TreeMap<String, String>(); } else if (e instanceof FileNotFoundException) { getLogger().warning("Prefs file removed in background " + prefsFile.getPath()); } else { throw new BackingStoreException(e); --- 579,589 ---- getLogger().warning("Invalid preferences format in " + prefsFile.getPath()); prefsFile.renameTo( new File( prefsFile.getParentFile(), "IncorrectFormatPrefs.xml")); ! m = new TreeMap<>(); } else if (e instanceof FileNotFoundException) { getLogger().warning("Prefs file removed in background " + prefsFile.getPath()); } else { throw new BackingStoreException(e);
*** 644,654 **** protected String[] childrenNamesSpi() { return AccessController.doPrivileged( new PrivilegedAction<String[]>() { public String[] run() { ! List<String> result = new ArrayList<String>(); File[] dirContents = dir.listFiles(); if (dirContents != null) { for (int i = 0; i < dirContents.length; i++) if (dirContents[i].isDirectory()) result.add(nodeName(dirContents[i].getName())); --- 644,654 ---- protected String[] childrenNamesSpi() { return AccessController.doPrivileged( new PrivilegedAction<String[]>() { public String[] run() { ! List<String> result = new ArrayList<>(); File[] dirContents = dir.listFiles(); if (dirContents != null) { for (int i = 0; i < dirContents.length; i++) if (dirContents[i].isDirectory()) result.add(nodeName(dirContents[i].getName()));
*** 792,802 **** lastSyncTime = lastModifiedTime; } } else if (lastSyncTime != 0 && !dir.exists()) { // This node was removed in the background. Playback any changes // against a virgin (empty) Map. ! prefsCache = new TreeMap<String, String>(); replayChanges(); } if (!changeLog.isEmpty()) { writeBackCache(); // Creates directory & file if necessary /* --- 792,802 ---- lastSyncTime = lastModifiedTime; } } else if (lastSyncTime != 0 && !dir.exists()) { // This node was removed in the background. Playback any changes // against a virgin (empty) Map. ! prefsCache = new TreeMap<>(); replayChanges(); } if (!changeLog.isEmpty()) { writeBackCache(); // Creates directory & file if necessary /*