Skip to content

Commit

Permalink
code refactoring, #293
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Nov 1, 2024
1 parent 08ebc3b commit 30cd175
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/metanorma/fop/annotations/Annotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ private void fixAnnotationTags(COSArray oArray, COSObject parentObject, int leve
structureTreeRoot.setParentTree(parentTree);
// END from stackoverflow
} catch (IOException e) {
System.out.println(e.toString());
logger.severe("ParentTreeKey update error:" + e.toString());
}
}
}
Expand All @@ -447,7 +447,8 @@ private void clearEmptyAnnotations(PDDocument document) throws IOException {
List<PDAnnotation> pageAnnotations = new ArrayList<>();
PDPage page = document.getPage(i);
for(PDAnnotation pageAnnotation: page.getAnnotations()) {
if(!(pageAnnotation.getContents().startsWith(ANNOT_PREFIX))) {
if(pageAnnotation.getContents() != null &&
!(pageAnnotation.getContents().startsWith(ANNOT_PREFIX))) {
String subj = pageAnnotation.getCOSObject().getString(COSName.SUBJ);
if (subj != null && subj.startsWith(ANNOT_PREFIX)) {
pageAnnotation.getCOSObject().setItem(COSName.SUBJ, null);
Expand Down

0 comments on commit 30cd175

Please sign in to comment.