summaryrefslogtreecommitdiff
path: root/pdf-over-signator
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-08 13:32:40 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-08 13:32:40 +0200
commitb491949e4571eac586a9f51793f311b24e18c689 (patch)
tree4f6a29bcf8c56f9fd78043581cdbff630064dc98 /pdf-over-signator
parent3679f37f129b16daadb490d6987fdd038b096bfc (diff)
downloadpdf-over-b491949e4571eac586a9f51793f311b24e18c689.tar.gz
pdf-over-b491949e4571eac586a9f51793f311b24e18c689.tar.bz2
pdf-over-b491949e4571eac586a9f51793f311b24e18c689.zip
cache emblem file hash
Diffstat (limited to 'pdf-over-signator')
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java18
1 files changed, 11 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 26f05f08..b3ac5527 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
@@ -58,6 +58,7 @@ public class Emblem {
private static final int MAX_EMBLEM_HEIGHT = 600;
private String originalFileName = null;
+ private String originalFileHash = null;
private Image image = null; /* image data, if we have it */
private void lazyLoadImage() {
@@ -181,13 +182,16 @@ public class Emblem {
* @return the original filename
*/
public String getOriginalFileHash() {
- if (this.originalFileName == null || !(new File(this.originalFileName).exists()))
- return "";
- try {
- return getFileHash(this.originalFileName);
- } catch (IOException e) {
- log.debug("Error getting file hash", e);
- return "";
+ if (this.originalFileHash == null) {
+ if (this.originalFileName == null || !(new File(this.originalFileName).exists())) {
+ this.originalFileHash = "";
+ } else try {
+ this.originalFileHash = getFileHash(this.originalFileName);
+ } catch (IOException e) {
+ log.debug("Error getting file hash", e);
+ this.originalFileHash = "";
+ }
}
+ return this.originalFileHash;
}
}