pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1760241 - /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
Date Sun, 11 Sep 2016 11:01:57 GMT
Author: tilman
Date: Sun Sep 11 11:01:57 2016
New Revision: 1760241

URL: http://svn.apache.org/viewvc?rev=1760241&view=rev
Log:
PDFBOX-3493: check multiple widgets

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java?rev=1760241&r1=1760240&r2=1760241&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
Sun Sep 11 11:01:57 2016
@@ -177,16 +177,19 @@ public class AcroFormValidationProcess e
         if (field instanceof PDTerminalField)
         {
             // The widget validation will be done by the widget annotation, a widget contained
in a Field can't have action. 
-            PDAnnotationWidget widget = field.getWidgets().get(0); // fixme: fails to check
multiple widgets
-            if (res && widget != null)
+            List<PDAnnotationWidget> widgets = field.getWidgets();
+            if (res && widgets != null)
             {
-                ContextHelper.validateElement(ctx, widget.getCOSObject(), ANNOTATIONS_PROCESS);
-                COSBase act = widget.getCOSObject().getDictionaryObject(COSName.A);
-                if (act != null)
+                for (PDAnnotationWidget widget : widgets)
                 {
-                    addValidationError(ctx, new ValidationError(ERROR_ACTION_FORBIDDEN_WIDGET_ACTION_FIELD,
-                            "\"A\" must not be used in a widget annotation"));
-                    return false;
+                    ContextHelper.validateElement(ctx, widget.getCOSObject(), ANNOTATIONS_PROCESS);
+                    COSBase act = widget.getCOSObject().getDictionaryObject(COSName.A);
+                    if (act != null)
+                    {
+                        addValidationError(ctx, new ValidationError(ERROR_ACTION_FORBIDDEN_WIDGET_ACTION_FIELD,
+                                "\"A\" must not be used in a widget annotation"));
+                        return false;
+                    }
                 }
             }
             return exploreWidgets(ctx, field.getWidgets());



Mime
View raw message