summaryrefslogtreecommitdiff
path: root/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java')
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java34
1 files changed, 17 insertions, 17 deletions
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 51d094eb..582b44b8 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
@@ -45,7 +45,7 @@ import com.drew.metadata.exif.ExifDirectoryBase;
import com.drew.metadata.exif.ExifIFD0Directory;
/**
- *
+ *
*/
public class CachedFileNameEmblem implements Emblem {
/**
@@ -54,13 +54,13 @@ public class CachedFileNameEmblem implements Emblem {
private static final Logger log = LoggerFactory
.getLogger(CachedFileNameEmblem.class);
- private final String fileDir = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$
- private final String imgFileName = ".emblem"; //$NON-NLS-1$
- private final String imgFileExt = "png"; //$NON-NLS-1$
- private final String propFileName = ".emblem.properties"; //$NON-NLS-1$
+ private final String fileDir = System.getProperty("user.home") + File.separator + ".pdf-over"; // //
+ private final String imgFileName = ".emblem"; //
+ private final String imgFileExt = "png"; //
+ private final String propFileName = ".emblem.properties"; //
- private final String imgProp = "IMG"; //$NON-NLS-1$
- private final String hshProp = "HSH"; //$NON-NLS-1$
+ private final String imgProp = "IMG"; //
+ private final String hshProp = "HSH"; //
private final int maxWidth = 480;
private final int maxHeight = 600;
@@ -186,7 +186,7 @@ public class CachedFileNameEmblem implements Emblem {
BufferedImage result = img;
if (width != owidth || height == oheight) {
//scale image
- log.debug("Scaling emblem: " + owidth + "x" + oheight + " to " + width + "x" + height); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ log.debug("Scaling emblem: " + owidth + "x" + oheight + " to " + width + "x" + height); // // // //
result = new BufferedImage(width, height, img.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : img.getType());
Graphics2D g = result.createGraphics();
g.drawImage(img, 0, 0, width, height, null);
@@ -202,7 +202,7 @@ public class CachedFileNameEmblem implements Emblem {
public String getFileName() {
String emblemImg = this.fileName;
String emblemHsh = null;
- String cachedEmblemFileName = this.fileDir + File.separator + this.imgFileName + "." + this.imgFileExt; //$NON-NLS-1$
+ String cachedEmblemFileName = this.fileDir + File.separator + this.imgFileName + "." + this.imgFileExt; //
if (emblemImg == null || !(new File(emblemImg).exists()))
return null;
@@ -215,13 +215,13 @@ public class CachedFileNameEmblem implements Emblem {
if (emblemImg.equals(emblemProps.getProperty(this.imgProp))) {
emblemHsh = getFileHash(emblemImg);
if (emblemHsh.equals(emblemProps.getProperty(this.hshProp))) {
- log.debug("Emblem cache hit: " + cachedEmblemFileName); //$NON-NLS-1$
- return cachedEmblemFileName; //$NON-NLS-1$
+ log.debug("Emblem cache hit: " + cachedEmblemFileName); //
+ return cachedEmblemFileName; //
}
}
- log.debug("Emblem cache miss"); //$NON-NLS-1$
+ log.debug("Emblem cache miss"); //
} catch (Exception e) {
- log.warn("Can't load emblem cache", e); //$NON-NLS-1$
+ log.warn("Can't load emblem cache", e); //
}
try {
@@ -236,12 +236,12 @@ public class CachedFileNameEmblem implements Emblem {
img = fixImage(img, imgFile);
img = scaleImage(img, this.maxWidth, this.maxHeight);
- File file = new File(this.fileDir, this.imgFileName + "." + this.imgFileExt); //$NON-NLS-1$
+ File file = new File(this.fileDir, this.imgFileName + "." + this.imgFileExt); //
ImageIO.write(img, this.imgFileExt, file); // ignore returned boolean
OutputStream out = new FileOutputStream(new File(this.fileDir, this.propFileName));
emblemProps.store(out, null);
} catch (IOException e) {
- log.error("Can't save emblem cache", e); //$NON-NLS-1$
+ log.error("Can't save emblem cache", e); //
return this.fileName;
}
return cachedEmblemFileName;
@@ -261,12 +261,12 @@ public class CachedFileNameEmblem implements Emblem {
*/
public String getOriginalFileHash() {
if (this.fileName == null || !(new File(this.fileName).exists()))
- return ""; //$NON-NLS-1$
+ return ""; //
try {
return getFileHash(this.fileName);
} catch (IOException e) {
log.debug("Error getting file hash", e);
- return ""; //$NON-NLS-1$
+ return ""; //
}
}
}