pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1760965 - in /pdfbox/branches/2.0: debugger/src/main/java/org/apache/pdfbox/debugger/ui/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/ pdfbox/src/main/java/org/ap...
Date Thu, 15 Sep 2016 17:55:03 GMT
Author: tilman
Date: Thu Sep 15 17:55:03 2016
New Revision: 1760965

URL: http://svn.apache.org/viewvc?rev=1760965&view=rev
Log:
PDFBOX-2852: fix javadoc, as suggested by Lorenz Pahl

Modified:
    pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType3.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSFloat.java
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java
    pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java
    pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java
    pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java

Modified: pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
(original)
+++ pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
Thu Sep 15 17:55:03 2016
@@ -148,8 +148,6 @@ public class ErrorDialog extends JDialog
     /**
      * Creates the display with the top-level exception message followed by a pane (that
toggles)
      * for detailed stack traces.
-     *
-     * @param t a non-null exception
      */
     final JComponent createContent()
     {

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType3.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType3.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType3.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType3.java
Thu Sep 15 17:55:03 2016
@@ -166,7 +166,7 @@ public class PDFunctionType3 extends PDF
     /**
      * Get the encode for the input parameter.
      *
-     * @param paramNum The function parameter number.
+     * @param n The function parameter number.
      *
      * @return The encode parameter range or null if none is set.
      */

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
Thu Sep 15 17:55:03 2016
@@ -229,7 +229,7 @@ public abstract class SecurityHandler
     /**
      * Encrypt or decrypt data with AES with key length other than 256 bits.
      *
-     * @param finalKey The final key obtained with via {@link #calcFinalKey()}.
+     * @param finalKey The final key obtained with via {@link #calcFinalKey(long, long)}.
      * @param data The data to encrypt.
      * @param output The output to write the encrypted data to.
      * @param decrypt true to decrypt the data, false to encrypt it.

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java
Thu Sep 15 17:55:03 2016
@@ -29,7 +29,7 @@ class TensorPatch extends Patch
     /**
      * Constructor of a patch for type 7 shading.
      *
-     * @param points 16 control points
+     * @param tcp 16 control points
      * @param color 4 corner colors
      */
     protected TensorPatch(Point2D[] tcp, float[][] color)

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java Thu
Sep 15 17:55:03 2016
@@ -1919,7 +1919,7 @@ public class PDFTextStripper extends Leg
     }
 
     /**
-     * Used within {@link #normalize(List, boolean, boolean)} to create a single {@link WordWithTextPositions}
entry.
+     * Used within {@link #normalize(List)} to create a single {@link WordWithTextPositions}
entry.
      */
     private WordWithTextPositions createWord(String word, List<TextPosition> wordPositions)
     {
@@ -1983,7 +1983,7 @@ public class PDFTextStripper extends Leg
     }
 
     /**
-     * Used within {@link #normalize(List, boolean, boolean)} to handle a {@link TextPosition}.
+     * Used within {@link #normalize(List)} to handle a {@link TextPosition}.
      * 
      * @return The StringBuilder that must be used when calling this method.
      */

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSFloat.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSFloat.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSFloat.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSFloat.java Thu Sep
15 17:55:03 2016
@@ -1,332 +1,332 @@
-/*
- * 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.
- */
-
-package org.apache.pdfbox.cos;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.Random;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.pdfbox.pdfwriter.COSWriter;
-
-/**
- * Tests {@link COSFloat}.
- */
-public class TestCOSFloat extends TestCOSNumber
-{
-    @Override
-    public void setUp()
-    {
-        try
-        {
-            testCOSBase = COSNumber.get("1.1");
-        }
-        catch (IOException e)
-        {
-            fail("Failed to create a COSNumber in setUp()");
-        }
-    }
-
-    /**
-     * Base class to run looped tests with float numbers.
-     *
-     * To use it, derive a class and just implement runTest(). Then either call
-     * runTests for a series of random and pseudorandom tests, or runTest to
-     * test with corner values.
-     */
-    abstract class BaseTester
-    {
-        private int low = -100000;
-        private int high = 300000;
-        private int step = 20000;
-
-        public void setLoop(int low, int high, int step)
-        {
-            this.low = low;
-            this.high = high;
-            this.step = step;
-        }
-
-        // deterministic and non-deterministic test
-        public void runTests()
-        {
-            // deterministic test
-            loop(123456);
-
-            // non-deterministic test
-            loop(System.currentTimeMillis());
-        }
-
-        // look through a series of pseudorandom tests influenced by a seed
-        private void loop(long seed)
-        {
-            Random rnd = new Random(seed);
-            for (int i = low; i < high; i += step)
-            {
-                float num = i * rnd.nextFloat();
-                try
-                {
-                    runTest(num);
-                }
-                catch (AssertionError a)
-                {
-                    fail("num = " + num + ", seed = " + seed);
-                }
-            }
-        }
-
-        abstract void runTest(float num);
-
-    }
-
-    /**
-     * Tests equals() - ensures that the Object.equals() contract is obeyed.
-     * These are tested over a range of arbitrary values to ensure Consistency,
-     * Reflexivity, Symmetry, Transitivity and non-nullity.
-     */
-    public void testEquals()
-    {
-        new BaseTester()
-        {
-            @Override
-            void runTest(float num)
-            {
-                COSFloat test1 = new COSFloat(num);
-                COSFloat test2 = new COSFloat(num);
-                COSFloat test3 = new COSFloat(num);
-                // Reflexive (x == x)
-                assertTrue(test1.equals(test1));
-                // Symmetric is preserved ( x==y then y==x)
-                assertTrue(test2.equals(test3));
-                assertTrue(test1.equals(test2));
-                // Transitive (if x==y && y==z then x==z)
-                assertTrue(test1.equals(test2));
-                assertTrue(test2.equals(test3));
-                assertTrue(test1.equals(test3));
-
-                float nf = Float.intBitsToFloat(Float.floatToIntBits(num) + 1);
-                COSFloat test4 = new COSFloat(nf);
-                assertFalse(test4.equals(test1));
-            }
-        }.runTests();
-    }
-
-    class HashCodeTester extends BaseTester
-    {
-
-        @Override
-        void runTest(float num)
-        {
-            COSFloat test1 = new COSFloat(num);
-            COSFloat test2 = new COSFloat(num);
-            assertEquals(test1.hashCode(), test2.hashCode());
-
-            float nf = Float.intBitsToFloat(Float.floatToIntBits(num) + 1);
-            COSFloat test3 = new COSFloat(nf);
-            assertFalse(test3.hashCode() == test1.hashCode());
-        }
-    }
-
-    /**
-     * Tests hashCode() - ensures that the Object.hashCode() contract is obeyed
-     * over a range of arbitrary values.
-     */
-    public void testHashCode()
-    {
-        new HashCodeTester().runTests();
-    }
-
-    class FloatValueTester extends BaseTester
-    {
-
-        @Override
-        void runTest(float num)
-        {
-            COSFloat testFloat = new COSFloat(num);
-            assertEquals(num, testFloat.floatValue());
-        }
-
-    }
-
-    @Override
-    public void testFloatValue()
-    {
-        new FloatValueTester().runTests();
-    }
-
-    class DoubleValueTester extends BaseTester
-    {
-
-        @Override
-        void runTest(float num)
-        {
-            COSFloat testFloat = new COSFloat(num);
-            // compare the string representation instead of the numeric values 
-            // as the cast from float to double adds some more fraction digits
-            assertEquals(Float.toString(num), Double.toString(testFloat.doubleValue()));
-        }
-
-    }
-
-    @Override
-    public void testDoubleValue()
-    {
-        new DoubleValueTester().runTests();
-    }
-
-    class IntValueTester extends BaseTester
-    {
-
-        @Override
-        void runTest(float num)
-        {
-            COSFloat testFloat = new COSFloat(num);
-            assertEquals((int) num, testFloat.intValue());
-        }
-
-    }
-
-    @Override
-    public void testIntValue()
-    {
-        new IntValueTester().runTests();
-    }
-
-    class LongValueTester extends BaseTester
-    {
-
-        @Override
-        void runTest(float num)
-        {
-            COSFloat testFloat = new COSFloat(num);
-            assertEquals((long) num, testFloat.longValue());
-        }
-        
-    }
-    
-    @Override
-    public void testLongValue()
-    {
-        new LongValueTester().runTests();
-    }
-
-    class AcceptTester extends BaseTester
-    {
-        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-        COSWriter visitor = new COSWriter(outStream);
-
-        @Override
-        void runTest(float num)
-        {
-            try
-            {
-                COSFloat cosFloat = new COSFloat(num);
-                cosFloat.accept(visitor);
-                assertEquals(floatToString(cosFloat.floatValue()), outStream.toString("ISO-8859-1"));
-                testByteArrays(floatToString(num).getBytes("ISO-8859-1"), outStream.toByteArray());
-                outStream.reset();
-            }
-            catch (IOException e)
-            {
-                fail("Failed to write " + num + " exception: " + e.getMessage());
-            }
-        }
-
-    }
-
-    @Override
-    public void testAccept()
-    {
-        new AcceptTester().runTests();
-    }
-
-    class WritePDFTester extends BaseTester
-    {
-        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-
-        public WritePDFTester()
-        {
-            setLoop(-1000, 3000, 200);
-        }
-
-        @Override
-        void runTest(float num)
-        {
-            try
-            {
-                COSFloat cosFloat = new COSFloat(num);
-                cosFloat.writePDF(outStream);
-                assertEquals(floatToString(cosFloat.floatValue()), outStream.toString("ISO-8859-1"));
-                assertEquals(floatToString(num), outStream.toString("ISO-8859-1"));
-                testByteArrays(floatToString(num).getBytes("ISO-8859-1"), outStream.toByteArray());
-                outStream.reset();
-            }
-            catch (IOException e)
-            {
-                fail("Failed to write " + num + " exception: " + e.getMessage());
-            }
-        }
-
-    }
-
-    /**
-     * Tests writePDF() - this method takes an {@link OutputStream} and writes
-     * this object to it.
-     */
-    public void testWritePDF()
-    {
-        WritePDFTester writePDFTester = new WritePDFTester();
-        writePDFTester.runTests();
-
-        // test a corner case as described in PDFBOX-1778
-        writePDFTester.runTest(0.000000000000000000000000000000001f);
-    }
-
-    private String floatToString(float value)
-    {
-        // use a BigDecimal as intermediate state to avoid 
-        // a floating point string representation of the float value
-        return removeTrailingNull(new BigDecimal(String.valueOf(value)).toPlainString());

-    }
-    
-    private String removeTrailingNull(String value)
-    {
-        // remove fraction digit "0" only
-        if (value.indexOf('.') > -1 && !value.endsWith(".0"))
-        {
-            while (value.endsWith("0") && !value.endsWith(".0"))
-            {
-                value = value.substring(0,value.length()-1);
-            }
-        }
-        return value;
-    }
-
-    /**
-     * This will get the suite of test that this class holds.
-     *
-     * @return All of the tests that this class holds.
-     */
-    public static Test suite()
-    {
-        return new TestSuite(TestCOSFloat.class);
-    }
-}
+/*
+ * 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.
+ */
+
+package org.apache.pdfbox.cos;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.Random;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.pdfbox.pdfwriter.COSWriter;
+
+/**
+ * Tests {@link COSFloat}.
+ */
+public class TestCOSFloat extends TestCOSNumber
+{
+    @Override
+    public void setUp()
+    {
+        try
+        {
+            testCOSBase = COSNumber.get("1.1");
+        }
+        catch (IOException e)
+        {
+            fail("Failed to create a COSNumber in setUp()");
+        }
+    }
+
+    /**
+     * Base class to run looped tests with float numbers.
+     *
+     * To use it, derive a class and just implement runTest(). Then either call
+     * runTests for a series of random and pseudorandom tests, or runTest to
+     * test with corner values.
+     */
+    abstract class BaseTester
+    {
+        private int low = -100000;
+        private int high = 300000;
+        private int step = 20000;
+
+        public void setLoop(int low, int high, int step)
+        {
+            this.low = low;
+            this.high = high;
+            this.step = step;
+        }
+
+        // deterministic and non-deterministic test
+        public void runTests()
+        {
+            // deterministic test
+            loop(123456);
+
+            // non-deterministic test
+            loop(System.currentTimeMillis());
+        }
+
+        // look through a series of pseudorandom tests influenced by a seed
+        private void loop(long seed)
+        {
+            Random rnd = new Random(seed);
+            for (int i = low; i < high; i += step)
+            {
+                float num = i * rnd.nextFloat();
+                try
+                {
+                    runTest(num);
+                }
+                catch (AssertionError a)
+                {
+                    fail("num = " + num + ", seed = " + seed);
+                }
+            }
+        }
+
+        abstract void runTest(float num);
+
+    }
+
+    /**
+     * Tests equals() - ensures that the Object.equals() contract is obeyed.
+     * These are tested over a range of arbitrary values to ensure Consistency,
+     * Reflexivity, Symmetry, Transitivity and non-nullity.
+     */
+    public void testEquals()
+    {
+        new BaseTester()
+        {
+            @Override
+            void runTest(float num)
+            {
+                COSFloat test1 = new COSFloat(num);
+                COSFloat test2 = new COSFloat(num);
+                COSFloat test3 = new COSFloat(num);
+                // Reflexive (x == x)
+                assertTrue(test1.equals(test1));
+                // Symmetric is preserved ( x==y then y==x)
+                assertTrue(test2.equals(test3));
+                assertTrue(test1.equals(test2));
+                // Transitive (if x==y && y==z then x==z)
+                assertTrue(test1.equals(test2));
+                assertTrue(test2.equals(test3));
+                assertTrue(test1.equals(test3));
+
+                float nf = Float.intBitsToFloat(Float.floatToIntBits(num) + 1);
+                COSFloat test4 = new COSFloat(nf);
+                assertFalse(test4.equals(test1));
+            }
+        }.runTests();
+    }
+
+    class HashCodeTester extends BaseTester
+    {
+
+        @Override
+        void runTest(float num)
+        {
+            COSFloat test1 = new COSFloat(num);
+            COSFloat test2 = new COSFloat(num);
+            assertEquals(test1.hashCode(), test2.hashCode());
+
+            float nf = Float.intBitsToFloat(Float.floatToIntBits(num) + 1);
+            COSFloat test3 = new COSFloat(nf);
+            assertFalse(test3.hashCode() == test1.hashCode());
+        }
+    }
+
+    /**
+     * Tests hashCode() - ensures that the Object.hashCode() contract is obeyed
+     * over a range of arbitrary values.
+     */
+    public void testHashCode()
+    {
+        new HashCodeTester().runTests();
+    }
+
+    class FloatValueTester extends BaseTester
+    {
+
+        @Override
+        void runTest(float num)
+        {
+            COSFloat testFloat = new COSFloat(num);
+            assertEquals(num, testFloat.floatValue());
+        }
+
+    }
+
+    @Override
+    public void testFloatValue()
+    {
+        new FloatValueTester().runTests();
+    }
+
+    class DoubleValueTester extends BaseTester
+    {
+
+        @Override
+        void runTest(float num)
+        {
+            COSFloat testFloat = new COSFloat(num);
+            // compare the string representation instead of the numeric values 
+            // as the cast from float to double adds some more fraction digits
+            assertEquals(Float.toString(num), Double.toString(testFloat.doubleValue()));
+        }
+
+    }
+
+    @Override
+    public void testDoubleValue()
+    {
+        new DoubleValueTester().runTests();
+    }
+
+    class IntValueTester extends BaseTester
+    {
+
+        @Override
+        void runTest(float num)
+        {
+            COSFloat testFloat = new COSFloat(num);
+            assertEquals((int) num, testFloat.intValue());
+        }
+
+    }
+
+    @Override
+    public void testIntValue()
+    {
+        new IntValueTester().runTests();
+    }
+
+    class LongValueTester extends BaseTester
+    {
+
+        @Override
+        void runTest(float num)
+        {
+            COSFloat testFloat = new COSFloat(num);
+            assertEquals((long) num, testFloat.longValue());
+        }
+        
+    }
+    
+    @Override
+    public void testLongValue()
+    {
+        new LongValueTester().runTests();
+    }
+
+    class AcceptTester extends BaseTester
+    {
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+        COSWriter visitor = new COSWriter(outStream);
+
+        @Override
+        void runTest(float num)
+        {
+            try
+            {
+                COSFloat cosFloat = new COSFloat(num);
+                cosFloat.accept(visitor);
+                assertEquals(floatToString(cosFloat.floatValue()), outStream.toString("ISO-8859-1"));
+                testByteArrays(floatToString(num).getBytes("ISO-8859-1"), outStream.toByteArray());
+                outStream.reset();
+            }
+            catch (IOException e)
+            {
+                fail("Failed to write " + num + " exception: " + e.getMessage());
+            }
+        }
+
+    }
+
+    @Override
+    public void testAccept()
+    {
+        new AcceptTester().runTests();
+    }
+
+    class WritePDFTester extends BaseTester
+    {
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+
+        public WritePDFTester()
+        {
+            setLoop(-1000, 3000, 200);
+        }
+
+        @Override
+        void runTest(float num)
+        {
+            try
+            {
+                COSFloat cosFloat = new COSFloat(num);
+                cosFloat.writePDF(outStream);
+                assertEquals(floatToString(cosFloat.floatValue()), outStream.toString("ISO-8859-1"));
+                assertEquals(floatToString(num), outStream.toString("ISO-8859-1"));
+                testByteArrays(floatToString(num).getBytes("ISO-8859-1"), outStream.toByteArray());
+                outStream.reset();
+            }
+            catch (IOException e)
+            {
+                fail("Failed to write " + num + " exception: " + e.getMessage());
+            }
+        }
+
+    }
+
+    /**
+     * Tests writePDF() - this method takes an {@link java.io.OutputStream} and writes
+     * this object to it.
+     */
+    public void testWritePDF()
+    {
+        WritePDFTester writePDFTester = new WritePDFTester();
+        writePDFTester.runTests();
+
+        // test a corner case as described in PDFBOX-1778
+        writePDFTester.runTest(0.000000000000000000000000000000001f);
+    }
+
+    private String floatToString(float value)
+    {
+        // use a BigDecimal as intermediate state to avoid 
+        // a floating point string representation of the float value
+        return removeTrailingNull(new BigDecimal(String.valueOf(value)).toPlainString());

+    }
+    
+    private String removeTrailingNull(String value)
+    {
+        // remove fraction digit "0" only
+        if (value.indexOf('.') > -1 && !value.endsWith(".0"))
+        {
+            while (value.endsWith("0") && !value.endsWith(".0"))
+            {
+                value = value.substring(0,value.length()-1);
+            }
+        }
+        return value;
+    }
+
+    /**
+     * This will get the suite of test that this class holds.
+     *
+     * @return All of the tests that this class holds.
+     */
+    public static Test suite()
+    {
+        return new TestSuite(TestCOSFloat.class);
+    }
+}

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java Thu
Sep 15 17:55:03 2016
@@ -152,7 +152,7 @@ public class TestCOSInteger extends Test
     }
 
     /**
-     * Tests writePDF() - this method takes an {@link OutputStream} and writes this object
to it.
+     * Tests writePDF() - this method takes an {@link java.io.OutputStream} and writes this
object to it.
      */
     public void testWritePDF()
     {
@@ -184,4 +184,4 @@ public class TestCOSInteger extends Test
     {
         return new TestSuite(TestCOSInteger.class);
     }
-}
\ No newline at end of file
+}

Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java
(original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/BookmarkValidationProcess.java
Thu Sep 15 17:55:03 2016
@@ -292,7 +292,7 @@ public class BookmarkValidationProcess e
     /**
      * Returns a COSBase as a COSObject or null if null or COSNull. To avoid
      * trouble, this method is to be called only after having called
-     * {@link #checkIndirectObjects()}.
+     * {@link #checkIndirectObjects(PreflightContext, COSDictionary)}.
      *
      * @param base should be null, COSNull or a COSObject.
      * @return null if the parameter is COSNull or null; or else a COSObject.

Modified: pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java (original)
+++ pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java Thu
Sep 15 17:55:03 2016
@@ -57,7 +57,7 @@ public class XMPSchemaTest
     /**
      * Check if Bag (Unordered Array) management is ok
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      */
     @Test
     public void testBagManagement() throws Exception
@@ -99,8 +99,8 @@ public class XMPSchemaTest
     /**
      * Check if Seq (Ordered Array) management is ok
      * 
-     * @throws InappropriateTypeException
-     * @throws IOException
+     * @throws IllegalArgumentException
+     * @throws java.io.IOException
      */
     @Test
     public void testSeqManagement() throws Exception
@@ -235,7 +235,7 @@ public class XMPSchemaTest
     /**
      * Test All common simple properties management in XMPSchema
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      * @throws BadFieldValueException
      */
     @Test
@@ -380,8 +380,8 @@ public class XMPSchemaTest
     /**
      * check if merging is ok
      * 
-     * @throws InappropriateTypeException
-     * @throws IOException
+     * @throws IllegalArgumentException
+     * @throws java.io.IOException
      */
     @Test
     public void testMergeSchema() throws Exception

Modified: pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java?rev=1760965&r1=1760964&r2=1760965&view=diff
==============================================================================
--- pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java
(original)
+++ pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java
Thu Sep 15 17:55:03 2016
@@ -49,7 +49,7 @@ public class TestSimpleMetadataPropertie
     /**
      * Check the detection of a bad type
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      */
     @Test(expected = IllegalArgumentException.class)
     public void testBooleanBadTypeDetection()
@@ -60,7 +60,7 @@ public class TestSimpleMetadataPropertie
     /**
      * Check the detection of a bad type
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      */
     @Test(expected = IllegalArgumentException.class)
     public void testDateBadTypeDetection()
@@ -71,7 +71,7 @@ public class TestSimpleMetadataPropertie
     /**
      * Check the detection of a bad type
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      */
     @Test(expected = IllegalArgumentException.class)
     public void testIntegerBadTypeDetection()
@@ -82,7 +82,7 @@ public class TestSimpleMetadataPropertie
     /**
      * Check the detection of a bad type
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      */
     @Test(expected = IllegalArgumentException.class)
     public void testRealBadTypeDetection() throws Exception
@@ -93,7 +93,7 @@ public class TestSimpleMetadataPropertie
     /**
      * Check the detection of a bad type
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      */
     @Test(expected = IllegalArgumentException.class)
     public void testTextBadTypeDetection() throws Exception
@@ -179,9 +179,9 @@ public class TestSimpleMetadataPropertie
     }
 
     /**
-     * Throw InappropriateType Exception
+     * Throw IllegalArgumentException
      * 
-     * @throws InappropriateTypeException
+     * @throws IllegalArgumentException
      */
     @Test(expected = IllegalArgumentException.class)
     public void testExceptionWithCause() throws Exception



Mime
View raw message