[
https://issues.apache.org/jira/browse/PDFBOX-5792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17832421#comment-17832421
]
Tilman Hausherr edited comment on PDFBOX-5792 at 3/30/24 10:07 AM:
-------------------------------------------------------------------
Thanks for reporting this. I think there is a logic mistake in
{{fixDestinations()}} because it is called for every destination document, so
the destination page is sometimes set to null prematurely. I need to rethink
this.
If this blocks you, then the best is not to revert to the old version (because
3.0.1 has other bugs that may be related to splitting!), but to copy the
splitter source code, change {{fixDestinations()}} so that it checks for null
at the line that crashes. The result will be that SOME of the local destination
links won't work (which is closer to the old behaviour, where NO links worked).
was (Author: tilman):
Thanks for reporting this. I think there is a logic mistake in
{{fixDestinations()}} because it is called for every destination document, so
the destination page is sometimes set to null prematurely. I need to rethink
this.
If this blocks you, then the best is not to revert to the old version, but to
copy the splitter code (because 3.0.1 has other bugs that may be related to
splitting!), change {{fixDestinations()}} so that it checks for null at the
line that crashes. The result will be that SOME of the local destination links
won't work (which is closer to the old behaviour, where NO links worked).
> Regression NPE in Splitter
> --------------------------
>
> Key: PDFBOX-5792
> URL: https://issues.apache.org/jira/browse/PDFBOX-5792
> Project: PDFBox
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.0.31, 3.0.2 PDFBox
> Reporter: Mohan H
> Priority: Blocker
> Fix For: 2.0.32, 4.0.0, 3.0.3 PDFBox
>
> Attachments: PdfBoxSplitterTest.java, demo.pdf
>
>
> {color:#172b4d}The attached pdf used to work with Splitter in release 3.0.0,
> 3.01 {color}{color:#172b4d}however breaks in 3.0.2.{color}
> {color:#ff0000}Cannot invoke
> "org.apache.pdfbox.pdmodel.PDPage.getCOSObject()" because the return value of
> "org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageDestination.getPage()"
> is null{color}
> {color:#0066cc}java.lang.NullPointerException{color}{color:#ff0000}: Cannot
> invoke "org.apache.pdfbox.pdmodel.PDPage.getCOSObject()" because the return
> value of
> "org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageDestination.getPage()"
> is null{color}
> {color:#ff0000} at
> org.apache.pdfbox.multipdf.Splitter.fixDestinations({color}{color:#0066cc}Splitter.java:153{color}{color:#ff0000}){color}
> {color:#ff0000} at
> org.apache.pdfbox.multipdf.Splitter.split({color}{color:#0066cc}Splitter.java:136{color}{color:#ff0000}){color}
>
> Have attached the pdf and a test class.
> It fails if we split on page count =1 or count = 10.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]