Author: tilman Date: Tue Dec 22 16:47:03 2020 New Revision: 1884713 URL: http://svn.apache.org/viewvc?rev=1884713&view=rev Log: PDFBOX-5055: fix javadoc, as suggested by Arturo Bernal
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFontEmbedder.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/InvalidFileTester.java Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java (original) +++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java Tue Dec 22 16:47:03 2020 @@ -559,7 +559,7 @@ public class AFMParser /** * This will convert and angle bracket hex string to a string. * - * @param hexString An angle bracket string. + * @param hexToString An angle bracket string. * * @return The bytes of the hex string. * Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java Tue Dec 22 16:47:03 2020 @@ -308,7 +308,7 @@ public class LayerUtility * Imports OCProperties from source document to target document so hidden layers can still be * hidden after import. * - * @param sourceDoc The source PDF document that contains the /OCProperties to be copied. + * @param srcDoc The source PDF document that contains the /OCProperties to be copied. * @throws IOException If an I/O error occurs. */ private void importOcProperties(PDDocument srcDoc) throws IOException Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Tue Dec 22 16:47:03 2020 @@ -499,8 +499,8 @@ public class PDDocument implements Close /** * Check if the widget already exists in the annotation list * - * @param acroFormFields the list of AcroForm fields. - * @param signatureField the signature field. + * @param annotations the list of PDAnnotation fields. + * @param widget the annotation widget. * @return true if the widget already existed in the annotation list, false if not. */ private boolean checkSignatureAnnotation(List<PDAnnotation> annotations, PDAnnotationWidget widget) Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java Tue Dec 22 16:47:03 2020 @@ -134,9 +134,9 @@ public class FDFAnnotationStamp extends } /** - * This will create an Appearance dictionary from an appearance XML document. + * This will create an Appearance dictionary from an appearance XML element. * - * @param fdfXML The XML document that contains the appearance data. + * @param appearanceXML The XML element that contains the appearance data. */ private COSDictionary parseStampAnnotationAppearanceXML(Element appearanceXML) throws IOException { Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFontEmbedder.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFontEmbedder.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFontEmbedder.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFontEmbedder.java Tue Dec 22 16:47:03 2020 @@ -47,7 +47,7 @@ final class PDTrueTypeFontEmbedder exten * * @param document The parent document * @param dict Font dictionary - * @param ttfStream TTF stream + * @param ttf TrueType font * @param encoding The PostScript encoding vector to be used for embedding. * @throws IOException if the TTF could not be read */ Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java Tue Dec 22 16:47:03 2020 @@ -118,11 +118,9 @@ class TestTextStripper private static final String ENCODING = "UTF-8"; /** - * Test class constructor. + * Test class initialization. * - * @param name The name of the test class. - * - * @throws IOException If there is an error creating the test. + * @throws IOException If there is an error initializing the test. */ @BeforeAll static void init() throws IOException Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java (original) +++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java Tue Dec 22 16:47:03 2020 @@ -102,7 +102,6 @@ public class BookmarkValidationProcess e /** * return true if Count entry > 0 * - * @param ctx the preflight context. * @param outline the dictionary representing the document outline. * @return true if the Count entry > 0. */ Modified: pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/InvalidFileTester.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/InvalidFileTester.java?rev=1884713&r1=1884712&r2=1884713&view=diff ============================================================================== --- pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/InvalidFileTester.java (original) +++ pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/InvalidFileTester.java Tue Dec 22 16:47:03 2020 @@ -1,149 +1,148 @@ -package org.apache.pdfbox.preflight.integration; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -/***************************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.io.IOUtils; -import org.apache.pdfbox.preflight.ValidationResult; -import org.apache.pdfbox.preflight.ValidationResult.ValidationError; -import org.apache.pdfbox.preflight.parser.PreflightParser; - -public class InvalidFileTester -{ - - /** - * where result information are pushed - */ - protected OutputStream outputResult = null; - - /** - * carry the path of the file validated during current test - */ - protected File path; - - protected static Log staticLogger = LogFactory.getLog("Test"); - - protected Log logger = null; - - /** - * Prepare the test for one file - * - * @param path pdf/a file to test - * @param error expected error for this test - * @throws Exception - */ - public InvalidFileTester(String resultKeyFile) throws Exception - { - this.logger = LogFactory.getLog(this.getClass()); - before(resultKeyFile); - } - - public final void validate(File path, String expectedError) throws Exception - { - if (path == null) - { - logger.warn("This is an empty test"); - return; - } - ValidationResult result = PreflightParser.validate(path); - assertFalse(result.isValid(), path + " : Isartor file should be invalid (" + path + ")"); - assertTrue(result.getErrorsList().size() > 0, path + " : Should find at least one error"); - // could contain more than one error - boolean found = false; - if (expectedError != null) - { - for (ValidationError error : result.getErrorsList()) - { - if (error.getErrorCode().equals(expectedError)) - { - found = true; - if (outputResult == null) - { - break; - } - } - if (outputResult != null) - { - String log = path.getName().replace(".pdf", "") + "#" + error.getErrorCode() - + "#" + error.getDetails() + "\n"; - outputResult.write(log.getBytes()); - } - } - } - - if (result.getErrorsList().size() > 0) - { - if (expectedError == null) - { - logger.info("File invalid as expected (no expected code) :" - + this.path.getAbsolutePath()); - } - else if (!found) - { - StringBuilder message = new StringBuilder(100); - message.append(path).append(" : Invalid error code returned. Expected "); - message.append(expectedError).append(", found "); - for (ValidationError error : result.getErrorsList()) - { - message.append(error.getErrorCode()).append(" "); - } - fail(message.toString()); - } - } - else - { - assertEquals(path + " : Invalid error code returned.", expectedError, - result.getErrorsList().get(0).getErrorCode()); - } - } - - public void before(String resultKeyFile) throws Exception - { - String irp = System.getProperty(resultKeyFile); - - if (irp == null) - { - // no log file defined, use system.err - outputResult = System.err; - } - else - { - outputResult = new FileOutputStream(irp); - } - } - - public void after() throws Exception - { - IOUtils.closeQuietly(outputResult); - } - -} +package org.apache.pdfbox.preflight.integration; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +/***************************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.io.IOUtils; +import org.apache.pdfbox.preflight.ValidationResult; +import org.apache.pdfbox.preflight.ValidationResult.ValidationError; +import org.apache.pdfbox.preflight.parser.PreflightParser; + +public class InvalidFileTester +{ + + /** + * where result information are pushed + */ + protected OutputStream outputResult = null; + + /** + * carry the path of the file validated during current test + */ + protected File path; + + protected static Log staticLogger = LogFactory.getLog("Test"); + + protected Log logger = null; + + /** + * Prepare the test for one file + * + * @param resultKeyFile the result key property file + * @throws Exception + */ + public InvalidFileTester(String resultKeyFile) throws Exception + { + this.logger = LogFactory.getLog(this.getClass()); + before(resultKeyFile); + } + + public final void validate(File path, String expectedError) throws Exception + { + if (path == null) + { + logger.warn("This is an empty test"); + return; + } + ValidationResult result = PreflightParser.validate(path); + assertFalse(result.isValid(), path + " : Isartor file should be invalid (" + path + ")"); + assertTrue(result.getErrorsList().size() > 0, path + " : Should find at least one error"); + // could contain more than one error + boolean found = false; + if (expectedError != null) + { + for (ValidationError error : result.getErrorsList()) + { + if (error.getErrorCode().equals(expectedError)) + { + found = true; + if (outputResult == null) + { + break; + } + } + if (outputResult != null) + { + String log = path.getName().replace(".pdf", "") + "#" + error.getErrorCode() + + "#" + error.getDetails() + "\n"; + outputResult.write(log.getBytes()); + } + } + } + + if (result.getErrorsList().size() > 0) + { + if (expectedError == null) + { + logger.info("File invalid as expected (no expected code) :" + + this.path.getAbsolutePath()); + } + else if (!found) + { + StringBuilder message = new StringBuilder(100); + message.append(path).append(" : Invalid error code returned. Expected "); + message.append(expectedError).append(", found "); + for (ValidationError error : result.getErrorsList()) + { + message.append(error.getErrorCode()).append(" "); + } + fail(message.toString()); + } + } + else + { + assertEquals(path + " : Invalid error code returned.", expectedError, + result.getErrorsList().get(0).getErrorCode()); + } + } + + public void before(String resultKeyFile) throws Exception + { + String irp = System.getProperty(resultKeyFile); + + if (irp == null) + { + // no log file defined, use system.err + outputResult = System.err; + } + else + { + outputResult = new FileOutputStream(irp); + } + } + + public void after() throws Exception + { + IOUtils.closeQuietly(outputResult); + } + +}