pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1689048 - in /pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane: FieldFlag.java FlagBitsPane.java FlagBitsPaneView.java
Date Fri, 03 Jul 2015 16:41:07 GMT
Author: tilman
Date: Fri Jul  3 16:41:06 2015
New Revision: 1689048

URL: http://svn.apache.org/r1689048
Log:
PDFBOX-2530: NPE bugfix, as done by Khyrul Bashar in GSoC2015

Modified:
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FieldFlag.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPane.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPaneView.java

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FieldFlag.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FieldFlag.java?rev=1689048&r1=1689047&r2=1689048&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FieldFlag.java
(original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FieldFlag.java
Fri Jul  3 16:41:06 2015
@@ -40,15 +40,16 @@ class FieldFlag extends Flag
     @Override
     String getFlagType()
     {
-        if (dictionary.getCOSName(COSName.FT).equals(COSName.TX))
+        COSName fieldType = dictionary.getCOSName(COSName.FT);
+        if (COSName.TX.equals(fieldType))
         {
             return "Text field flag";
         }
-        else if (dictionary.getCOSName(COSName.FT).equals(COSName.BTN))
+        else if (COSName.BTN.equals(fieldType))
         {
             return "Button field flag";
         }
-        else if (dictionary.getCOSName(COSName.FT).equals(COSName.CH))
+        else if (COSName.CH.equals(fieldType))
         {
             return "Choice field flag";
         }
@@ -65,16 +66,17 @@ class FieldFlag extends Flag
     Object[][] getFlagBits()
     {
         int flagValue = dictionary.getInt(COSName.FF);
+        COSName fieldType = dictionary.getCOSName(COSName.FT);
 
-        if (dictionary.getCOSName(COSName.FT).equals(COSName.TX))
+        if (COSName.TX.equals(fieldType))
         {
             return getTextFieldFlagBits(flagValue);
         }
-        else if (dictionary.getCOSName(COSName.FT).equals(COSName.BTN))
+        else if (COSName.BTN.equals(fieldType))
         {
             return getButtonFieldFlagBits(flagValue);
         }
-        else if (dictionary.getCOSName(COSName.FT).equals(COSName.CH))
+        else if (COSName.CH.equals(fieldType))
         {
             return getChoiceFieldFlagBits(flagValue);
         }

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPane.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPane.java?rev=1689048&r1=1689047&r2=1689048&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPane.java
(original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPane.java
Fri Jul  3 16:41:06 2015
@@ -43,28 +43,28 @@ public class FlagBitsPane
     private void createPane(final COSDictionary dictionary, final COSName flagType)
     {
         Flag flag;
-        if (flagType.equals(COSName.FLAGS))
+        if (COSName.FLAGS.equals(flagType))
         {
             flag = new FontFlag(dictionary);
             view = new FlagBitsPaneView(
                     flag.getFlagType(), flag.getFlagValue(), flag.getFlagBits(), flag.getColumnNames());
         }
 
-        if (flagType.equals(COSName.F))
+        if (COSName.F.equals(flagType))
         {
             flag = new AnnotFlag(dictionary);
             view = new FlagBitsPaneView(
                     flag.getFlagType(), flag.getFlagValue(), flag.getFlagBits(), flag.getColumnNames());
         }
 
-        if (flagType.equals(COSName.FF))
+        if (COSName.FF.equals(flagType))
         {
             flag = new FieldFlag(dictionary);
             view = new FlagBitsPaneView(
                     flag.getFlagType(), flag.getFlagValue(), flag.getFlagBits(), flag.getColumnNames());
         }
 
-        if (flagType.equals(COSName.PANOSE))
+        if (COSName.PANOSE.equals(flagType))
         {
             flag = new PanoseFlag(dictionary);
             view = new FlagBitsPaneView(

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPaneView.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPaneView.java?rev=1689048&r1=1689047&r2=1689048&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPaneView.java
(original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/pdfdebugger/flagbitspane/FlagBitsPaneView.java
Fri Jul  3 16:41:06 2015
@@ -56,7 +56,10 @@ class FlagBitsPaneView
         this.columnNames = columnNames;
         panel = new JPanel();
 
-        createView();
+        if (flagValue != null && tableData != null)
+        {
+            createView();
+        }
     }
 
     private void createView()



Mime
View raw message