pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1643673 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/appearance/AppearanceGenerator.java
Date Sun, 07 Dec 2014 12:59:59 GMT
Author: msahyoun
Date: Sun Dec  7 12:59:58 2014
New Revision: 1643673

URL: http://svn.apache.org/r1643673
Log:
PDFBOX-2333, PDFBOX-2516 catch IO Exception

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/appearance/AppearanceGenerator.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/appearance/AppearanceGenerator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/appearance/AppearanceGenerator.java?rev=1643673&r1=1643672&r2=1643673&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/appearance/AppearanceGenerator.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/appearance/AppearanceGenerator.java
Sun Dec  7 12:59:58 2014
@@ -48,22 +48,25 @@ public class AppearanceGenerator
      */
     public static void generateFieldAppearances(PDField field)
     {
-        // TODO: handle appearance generation for other field types
         if (field instanceof PDVariableText)
         {
 
             PDAppearanceString pdAppearance = new PDAppearanceString(field.getAcroForm(),
                     (PDVariableText) field);
 
-            Object fieldValue = field.getValue();
-
-            // in case there is no value being set generate the visual
-            // appearance with an empty String
-            if (fieldValue == null)
+            Object fieldValue = null;
+            try
             {
-                fieldValue = "";
+                fieldValue = field.getValue();
             }
+            catch (IOException e)
+            {
+                // TODO: Implement the removal of the appearance as this 
+                //       exception occurred either because the value couldn't be read or
+                //       the type is not valid for the field.
 
+            }
+            
             // TODO: implement the handling for additional values.
             if (fieldValue instanceof COSString)
             {
@@ -82,5 +85,10 @@ public class AppearanceGenerator
                         + fieldValue.getClass().getName() + ".");
             }
         }
+        // TODO: implement the handling for additional field types
+        else
+        {
+            LOG.debug("Unable to generate the field appearance.");
+        }
     }
 }



Mime
View raw message