Skip to content

Commit 6f797bc

Browse files
committed
Fix GFCosDocument methods
1 parent 327f36b commit 6f797bc

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

validation-model/src/main/java/org/verapdf/gf/model/impl/cos/GFCosDocument.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,13 @@ public Boolean getisLinearized() {
237237
public Boolean getMarked() {
238238
if (this.catalog != null) {
239239
COSObject markInfoObject = this.catalog.getKey(ASAtom.MARK_INFO);
240-
if (markInfoObject != null && markInfoObject.getType() == COSObjType.COS_DICT) {
241-
return markInfoObject.getBooleanKey(ASAtom.MARKED);
240+
if (markInfoObject != null && !markInfoObject.empty()) {
241+
if (markInfoObject.getType() == COSObjType.COS_DICT) {
242+
return markInfoObject.getBooleanKey(ASAtom.MARKED);
243+
}
244+
LOGGER.log(Level.WARNING,
245+
"MarkedInfo must be a 'COSDictionary' but got: " + markInfoObject.getType());
242246
}
243-
LOGGER.log(Level.WARNING,
244-
"MarkedInfo must be a 'COSDictionary' but got: " + markInfoObject.getType());
245247
return null;
246248
}
247249
return null;
@@ -251,11 +253,13 @@ public Boolean getMarked() {
251253
public Boolean getDisplayDocTitle() {
252254
if (this.catalog != null) {
253255
COSObject viewerPrefObject = this.catalog.getKey(ASAtom.VIEWER_PREFERENCES);
254-
if (viewerPrefObject != null && viewerPrefObject.getType() == COSObjType.COS_DICT) {
255-
return viewerPrefObject.getBooleanKey(ASAtom.DISPLAY_DOC_TITLE);
256+
if (viewerPrefObject != null && !viewerPrefObject.empty()) {
257+
if (viewerPrefObject.getType() == COSObjType.COS_DICT) {
258+
return viewerPrefObject.getBooleanKey(ASAtom.DISPLAY_DOC_TITLE);
259+
}
260+
LOGGER.log(Level.WARNING,
261+
"viewerPref must be a 'COSDictionary' but got: " + viewerPrefObject.getType());
256262
}
257-
LOGGER.log(Level.WARNING,
258-
"viewerPref must be a 'COSDictionary' but got: " + viewerPrefObject.getType());
259263
return null;
260264
}
261265
return null;
@@ -294,11 +298,13 @@ public Boolean getcontainsInfo() {
294298
public Boolean getSuspects() {
295299
if (this.catalog != null) {
296300
COSObject markInfoObject = this.catalog.getKey(ASAtom.MARK_INFO);
297-
if (markInfoObject != null && markInfoObject.getType() == COSObjType.COS_DICT) {
298-
return markInfoObject.getBooleanKey(ASAtom.SUSPECTS);
301+
if (markInfoObject != null && !markInfoObject.empty()) {
302+
if (markInfoObject.getType() == COSObjType.COS_DICT) {
303+
return markInfoObject.getBooleanKey(ASAtom.SUSPECTS);
304+
}
305+
LOGGER.log(Level.WARNING,
306+
"MarkedInfo must be a 'COSDictionary' but got: " + markInfoObject.getType());
299307
}
300-
LOGGER.log(Level.WARNING,
301-
"MarkedInfo must be a 'COSDictionary' but got: " + markInfoObject.getType());
302308
return null;
303309
}
304310
return null;

0 commit comments

Comments
 (0)