/** * Save the settings to a file. * @throws IOException Save error */ public synchronized void save() throws IOException { if(BulkChange.contains(this)) return; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); File file = getFingerprintFile(md5sum); save(file); SaveableListener.fireOnChange(this, getConfigFile(file)); if(logger.isLoggable(Level.FINE)) logger.fine("Saving fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); }
/*package*/ static @CheckForNull Fingerprint load(@Nonnull File file) throws IOException { XmlFile configFile = getConfigFile(file); if(!configFile.exists()) return null;
getConfigFile(file).write(this);
/** * Save the settings to a file. */ public synchronized void save() throws IOException { if(BulkChange.contains(this)) return; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); File file = getFingerprintFile(md5sum); getConfigFile(file).write(this); SaveableListener.fireOnChange(this, getConfigFile(file)); if(logger.isLoggable(Level.FINE)) logger.fine("Saving fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); }
/** * Save the settings to a file. */ public synchronized void save() throws IOException { if(BulkChange.contains(this)) return; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); File file = getFingerprintFile(md5sum); getConfigFile(file).write(this); SaveableListener.fireOnChange(this, getConfigFile(file)); if(logger.isLoggable(Level.FINE)) logger.fine("Saving fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); }
/** * Save the settings to a file. */ public synchronized void save() throws IOException { if(BulkChange.contains(this)) return; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); File file = getFingerprintFile(md5sum); getConfigFile(file).write(this); SaveableListener.fireOnChange(this, getConfigFile(file)); if(logger.isLoggable(Level.FINE)) logger.fine("Saving fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); }
/** * Save the settings to a file. */ public synchronized void save() throws IOException { if (BulkChange.contains(this)) { return; } long start = 0; if (logger.isLoggable(Level.FINE)) { start = System.currentTimeMillis(); } File file = getFingerprintFile(md5sum); getConfigFile(file).write(this); SaveableListener.fireOnChange(this, getConfigFile(file)); if (logger.isLoggable(Level.FINE)) { logger.fine("Saving fingerprint " + file + " took " + (System.currentTimeMillis() - start) + "ms"); } }
/*package*/ static Fingerprint load(File file) throws IOException { XmlFile configFile = getConfigFile(file); if(!configFile.exists()) return null; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); try { Fingerprint f = (Fingerprint) configFile.read(); if(logger.isLoggable(Level.FINE)) logger.fine("Loading fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); return f; } catch (IOException e) { if(file.exists() && file.length()==0) { // Despite the use of AtomicFile, there are reports indicating that people often see // empty XML file, presumably either due to file system corruption (perhaps by sudden // power loss, etc.) or abnormal program termination. // generally we don't want to wipe out user data just because we can't load it, // but if the file size is 0, which is what's reported in HUDSON-2012, then it seems // like recovering it silently by deleting the file is not a bad idea. logger.log(Level.WARNING, "Size zero fingerprint. Disk corruption? "+configFile,e); file.delete(); return null; } logger.log(Level.WARNING, "Failed to load "+configFile,e); throw e; } }
/*package*/ static Fingerprint load(File file) throws IOException { XmlFile configFile = getConfigFile(file); if(!configFile.exists()) return null; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); try { Fingerprint f = (Fingerprint) configFile.read(); if(logger.isLoggable(Level.FINE)) logger.fine("Loading fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); return f; } catch (IOException e) { if(file.exists() && file.length()==0) { // Despite the use of AtomicFile, there are reports indicating that people often see // empty XML file, presumably either due to file system corruption (perhaps by sudden // power loss, etc.) or abnormal program termination. // generally we don't want to wipe out user data just because we can't load it, // but if the file size is 0, which is what's reported in HUDSON-2012, then it seems // like recovering it silently by deleting the file is not a bad idea. logger.log(Level.WARNING, "Size zero fingerprint. Disk corruption? "+configFile,e); file.delete(); return null; } logger.log(Level.WARNING, "Failed to load "+configFile,e); throw e; } }
/*package*/ static Fingerprint load(File file) throws IOException { XmlFile configFile = getConfigFile(file); if(!configFile.exists()) return null; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); try { Fingerprint f = (Fingerprint) configFile.read(); if(logger.isLoggable(Level.FINE)) logger.fine("Loading fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); return f; } catch (IOException e) { if(file.exists() && file.length()==0) { // Despite the use of AtomicFile, there are reports indicating that people often see // empty XML file, presumably either due to file system corruption (perhaps by sudden // power loss, etc.) or abnormal program termination. // generally we don't want to wipe out user data just because we can't load it, // but if the file size is 0, which is what's reported in HUDSON-2012, then it seems // like recovering it silently by deleting the file is not a bad idea. logger.log(Level.WARNING, "Size zero fingerprint. Disk corruption? "+configFile,e); file.delete(); return null; } logger.log(Level.WARNING, "Failed to load "+configFile,e); throw e; } }
/** * Save the settings to a file. * @throws IOException Save error */ public synchronized void save() throws IOException { if(BulkChange.contains(this)) return; long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); File file = getFingerprintFile(md5sum); save(file); SaveableListener.fireOnChange(this, getConfigFile(file)); if(logger.isLoggable(Level.FINE)) logger.fine("Saving fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms"); }
/*package*/ static Fingerprint load(File file) throws IOException { XmlFile configFile = getConfigFile(file); if (!configFile.exists()) { return null;
/*package*/ static @CheckForNull Fingerprint load(@Nonnull File file) throws IOException { XmlFile configFile = getConfigFile(file); if(!configFile.exists()) return null;
getConfigFile(file).write(this);