From f2628d686bc18f84fc740741634b03908aa28d4f Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Tue, 25 Oct 2016 17:13:56 +0200 Subject: Check emblem hash for placeholder cache --- .../at/asit/pdfover/signator/CachedFileNameEmblem.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'pdf-over-signator/src/main/java/at/asit') diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java index dc54d84a..fe08abb6 100644 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java +++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java @@ -93,7 +93,7 @@ public class CachedFileNameEmblem implements Emblem { return cachedEmblemFileName; //$NON-NLS-1$ } } - log.debug("Emblem cache miss"); + log.debug("Emblem cache miss"); //$NON-NLS-1$ } catch (Exception e) { log.warn("Can't load emblem cache", e); //$NON-NLS-1$ } @@ -147,4 +147,19 @@ public class CachedFileNameEmblem implements Emblem { public String getOriginalFileName() { return this.fileName; } + + /** + * Return the original filename + * @return the original filename + */ + public String getOriginalFileHash() { + if (this.fileName == null || !(new File(this.fileName).exists())) + return ""; //$NON-NLS-1$ + try { + return getFileHash(this.fileName); + } catch (IOException e) { + log.debug("Error getting file hash", e); + return ""; //$NON-NLS-1$ + } + } } -- cgit v1.2.3