You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2023/03/26 12:54:56 UTC
svn commit: r1908734 - /pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
Author: lehmi
Date: Sun Mar 26 12:54:56 2023
New Revision: 1908734
URL: http://svn.apache.org/viewvc?rev=1908734&view=rev
Log:
PDFBOX-5539: avoid exception if the selected object is a font or image on the first level of the cross reference table
Modified:
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java?rev=1908734&r1=1908733&r2=1908734&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java Sun Mar 26 12:54:56 2023
@@ -1075,7 +1075,11 @@ public class PDFDebugger extends JFrame
{
// not to be used for /Thumb, even if it contains /Subtype /Image
Object resourcesObj = path.getParentPath().getParentPath().getLastPathComponent();
- resourcesDic = (COSDictionary) getUnderneathObject(resourcesObj);
+ // resources may be unreachable if the selected node is on the first level of a cross reference table
+ if (!(resourcesObj instanceof XrefEntries))
+ {
+ resourcesDic = (COSDictionary) getUnderneathObject(resourcesObj);
+ }
}
StreamPane streamPane = new StreamPane(stream, isContentStream, isThumb, resourcesDic);
replaceRightComponent(streamPane.getPanel());
@@ -1083,11 +1087,18 @@ public class PDFDebugger extends JFrame
private void showFont(Object selectedNode, TreePath path)
{
+ JPanel pane = null;
COSName fontName = getNodeKey(selectedNode);
- COSDictionary resourceDic = (COSDictionary) getUnderneathObject(path.getParentPath().getParentPath().getLastPathComponent());
+ // may be null if the selected node is on the first level of a cross reference table
+ if (fontName != null)
+ {
+ COSDictionary resourceDic = (COSDictionary) getUnderneathObject(
+ path.getParentPath().getParentPath().getLastPathComponent());
- FontEncodingPaneController fontEncodingPaneController = new FontEncodingPaneController(fontName, resourceDic);
- JPanel pane = fontEncodingPaneController.getPane();
+ FontEncodingPaneController fontEncodingPaneController = new FontEncodingPaneController(
+ fontName, resourceDic);
+ pane = fontEncodingPaneController.getPane();
+ }
if (pane == null)
{
// unsupported font type