Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when Image Height and Width is null #897

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading