pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1844022 - in /pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger: PDFDebugger.java flagbitspane/FlagBitsPane.java flagbitspane/SigFlag.java
Date Tue, 16 Oct 2018 15:26:11 GMT
Author: tilman
Date: Tue Oct 16 15:26:10 2018
New Revision: 1844022

URL: http://svn.apache.org/viewvc?rev=1844022&view=rev
Log:
PDFBOX-2941: avoid NPE when looking at Root/AcroForm/SigFlags by passing document to AcroForm
constructor

Modified:
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/FlagBitsPane.java
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/SigFlag.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=1844022&r1=1844021&r2=1844022&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 Tue Oct
16 15:26:10 2018
@@ -1004,7 +1004,9 @@ public class PDFDebugger extends JFrame
         {
             selectedNode = ((MapEntry)selectedNode).getKey();
             selectedNode = getUnderneathObject(selectedNode);
-            FlagBitsPane flagBitsPane = new FlagBitsPane((COSDictionary) parentNode, (COSName)
selectedNode);
+            FlagBitsPane flagBitsPane = new FlagBitsPane(document,
+                    (COSDictionary) parentNode,
+                    (COSName) selectedNode);
             replaceRightComponent(flagBitsPane.getPane());
         }
     }

Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/FlagBitsPane.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/FlagBitsPane.java?rev=1844022&r1=1844021&r2=1844022&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/FlagBitsPane.java
(original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/FlagBitsPane.java
Tue Oct 16 15:26:10 2018
@@ -20,6 +20,7 @@ package org.apache.pdfbox.debugger.flagb
 import javax.swing.JPanel;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.PDDocument;
 
 /**
  * @author Khyrul Bashar
@@ -29,14 +30,16 @@ import org.apache.pdfbox.cos.COSName;
 public class FlagBitsPane
 {
     private FlagBitsPaneView view;
+    private final PDDocument document;
 
     /**
      * Constructor.
      * @param dictionary COSDictionary instance.
      * @param flagType COSName instance.
      */
-    public FlagBitsPane(final COSDictionary dictionary, COSName flagType)
+    public FlagBitsPane(PDDocument document, final COSDictionary dictionary, COSName flagType)
     {
+        this.document = document;
         createPane(dictionary, flagType);
     }
 
@@ -79,7 +82,7 @@ public class FlagBitsPane
         }
         if (COSName.SIG_FLAGS.equals(flagType))
         {
-            flag = new SigFlag(dictionary);
+            flag = new SigFlag(document, dictionary);
             view = new FlagBitsPaneView(
                     flag.getFlagType(), flag.getFlagValue(), flag.getFlagBits(), flag.getColumnNames());
         }

Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/SigFlag.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/SigFlag.java?rev=1844022&r1=1844021&r2=1844022&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/SigFlag.java
(original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/flagbitspane/SigFlag.java
Tue Oct 16 15:26:10 2018
@@ -19,6 +19,7 @@ package org.apache.pdfbox.debugger.flagb
 
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 
 /**
@@ -28,16 +29,18 @@ import org.apache.pdfbox.pdmodel.interac
  */
 public class SigFlag extends Flag
 {
-    private final COSDictionary acroformDictionary;
+    private final PDDocument document;
+    private final COSDictionary acroFormDictionary;
 
     /**
      * Constructor
      *
      * @param acroFormDictionary COSDictionary instance.
      */
-    SigFlag(COSDictionary acroFormDictionary)
+    SigFlag(PDDocument document, COSDictionary acroFormDictionary)
     {
-        acroformDictionary = acroFormDictionary;
+        this.document = document;
+        this.acroFormDictionary = acroFormDictionary;
     }
 
     @Override
@@ -49,13 +52,13 @@ public class SigFlag extends Flag
     @Override
     String getFlagValue()
     {
-        return "Flag value: " + acroformDictionary.getInt(COSName.SIG_FLAGS);
+        return "Flag value: " + acroFormDictionary.getInt(COSName.SIG_FLAGS);
     }
 
     @Override
     Object[][] getFlagBits()
     {
-        PDAcroForm acroForm = new PDAcroForm(null, acroformDictionary);
+        PDAcroForm acroForm = new PDAcroForm(document, acroFormDictionary);
         return new Object[][]{
                 new Object[]{1, "SignaturesExist", acroForm.isSignaturesExist()},
                 new Object[]{2, "AppendOnly", acroForm.isAppendOnly()},



Mime
View raw message