Skip to content

Commit 64b59d4

Browse files
committed
PDFBOX-4892: remove unneeded code, as suggested by valerybokov
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1891446 13f79535-47bb-0310-9956-ffa450edef68
1 parent d46eae4 commit 64b59d4

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@
3737
import org.apache.pdfbox.preflight.exception.ValidationException;
3838
import org.apache.pdfbox.preflight.utils.ContextHelper;
3939

40-
4140
import static org.apache.pdfbox.preflight.PreflightConfiguration.ANNOTATIONS_PROCESS;
4241
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_ADDITIONAL_ACTIONS_FIELD;
4342
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_WIDGET_ACTION_FIELD;
44-
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_BODY;
4543
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_DICT_INVALID;
4644
import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_NOCATALOG;
4745

@@ -97,34 +95,17 @@ protected void checkNeedAppearences(PreflightContext ctx, PDAcroForm acroForm)
9795
* @see #validateField(PreflightContext, PDField)
9896
*
9997
* @param ctx the preflight context.
100-
* @param lFields the list of fields, can be null.
98+
* @param fields the list of fields, never null.
10199
* @return the result of the validation.
102100
* @throws IOException
103101
*/
104-
protected boolean exploreFields(PreflightContext ctx, List<PDField> lFields) throws IOException
102+
protected boolean exploreFields(PreflightContext ctx, List<PDField> fields) throws IOException
105103
{
106-
if (lFields != null)
104+
for (PDField field : fields)
107105
{
108-
// the list can be null if the field doesn't have children
109-
for (Object obj : lFields)
106+
if (!validateField(ctx, field))
110107
{
111-
if (obj instanceof PDField)
112-
{
113-
if (!validateField(ctx, (PDField) obj))
114-
{
115-
return false;
116-
}
117-
}
118-
else if (obj instanceof PDAnnotationWidget)
119-
{
120-
// "A field's children in the hierarchy may also include widget annotations"
121-
ContextHelper.validateElement(ctx, ((PDAnnotationWidget) obj).getCOSObject(), ANNOTATIONS_PROCESS);
122-
}
123-
else
124-
{
125-
addValidationError(ctx, new ValidationError(ERROR_SYNTAX_BODY,
126-
"Field can only have fields or widget annotations as KIDS"));
127-
}
108+
return false;
128109
}
129110
}
130111
return true;

0 commit comments

Comments
 (0)