pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From talli...@apache.org
Subject svn commit: r1853034 - in /pdfbox/branches/2.0/pdfbox: ./ src/test/java/org/apache/pdfbox/multipdf/ src/test/java/org/apache/pdfbox/pdmodel/interactive/form/
Date Tue, 05 Feb 2019 20:05:27 GMT
Author: tallison
Date: Tue Feb  5 20:05:27 2019
New Revision: 1853034

URL: http://svn.apache.org/viewvc?rev=1853034&view=rev
Log:
PDFBOX-4388 -- convert unit tests relying on URL#openStream() to wget

Modified:
    pdfbox/branches/2.0/pdfbox/pom.xml
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java

Modified: pdfbox/branches/2.0/pdfbox/pom.xml
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/pom.xml?rev=1853034&r1=1853033&r2=1853034&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/pom.xml (original)
+++ pdfbox/branches/2.0/pdfbox/pom.xml Tue Feb  5 20:05:27 2019
@@ -186,6 +186,84 @@
                 <artifactId>download-maven-plugin</artifactId>
                 <executions>
                     <execution>
+                        <id>PDFBOX-1031-1</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12481683/1.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-1031-1.pdf</outputFileName>
+                            <sha512>f943df43cc2a6929caa484c79eafa44b06a5902e325139e19e1f1ebda7c5fd0c86cc221311659d68351c0ff56d921350ff61e97b9d2c425180d810842c963a5b</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>PDFBOX-1031-2</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12481684/2.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-1031-2.pdf</outputFileName>
+                            <sha512>8a9e836ad77c3e9e1e75476f4b46ff4b8958c099970bf57a0b4789fd37236b2bed7e1f14909fa0e3bbacf1a867c1a5c56cbe293383275c1b9c6c0396bec51085</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>PDFBOX-1065-1</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12486525/1_testfile1.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-1065-1.pdf</outputFileName>
+                            <sha512>6b44f363653a9c0cba049495d0ed67659f98b2622b25d647ae556dc4a708847f6c3e4428aa5de2fa0d67f5e8ba08183abf9e8e640e474c6b00c544782e3bba3e</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>PDFBOX-1065-2</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12486526/2_testfile1.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-1065-2.pdf</outputFileName>
+                            <sha512>3b19a2a4c35fbacb36774553bedc0b3f2caf60d96aa021a9151d1f18a248577f13229f101ed7ed4375f36b9f481c0488ceb5ac00e4669d6802cd7cee1b0b4ad7</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>PDFBOX-1100-1</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12490774/a.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-1100-1.pdf</outputFileName>
+                            <sha512>9e59c8eb5cde5823a78e8e773bab393ab52eb5ac3f3a576b5d665d0267dca9c677abe08bb3b503a8ebf43479b4e6f61725ad85affd95803e12009c0b1919111a</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>PDFBOX-1100-2</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12490775/b.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-1100-2.pdf</outputFileName>
+                            <sha512>f55ec23a9b7350410eef95e6bd6de3c3605fa3dc2e9f9c28dfd2f6007bd693da252787350ad6d1d49570ee07fbbfcaba1f8638c1d7e63d4a8875f44c39867e6f</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>PDFBOX-3208</id>
                         <phase>generate-test-resources</phase>
                         <goals>
@@ -198,6 +276,32 @@
                         </configuration>
                     </execution>
                     <execution>
