diff options
author | Nils Schwabe | 2014-07-23 15:10:09 +0200 |
---|---|---|
committer | Nils Schwabe | 2014-07-23 15:10:09 +0200 |
commit | 375ee443819914c3c81383ccd55c4afb2ce467db (patch) | |
tree | 8b93c39d42fb36e5a15cfdd1e3f441221db903cb /src/main/java/org/openslx/imagemaster/crcchecker | |
parent | [CRCFile] Fix bug where sums are checked (diff) | |
download | master-sync-shared-375ee443819914c3c81383ccd55c4afb2ce467db.tar.gz master-sync-shared-375ee443819914c3c81383ccd55c4afb2ce467db.tar.xz master-sync-shared-375ee443819914c3c81383ccd55c4afb2ce467db.zip |
[CRCFile] Fix that crc file is always recalculating if it is valid
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/crcchecker')
-rw-r--r-- | src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java | 16 |
1 files changed, 10 insertions, 6 deletions
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<Integer> 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; } /** |