You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/07/11 11:54:22 UTC
svn commit: r1891447 -
/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
Author: tilman
Date: Sun Jul 11 11:54:22 2021
New Revision: 1891447
URL: http://svn.apache.org/viewvc?rev=1891447&view=rev
Log:
PDFBOX-4892: remove unneeded code, as suggested by valerybokov
Modified:
pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java?rev=1891447&r1=1891446&r2=1891447&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java (original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java Sun Jul 11 11:54:22 2021
@@ -37,11 +37,9 @@ import org.apache.pdfbox.preflight.Valid
import org.apache.pdfbox.preflight.exception.ValidationException;
import org.apache.pdfbox.preflight.utils.ContextHelper;
-
import static org.apache.pdfbox.preflight.PreflightConfiguration.ANNOTATIONS_PROCESS;
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_ADDITIONAL_ACTIONS_FIELD;
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_WIDGET_ACTION_FIELD;
-import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_BODY;
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_DICT_INVALID;
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_NOCATALOG;
@@ -97,33 +95,21 @@ public class AcroFormValidationProcess e
* @see #validateField(PreflightContext, PDField)
*
* @param ctx the preflight context.
- * @param lFields the list of fields, can be null.
+ * @param fields the list of fields, can be null (this will no longer be allowed in 3.0, and it
+ * isn't null currently unless methods are extended).
* @return the result of the validation.
* @throws IOException
*/
- protected boolean exploreFields(PreflightContext ctx, List<PDField> lFields) throws IOException
+ protected boolean exploreFields(PreflightContext ctx, List<PDField> fields) throws IOException
{
- if (lFields != null)
+ if (fields != null)
{
// the list can be null if the field doesn't have children
- for (Object obj : lFields)
+ for (PDField field : fields)
{
- if (obj instanceof PDField)
- {
- if (!validateField(ctx, (PDField) obj))
- {
- return false;
- }
- }
- else if (obj instanceof PDAnnotationWidget)
- {
- // "A field's children in the hierarchy may also include widget annotations"
- ContextHelper.validateElement(ctx, ((PDAnnotationWidget) obj).getCOSObject(), ANNOTATIONS_PROCESS);
- }
- else
+ if (!validateField(ctx, field))
{
- addValidationError(ctx, new ValidationError(ERROR_SYNTAX_BODY,
- "Field can only have fields or widget annotations as KIDS"));
+ return false;
}
}
}