Skip to content

Commit

Permalink
Merge pull request #897 from samalloing/samImageHeightWidth
Browse files Browse the repository at this point in the history
Error when Image Height and Width is null
  • Loading branch information
carlwilson authored Mar 4, 2024
2 parents c7eaf5f + c64e495 commit 58fecdc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public enum MessageConstants {
public static final JhoveMessage PDF_HUL_156 = messageFactory.getMessage("PDF-HUL-156");
public static final JhoveMessage PDF_HUL_157 = messageFactory.getMessage("PDF-HUL-157");
public static final JhoveMessage PDF_HUL_158 = messageFactory.getMessage("PDF-HUL-158");
public static final JhoveMessage PDF_HUL_159 = messageFactory.getMessage("PDF-HUL-159");

/**
* Logger Messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 58fecdc

Please sign in to comment.