From 375ee443819914c3c81383ccd55c4afb2ce467db Mon Sep 17 00:00:00 2001 From: Nils Schwabe Date: Wed, 23 Jul 2014 15:10:09 +0200 Subject: [CRCFile] Fix that crc file is always recalculating if it is valid --- .../java/org/openslx/imagemaster/crcchecker/CRCFile.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/main/java/org/openslx/imagemaster') diff --git a/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java b/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java index 807aac1..1fa7453 100644 --- a/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java +++ b/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java @@ -18,6 +18,7 @@ public class CRCFile { private File file = null; private List crcSums = null; + private Boolean valid = null; /** * Loads a crcFile from file @@ -93,13 +94,16 @@ public class CRCFile */ public boolean isValid() throws IOException { - if ( file == null ) { - return sumsAreValid( this.crcSums ); - } else { - if ( crcSums == null ) - loadSums(); - return sumsAreValid( this.crcSums ); + if ( valid == null ) { + if ( file == null ) { + valid = sumsAreValid( this.crcSums ); + } else { + if ( crcSums == null ) + loadSums(); + valid = sumsAreValid( this.crcSums ); + } } + return valid; } /** -- cgit v1.2.3-55-g7522