diff --git a/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java b/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java index 4fe9475e9..be16a7688 100644 --- a/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java +++ b/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java @@ -2367,13 +2367,20 @@ protected void findImages(RepInfo info) throws IOException { .get(DICT_KEY_WIDTH); PdfSimpleObject widObj = (PdfSimpleObject) resolveIndirectObject( widthBase); - niso.setImageWidth(widObj.getIntValue()); PdfObject heightBase = xobdict .get(DICT_KEY_HEIGHT); PdfSimpleObject htObj = (PdfSimpleObject) resolveIndirectObject( heightBase); - niso.setImageLength(htObj.getIntValue()); - + if(widObj != null || htObj != null ) { + niso.setImageWidth(widObj.getIntValue()); + niso.setImageLength(htObj.getIntValue()); + } else { + info.setWellFormed(false); + JhoveMessage message = JhoveMessages.getMessageInstance( + MessageConstants.PDF_HUL_159.getId(), + MessageConstants.PDF_HUL_159.getMessage()); + info.setMessage(new ErrorMessage(message)); // PDF-HUL-159 + } // Check for filters to add to the filter // list Filter[] filters = ((PdfStream) xob) diff --git a/jhove-modules/pdf-hul/src/main/resources/edu/harvard/hul/ois/jhove/module/pdf/ErrorMessages.properties b/jhove-modules/pdf-hul/src/main/resources/edu/harvard/hul/ois/jhove/module/pdf/ErrorMessages.properties index 9858a72fd..71544d09d 100644 --- a/jhove-modules/pdf-hul/src/main/resources/edu/harvard/hul/ois/jhove/module/pdf/ErrorMessages.properties +++ b/jhove-modules/pdf-hul/src/main/resources/edu/harvard/hul/ois/jhove/module/pdf/ErrorMessages.properties @@ -160,3 +160,4 @@ PDF-HUL-155 = Error parsing mandatory version number from PDF header. PDF-HUL-156 = Extension can't be defined as an indirect reference PDF-HUL-157 = Unexpected exception {0} PDF-HUL-158 = Unexpected exception {0} +PDF-HUL-159 = Image height and width are manditory properties \ No newline at end of file