+                        <id>PDFBOX-3656</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-3656.pdf</outputFileName>
+                            <sha512>031d958a84cbd9eb520e5af308f635b37c48b77f7df4e43ecbcdabd04f4ba8574fac71b62548594b0f26e9e4e7fa3c1c7679d66c2a8e4bf141157fb6e50df97d</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>PDFBOX-3682</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <url>https://issues.apache.org/jira/secure/attachment/12852207/test.pdf</url>
+                            <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+                            <outputFileName>PDFBOX-3682.pdf</outputFileName>
+                            <sha512>b57628fc15898c1fbd5947c93659aa40b34071a2e8cf04e46ff787cb01687668456e59a13c3fba8b56ab0ef76c933408b3b0f3a781990bfd475cd8fa4325d730</sha512>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>PDFBOX-3940</id>
                         <phase>generate-test-resources</phase>
                         <goals>

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java?rev=1853034&r1=1853033&r2=1853034&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java
Tue Feb  5 20:05:27 2019
@@ -20,11 +20,13 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.io.IOUtils;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.pdmodel.interactive.form.PDField;
@@ -39,6 +41,7 @@ import org.junit.Test;
 public class MergeAcroFormsTest
 {
     private static final File OUT_DIR = new File("target/test-output/merge/");
+    private static final File TARGET_PDF_DIR = new File("target/pdfs");
 
     @Before
     public void setUp()
@@ -51,32 +54,39 @@ public class MergeAcroFormsTest
      */
     @Test
     public void testAnnotsEntry() throws IOException {
-        
+
+        InputStream s1 = null;
+        InputStream s2 = null;
         // Merge the PDFs form PDFBOX-1031
         PDFMergerUtility merger = new PDFMergerUtility();
-        
-        URL url1 = new URL("https://issues.apache.org/jira/secure/attachment/12481683/1.pdf");
-        InputStream is1 = url1.openStream();
-
-        URL url2 = new URL("https://issues.apache.org/jira/secure/attachment/12481684/2.pdf");
-        InputStream is2 = url2.openStream();
-        File pdfOutput = new File(OUT_DIR,"PDFBOX-1031.pdf");
-        merger.setDestinationFileName(pdfOutput.getAbsolutePath());
-        merger.addSource(is1);
-        merger.addSource(is2);
-        merger.mergeDocuments(null);
-        
-        // Test merge result
-        PDDocument mergedPDF = PDDocument.load(pdfOutput);
-        assertEquals("There shall be 2 pages", 2, mergedPDF.getNumberOfPages());
-        
-        assertNotNull("There shall be an /Annots entry for the first page", mergedPDF.getPage(0).getCOSObject().getDictionaryObject(COSName.ANNOTS));
-        assertEquals("There shall be 1 annotation for the first page", 1, mergedPDF.getPage(0).getAnnotations().size());
-        
-        assertNotNull("There shall be an /Annots entry for the second page", mergedPDF.getPage(1).getCOSObject().getDictionaryObject(COSName.ANNOTS));
-        assertEquals("There shall be 1 annotation for the second page", 1, mergedPDF.getPage(0).getAnnotations().size());
-
-        mergedPDF.close();
+        try {
+            File f1 = new File(TARGET_PDF_DIR, "PDFBOX-1031-1.pdf");
+            s1 = new FileInputStream(f1);
+
+            File f2 = new File(TARGET_PDF_DIR, "PDFBOX-1031-2.pdf");
+            s2 = new FileInputStream(f2);
+
+            File pdfOutput = new File(OUT_DIR, "PDFBOX-1031.pdf");
+            merger.setDestinationFileName(pdfOutput.getAbsolutePath());
+            merger.addSource(s1);
+            merger.addSource(s2);
+            merger.mergeDocuments(null);
+
+            // Test merge result
+            PDDocument mergedPDF = PDDocument.load(pdfOutput);
+            assertEquals("There shall be 2 pages", 2, mergedPDF.getNumberOfPages());
+
+            assertNotNull("There shall be an /Annots entry for the first page", mergedPDF.getPage(0).getCOSObject().getDictionaryObject(COSName.ANNOTS));
+            assertEquals("There shall be 1 annotation for the first page", 1, mergedPDF.getPage(0).getAnnotations().size());
+
+            assertNotNull("There shall be an /Annots entry for the second page", mergedPDF.getPage(1).getCOSObject().getDictionaryObject(COSName.ANNOTS));
+            assertEquals("There shall be 1 annotation for the second page", 1, mergedPDF.getPage(0).getAnnotations().size());
+
+            mergedPDF.close();
+        } finally {
+            IOUtils.closeQuietly(s1);
+            IOUtils.closeQuietly(s2);
+        }
     }
     
     /*
@@ -84,35 +94,42 @@ public class MergeAcroFormsTest
      */
     @Test
     public void testAPEntry() throws IOException {
-        
+
+        InputStream is1 = null;
+        InputStream is2 = null;
         // Merge the PDFs form PDFBOX-1100
         PDFMergerUtility merger = new PDFMergerUtility();
-        
-        URL url1 = new URL("https://issues.apache.org/jira/secure/attachment/12490774/a.pdf");
-        InputStream is1 = url1.openStream();
-
-        URL url2 = new URL("https://issues.apache.org/jira/secure/attachment/12490775/b.pdf");
-        InputStream is2 = url2.openStream();
-        File pdfOutput = new File(OUT_DIR,"PDFBOX-1100.pdf");
-        merger.setDestinationFileName(pdfOutput.getAbsolutePath());
-        merger.addSource(is1);
-        merger.addSource(is2);
-        merger.mergeDocuments(null);
-        
-        // Test merge result
-        PDDocument mergedPDF = PDDocument.load(pdfOutput);
-        assertEquals("There shall be 2 pages", 2, mergedPDF.getNumberOfPages());
-        
-        PDAcroForm acroForm = mergedPDF.getDocumentCatalog().getAcroForm();
-        
-        PDField formField = acroForm.getField("Testfeld");
-        assertNotNull("There shall be an /AP entry for the field", formField.getCOSObject().getDictionaryObject(COSName.AP));
-        assertNotNull("There shall be a /V entry for the field", formField.getCOSObject().getDictionaryObject(COSName.V));
-
-        formField = acroForm.getField("Testfeld2");
-        assertNotNull("There shall be an /AP entry for the field", formField.getCOSObject().getDictionaryObject(COSName.AP));
-        assertNotNull("There shall be a /V entry for the field", formField.getCOSObject().getDictionaryObject(COSName.V));
 
-        mergedPDF.close();
+        try {
+            File file1 = new File(TARGET_PDF_DIR, "PDFBOX-1100-1.pdf");
+            is1 = new FileInputStream(file1);
+
+            File file2 = new File(TARGET_PDF_DIR, "PDFBOX-1100-2.pdf");
+            is2 = new FileInputStream(file2);
+            File pdfOutput = new File(OUT_DIR, "PDFBOX-1100.pdf");
+            merger.setDestinationFileName(pdfOutput.getAbsolutePath());
+            merger.addSource(is1);
+            merger.addSource(is2);
+            merger.mergeDocuments(null);
+
+            // Test merge result
+            PDDocument mergedPDF = PDDocument.load(pdfOutput);
+            assertEquals("There shall be 2 pages", 2, mergedPDF.getNumberOfPages());
+
+            PDAcroForm acroForm = mergedPDF.getDocumentCatalog().getAcroForm();
+
+            PDField formField = acroForm.getField("Testfeld");
+            assertNotNull("There shall be an /AP entry for the field", formField.getCOSObject().getDictionaryObject(COSName.AP));
+            assertNotNull("There shall be a /V entry for the field", formField.getCOSObject().getDictionaryObject(COSName.V));
+
+            formField = acroForm.getField("Testfeld2");
+            assertNotNull("There shall be an /AP entry for the field", formField.getCOSObject().getDictionaryObject(COSName.AP));
+            assertNotNull("There shall be a /V entry for the field", formField.getCOSObject().getDictionaryObject(COSName.V));
+
+            mergedPDF.close();
+        } finally {
+            IOUtils.closeQuietly(is1);
+            IOUtils.closeQuietly(is2);
+        }
     }
 }

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java?rev=1853034&r1=1853033&r2=1853034&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java
Tue Feb  5 20:05:27 2019
@@ -20,14 +20,15 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.io.IOUtils;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocumentNameDestinationDictionary;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
@@ -40,6 +41,7 @@ import org.junit.Test;
 public class MergeAnnotationsTest
 {
     private static final File OUT_DIR = new File("target/test-output/merge/");
+    private static final File TARGET_PDF_DIR = new File("target/pdfs");
 
     @Before
     public void setUp()
@@ -56,45 +58,51 @@ public class MergeAnnotationsTest
         
         // Merge the PDFs from PDFBOX-1065
         PDFMergerUtility merger = new PDFMergerUtility();
-        
-        URL url1 = new URL("https://issues.apache.org/jira/secure/attachment/12486525/1_testfile1.pdf");
-        InputStream is1 = url1.openStream();
+        InputStream is1 = null;
+        InputStream is2 = null;
 
-        URL url2 = new URL("https://issues.apache.org/jira/secure/attachment/12486526/2_testfile1.pdf");
-        InputStream is2 = url2.openStream();
-        File pdfOutput = new File(OUT_DIR,"PDFBOX-1065.pdf");
-        merger.setDestinationFileName(pdfOutput.getAbsolutePath());
-        merger.addSource(is1);
-        merger.addSource(is2);
-        merger.mergeDocuments(null);
-        
-        // Test merge result
-        PDDocument mergedPDF = PDDocument.load(pdfOutput);
-        assertEquals("There shall be 6 pages", 6, mergedPDF.getNumberOfPages());
-        
-        PDDocumentNameDestinationDictionary destinations = mergedPDF.getDocumentCatalog().getDests();
-        
-        // Each document has 3 annotations with 2 entries in the /Dests dictionary per annotation.
One for the
-        // source and one for the target.
-        assertEquals("There shall be 12 entries", 12, destinations.getCOSObject().entrySet().size());
-        
-        List<PDAnnotation> sourceAnnotations01 = mergedPDF.getPage(0).getAnnotations();
-        List<PDAnnotation> sourceAnnotations02 = mergedPDF.getPage(3).getAnnotations();
-        
-        List<PDAnnotation> targetAnnotations01 = mergedPDF.getPage(2).getAnnotations();
-        List<PDAnnotation> targetAnnotations02 = mergedPDF.getPage(5).getAnnotations();
-        
-        // Test for the first set of annotations to be merged an linked correctly
-        assertEquals("There shall be 3 source annotations at the first page", 3, sourceAnnotations01.size());
-        assertEquals("There shall be 3 source annotations at the third page", 3, targetAnnotations01.size());
-        assertTrue("The annotations shall match to each other", testAnnotationsMatch(sourceAnnotations01,
targetAnnotations01));
-
-        // Test for the second set of annotations to be merged an linked correctly
-        assertEquals("There shall be 3 source annotations at the first page", 3, sourceAnnotations02.size());
-        assertEquals("There shall be 3 source annotations at the third page", 3, targetAnnotations02.size());
-        assertTrue("The annotations shall match to each other", testAnnotationsMatch(sourceAnnotations02,
targetAnnotations02));
-        
-        mergedPDF.close();
+        try {
+            File file1 = new File(TARGET_PDF_DIR, "PDFBOX-1065-1.pdf");
+            is1 = new FileInputStream(file1);
+
+            File file2 = new File(TARGET_PDF_DIR, "PDFBOX-1065-2.pdf");
+            is2 = new FileInputStream(file2);
+            File pdfOutput = new File(OUT_DIR, "PDFBOX-1065.pdf");
+            merger.setDestinationFileName(pdfOutput.getAbsolutePath());
+            merger.addSource(is1);
+            merger.addSource(is2);
+            merger.mergeDocuments(null);
+
+            // Test merge result
+            PDDocument mergedPDF = PDDocument.load(pdfOutput);
+            assertEquals("There shall be 6 pages", 6, mergedPDF.getNumberOfPages());
+
+            PDDocumentNameDestinationDictionary destinations = mergedPDF.getDocumentCatalog().getDests();
+
+            // Each document has 3 annotations with 2 entries in the /Dests dictionary per
annotation. One for the
+            // source and one for the target.
+            assertEquals("There shall be 12 entries", 12, destinations.getCOSObject().entrySet().size());
+
+            List<PDAnnotation> sourceAnnotations01 = mergedPDF.getPage(0).getAnnotations();
+            List<PDAnnotation> sourceAnnotations02 = mergedPDF.getPage(3).getAnnotations();
+
+            List<PDAnnotation> targetAnnotations01 = mergedPDF.getPage(2).getAnnotations();
+            List<PDAnnotation> targetAnnotations02 = mergedPDF.getPage(5).getAnnotations();
+
+            // Test for the first set of annotations to be merged an linked correctly
+            assertEquals("There shall be 3 source annotations at the first page", 3, sourceAnnotations01.size());
+            assertEquals("There shall be 3 source annotations at the third page", 3, targetAnnotations01.size());
+            assertTrue("The annotations shall match to each other", testAnnotationsMatch(sourceAnnotations01,
targetAnnotations01));
+
+            // Test for the second set of annotations to be merged an linked correctly
+            assertEquals("There shall be 3 source annotations at the first page", 3, sourceAnnotations02.size());
+            assertEquals("There shall be 3 source annotations at the third page", 3, targetAnnotations02.size());
+            assertTrue("The annotations shall match to each other", testAnnotationsMatch(sourceAnnotations02,
targetAnnotations02));
+            mergedPDF.close();
+        } finally {
+            IOUtils.closeQuietly(is1);
+            IOUtils.closeQuietly(is2);
+        }
     }    
 
     /*

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java?rev=1853034&r1=1853033&r2=1853034&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
Tue Feb  5 20:05:27 2019
@@ -41,11 +41,11 @@ import org.junit.Test;
  */
 public class PDButtonTest
 {
-    
-    
+
     private static final File IN_DIR = new File("src/test/resources/org/apache/pdfbox/pdmodel/interactive/form");
     private static final String NAME_OF_PDF = "AcroFormsBasicFields.pdf";
-    
+    private static final File TARGET_PDF_DIR = new File("target/pdfs");
+
     private PDDocument document;
     private PDAcroForm acroForm;
 
@@ -108,15 +108,14 @@ public class PDButtonTest
      */
     public void testRadioButtonWithOptions()
     {
-        URL url;
+        File file;
         PDDocument pdfDocument = null;
         
         try
         {
-            url = new URL("https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf");
-            InputStream is = url.openStream();
+            file = new File(TARGET_PDF_DIR, "PDFBOX-3656.pdf");
             
-            pdfDocument = PDDocument.load(is);
+            pdfDocument = PDDocument.load(file);
             
             PDRadioButton radioButton = (PDRadioButton) pdfDocument.getDocumentCatalog().getAcroForm().getField("Checking/Savings");
             radioButton.setValue("Off");
@@ -158,15 +157,14 @@ public class PDButtonTest
      */
     public void testOptionsAndNamesNotNumbers()
     {
-        URL url;
+        File file;
         PDDocument pdfDocument = null;
         
         try
         {
-            url = new URL("https://issues.apache.org/jira/secure/attachment/12852207/test.pdf");
-            InputStream is = url.openStream();
-            
-            pdfDocument = PDDocument.load(is);
+            file = new File(TARGET_PDF_DIR, "PDFBOX-3682.pdf");
+
+            pdfDocument = PDDocument.load(file);
             
             pdfDocument.getDocumentCatalog().getAcroForm().getField("RadioButton").setValue("c");
             PDRadioButton radioButton = (PDRadioButton) pdfDocument.getDocumentCatalog().getAcroForm().getField("RadioButton");



Mime
View raw message