aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-01-11 10:18:13 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-01-11 10:18:13 +0000
commitb1621bbb9d278d8a5c4631b5804bf6a61678ef41 (patch)
tree5350cfb387185fcde4ad5015162a8c2c0fff31c2 /src/main/java/at/gv/egiz/pdfas
parenta2739913fd9d61d65e063a86ce447229332a26a2 (diff)
downloadpdf-as-3-b1621bbb9d278d8a5c4631b5804bf6a61678ef41.tar.gz
pdf-as-3-b1621bbb9d278d8a5c4631b5804bf6a61678ef41.tar.bz2
pdf-as-3-b1621bbb9d278d8a5c4631b5804bf6a61678ef41.zip
Bugfix: TIFF based QR-Codes resulted in NPE.
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@720 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java
index 85d14f8..c9d5cd7 100644
--- a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java
+++ b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java
@@ -236,8 +236,20 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
*/
private SignaturePlaceholderData checkImage(PDXObjectImage image) throws IOException {
BufferedImage bimg = image.getRGBImage();
- if(bimg.getHeight() < 10 || bimg.getWidth() < 10)
+ if (bimg == null) {
+ String type = image.getSuffix();
+ if (type != null) {
+ type = type.toUpperCase() + " images";
+ } else {
+ type = "Image type";
+ }
+ log.info("Unable to extract image for QRCode analysis. " + type + " not supported. Add additional JAI Image filters to your classpath. Refer to https://jai.dev.java.net. Skipping image.");
+ return null;
+ }
+ if(bimg.getHeight() < 10 || bimg.getWidth() < 10) {
+ log.debug("Image too small for QRCode. Skipping image.");
return null;
+ }
LuminanceSource source = new BufferedImageLuminanceSource(bimg);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));