NPE from PDPageLabels with a large number PDPageLabelRanges
-----------------------------------------------------------
Key: PDFBOX-856
URL: https://issues.apache.org/jira/browse/PDFBOX-856
Project: PDFBox
Issue Type: Bug
Components: PDModel
Affects Versions: 1.2.1
Reporter: Kevin Jackson
Section 3.8.6 states that number trees either "Nums" or "Kids" entries. The
current PDPageLabels does not handle Kids and fails with a NPE.
Fix:
public PDPageLabels(PDDocument document, COSDictionary dict) throws
IOException
{
this(document);
if (dict == null)
{
return;
}
PDNumberTreeNode root = new PDNumberTreeNode(dict, COSDictionary.class);
findLabels(root);
}
private void findLabels(PDNumberTreeNode node) throws IOException {
if (node.getKids() != null) {
@SuppressWarnings("unchecked")
List<PDNumberTreeNode> kids = node.getKids();
for (PDNumberTreeNode kid : kids) {
findLabels(kid);
}
}
else if (node.getNumbers() != null) {
@SuppressWarnings("unchecked")
Map<Integer, COSDictionary> numbers = node.getNumbers();
for (Entry<Integer, COSDictionary> i : numbers.entrySet())
{
labels.put(i.getKey(), new PDPageLabelRange(i.getValue()));
}
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.