pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1621478 - in /pdfbox/trunk: examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldTreeNode.java
Date Sat, 30 Aug 2014 16:04:22 GMT
Author: lehmi
Date: Sat Aug 30 16:04:21 2014
New Revision: 1621478

URL: http://svn.apache.org/r1621478
Log:
PDFBOX-2270: optimized handling of null values

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldTreeNode.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java?rev=1621478&r1=1621477&r2=1621478&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java Sat
Aug 30 16:04:21 2014
@@ -71,7 +71,10 @@ public class PrintFields
             Iterator<COSObjectable> kidsIter = kids.iterator();
             if (field != null && !sParent.equals(field.getPartialName()))
             {
-                sParent = sParent + "." + partialName;
+                if (partialName != null)
+                {
+                    sParent = sParent + "." + partialName;
+                }
             }
             System.out.println(sLevel + sParent);
             while (kidsIter.hasNext())
@@ -105,11 +108,16 @@ public class PrintFields
                 }
                 else
                 {
-                    fieldValue = "";
+                    fieldValue = "no value available";
                 }
             }
-            String outputString = sLevel + sParent + "." + partialName + " = " + fieldValue
+ ",  type="
-                    + field.getClass().getName();
+            StringBuilder outputString = new StringBuilder(sLevel + sParent);
+            if (partialName != null)
+            {
+                outputString.append( "." + partialName);
+            }
+            outputString.append(" = " + fieldValue);
+            outputString.append(",  type=" + field.getClass().getName());
             System.out.println(outputString);
         }
     }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldTreeNode.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldTreeNode.java?rev=1621478&r1=1621477&r2=1621478&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldTreeNode.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldTreeNode.java
Sat Aug 30 16:04:21 2014
@@ -566,11 +566,18 @@ public abstract class PDFieldTreeNode im
      */
     public String getFullyQualifiedName() throws IOException
     {
-        String parentName = getParent() != null ? getParent().getFullyQualifiedName() : null;
         String finalName = getPartialName();
+        String parentName = getParent() != null ? getParent().getFullyQualifiedName() : null;
         if (parentName != null)
         {
-            finalName = parentName + "." + finalName;
+            if (finalName != null)
+            {
+                finalName = parentName + "." + finalName;
+            }
+            else
+            {
+                finalName = parentName;
+            }
         }
         return finalName;
     }



Mime
View raw message