diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-12 10:12:17 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-12 10:12:17 +0200 |
commit | c4ede06f58b029c997931ecd9c103edf204d4089 (patch) | |
tree | 146c2760794ec93c4c70d75d424c8c71563c1882 /pdf-over-signator/src/main/java/at/asit | |
parent | 96b8ab5b9e6c15e7165e23c8c893056db944ee71 (diff) | |
download | pdf-over-c4ede06f58b029c997931ecd9c103edf204d4089.tar.gz pdf-over-c4ede06f58b029c997931ecd9c103edf204d4089.tar.bz2 pdf-over-c4ede06f58b029c997931ecd9c103edf204d4089.zip |
fix an error log when first selecting a custom emblem after factory reset
Diffstat (limited to 'pdf-over-signator/src/main/java/at/asit')
-rw-r--r-- | pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java index b3ac5527..270d21c4 100644 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java +++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java @@ -132,13 +132,16 @@ public class Emblem { Properties emblemProps = new Properties(); // compare cache, try to load if match try { - InputStream in = new FileInputStream(new File(CACHE_DIR, CACHE_PROPS_FILENAME)); - emblemProps.load(in); - if (emblemImg.equals(emblemProps.getProperty(PROPKEY_ORIG_PATH))) { - emblemHsh = getFileHash(emblemImg); - if (emblemHsh.equals(emblemProps.getProperty(PROPKEY_ORIG_DIGEST))) { - log.debug("Emblem cache hit: " + cachedEmblemFileName); - return cachedEmblemFileName; + File cacheProps = new File(CACHE_DIR, CACHE_PROPS_FILENAME); + if (cacheProps.exists()) { + InputStream in = new FileInputStream(cacheProps); + emblemProps.load(in); + if (emblemImg.equals(emblemProps.getProperty(PROPKEY_ORIG_PATH))) { + emblemHsh = getFileHash(emblemImg); + if (emblemHsh.equals(emblemProps.getProperty(PROPKEY_ORIG_DIGEST))) { + log.debug("Emblem cache hit: " + cachedEmblemFileName); + return cachedEmblemFileName; + } } } log.debug("Emblem cache miss"); |