pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1667889 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java
Date Thu, 19 Mar 2015 22:14:01 GMT
Author: msahyoun
Date: Thu Mar 19 22:14:00 2015
New Revision: 1667889

URL: http://svn.apache.org/r1667889
Log:
PDFBOX-2717 remove no longer needed code to set widget type and subtype

Added:
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java
  (with props)
Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java?rev=1667889&r1=1667888&r2=1667889&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
Thu Mar 19 22:14:00 2015
@@ -19,7 +19,6 @@ package org.apache.pdfbox.pdmodel.intera
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
 import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSeedValue;
 import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
 
@@ -46,9 +45,6 @@ public class PDSignatureField extends PD
     public PDSignatureField(PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode
parentNode)
     {
         super(theAcroForm, field, parentNode);
-        // dirty hack to avoid npe caused through getWidget() method
-        getDictionary().setItem( COSName.TYPE, COSName.ANNOT );
-        getDictionary().setName( COSName.SUBTYPE, PDAnnotationWidget.SUB_TYPE);
     }
 
     /**
@@ -65,8 +61,6 @@ public class PDSignatureField extends PD
         getWidget().setLocked(true);
         getWidget().setPrinted(true);
         setPartialName(generatePartialName());
-        getDictionary().setItem( COSName.TYPE, COSName.ANNOT );
-        getDictionary().setName( COSName.SUBTYPE, PDAnnotationWidget.SUB_TYPE);
     }
     
     /**

Added: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java?rev=1667889&view=auto
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java
(added)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java
Thu Mar 19 22:14:00 2015
@@ -0,0 +1,53 @@
+/*
+ * 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.pdmodel.interactive.form;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test for the PDAnnotation classes.
+ *
+ */
+public class PDSignatureFieldTest
+{
+    private PDDocument document;
+    private PDAcroForm acroForm;
+
+    @Before
+    public void setUp()
+    {
+        document = new PDDocument();
+        acroForm = new PDAcroForm(document);
+    }
+
+    @Test
+    public void createDefaultSignatureField() throws IOException
+    {
+        PDSignatureField sigField = new PDSignatureField(acroForm);
+        assertEquals(COSName.ANNOT, sigField.getDictionary().getItem(COSName.TYPE));
+        assertEquals(PDAnnotationWidget.SUB_TYPE, sigField.getDictionary().getNameAsString(COSName.SUBTYPE));
+    }
+}

Propchange: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureFieldTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message