Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D3749177F3 for ; Thu, 19 Mar 2015 22:14:01 +0000 (UTC) Received: (qmail 99502 invoked by uid 500); 19 Mar 2015 22:14:01 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 99485 invoked by uid 500); 19 Mar 2015 22:14:01 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 99475 invoked by uid 99); 19 Mar 2015 22:14:01 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Mar 2015 22:14:01 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 92D32AC0155 for ; Thu, 19 Mar 2015 22:14:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@pdfbox.apache.org From: msahyoun@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150319221401.92D32AC0155@hades.apache.org> 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