[jira] [Comment Edited] (PDFBOX-5975) Class cast exception in building PDDestinationNameTreeNode

2025-04-05 Thread Tilman Hausherr (Jira)


[ 
https://issues.apache.org/jira/browse/PDFBOX-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17936936#comment-17936936
 ] 

Tilman Hausherr edited comment on PDFBOX-5975 at 3/19/25 8:21 PM:
--

That entry looks ok to me... the value would be entry 49 in the array (the next 
one) looks different to entry 47 but both are valid destination values. What I 
suspect is several string (key) entries. I was able to alter my file and 
reproduce the error. Only one line is needed if one knows the key:
{code:java}
doc.getDocumentCatalog().findNamedDestinationPage(new 
PDNamedDestination("add83"));
{code}


was (Author: tilman):
That entry looks ok to me... entry 49 (the next one) looks different to entry 
47 but both are valid destinations. What I suspect is several string entries. I 
was able to alter my file and reproduce the error. Only one line is needed if 
one knows the key:
{code:java}
doc.getDocumentCatalog().findNamedDestinationPage(new 
PDNamedDestination("add83"));
{code}

> Class cast exception in building PDDestinationNameTreeNode
> --
>
> Key: PDFBOX-5975
> URL: https://issues.apache.org/jira/browse/PDFBOX-5975
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 3.0.4 PDFBox
> Environment: Windows
>Reporter: Frans Bouwmans
>Priority: Major
> Attachments: 000334.pdf, image-2025-03-19-15-43-48-035.png, 
> image-2025-03-19-15-49-23-060.png, image-2025-03-19-20-03-09-702.png, 
> screenshot-1.png
>
>
> In PDDestinationNameTreeNode.java on line 63 a PDDestination is created.
> This function returns a PDDestination which is then casted to a 
> PDPageDestination.
> There is however also a PDDestination of type PDNamedDestination.
> When a page is opened of a document with a named destination and the 
> destination tree node is created, such as on rendering or using the splitter, 
> then just opening the page will fail with a class cast exception and the page 
> can therefore not be rendered, and is not included in a split document.
> A test with a check of the instance type and return null does at least fix 
> the exception.
> It is not clear whether named destinations should be handled here or ignored.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org



[jira] [Comment Edited] (PDFBOX-5975) Class cast exception in building PDDestinationNameTreeNode

2025-03-25 Thread Tilman Hausherr (Jira)


[ 
https://issues.apache.org/jira/browse/PDFBOX-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17936917#comment-17936917
 ] 

Tilman Hausherr edited comment on PDFBOX-5975 at 3/19/25 7:03 PM:
--

In PDFDebugger switch to the "internal structure" view, the name tree should be 
below root, it's called "Names".
 !image-2025-03-19-20-03-09-702.png! 

If you can find where the "bad" element is, I'd love to see a screenshot.


was (Author: tilman):
In PDFDebugger switch to the "internal structure" view, the name tree should be 
below root, it's called "Names".
 !screenshot-1.png! 

If you can find where the "bad" element is, I'd love to see a screenshot.

> Class cast exception in building PDDestinationNameTreeNode
> --
>
> Key: PDFBOX-5975
> URL: https://issues.apache.org/jira/browse/PDFBOX-5975
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 3.0.4 PDFBox
> Environment: Windows
>Reporter: Frans Bouwmans
>Priority: Major
> Attachments: image-2025-03-19-20-03-09-702.png, screenshot-1.png
>
>
> In PDDestinationNameTreeNode.java on line 63 a PDDestination is created.
> This function returns a PDDestination which is then casted to a 
> PDPageDestination.
> There is however also a PDDestination of type PDNamedDestination.
> When a page is opened of a document with a named destination and the 
> destination tree node is created, such as on rendering or using the splitter, 
> then just opening the page will fail with a class cast exception and the page 
> can therefore not be rendered, and is not included in a split document.
> A test with a check of the instance type and return null does at least fix 
> the exception.
> It is not clear whether named destinations should be handled here or ignored.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org



[jira] [Comment Edited] (PDFBOX-5975) Class cast exception in building PDDestinationNameTreeNode

2025-03-19 Thread Tilman Hausherr (Jira)


[ 
https://issues.apache.org/jira/browse/PDFBOX-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17936925#comment-17936925
 ] 

Tilman Hausherr edited comment on PDFBOX-5975 at 3/19/25 8:03 PM:
--

I think you didn't catch the part that is problematic (you would need to get 
the key (see PDNameTreeNode:272) and find it in the tree), however I think I 
can guess what happened. This is an array which has an even number of elemets, 
there's always a string and then an array (the destination). Maybe the creator 
of the file made a mess and there are several strings without an array between.


was (Author: tilman):
Could you post the stack trace?
I think you didn't catch the part that is problematic (you would need to get 
the key (see PDNameTreeNode:272) and find it in the tree), however I think I 
can guess what happened. This is an array which has an even number of elemets, 
there's always a string and then an array (the destination). Maybe the creator 
of the file made a mess and there are several strings without an array between.

> Class cast exception in building PDDestinationNameTreeNode
> --
>
> Key: PDFBOX-5975
> URL: https://issues.apache.org/jira/browse/PDFBOX-5975
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 3.0.4 PDFBox
> Environment: Windows
>Reporter: Frans Bouwmans
>Priority: Major
> Attachments: 000334.pdf, image-2025-03-19-15-43-48-035.png, 
> image-2025-03-19-15-49-23-060.png, image-2025-03-19-20-03-09-702.png, 
> screenshot-1.png
>
>
> In PDDestinationNameTreeNode.java on line 63 a PDDestination is created.
> This function returns a PDDestination which is then casted to a 
> PDPageDestination.
> There is however also a PDDestination of type PDNamedDestination.
> When a page is opened of a document with a named destination and the 
> destination tree node is created, such as on rendering or using the splitter, 
> then just opening the page will fail with a class cast exception and the page 
> can therefore not be rendered, and is not included in a split document.
> A test with a check of the instance type and return null does at least fix 
> the exception.
> It is not clear whether named destinations should be handled here or ignored.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org



[jira] [Comment Edited] (PDFBOX-5975) Class cast exception in building PDDestinationNameTreeNode

2025-03-19 Thread Tilman Hausherr (Jira)


[ 
https://issues.apache.org/jira/browse/PDFBOX-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17936894#comment-17936894
 ] 

Tilman Hausherr edited comment on PDFBOX-5975 at 3/19/25 5:26 PM:
--

Do you have a file that shows the problem?
I suspect it's an incorrect PDF, PDDestinationNameTreeNode should hold "Name -> 
PageDestination" relations. But if I'm right about that, then we should catch 
incorrect entries.


was (Author: tilman):
Do you have a file that shows the problem?

> Class cast exception in building PDDestinationNameTreeNode
> --
>
> Key: PDFBOX-5975
> URL: https://issues.apache.org/jira/browse/PDFBOX-5975
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 3.0.4 PDFBox
> Environment: Windows
>Reporter: Frans Bouwmans
>Priority: Major
>
> In PDDestinationNameTreeNode.java on line 63 a PDDestination is created.
> This function returns a PDDestination which is then casted to a 
> PDPageDestination.
> There is however also a PDDestination of type PDNamedDestination.
> When a page is opened of a document with a named destination and the 
> destination tree node is created, such as on rendering or using the splitter, 
> then just opening the page will fail with a class cast exception and the page 
> can therefore not be rendered, and is not included in a split document.
> A test with a check of the instance type and return null does at least fix 
> the exception.
> It is not clear whether named destinations should be handled here or ignored.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org