Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A4925200BA3 for ; Thu, 20 Oct 2016 20:10:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A36B3160AE0; Thu, 20 Oct 2016 18:10:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EBEB5160ACC for ; Thu, 20 Oct 2016 20:10:28 +0200 (CEST) Received: (qmail 46599 invoked by uid 500); 20 Oct 2016 18:10:28 -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 46590 invoked by uid 99); 20 Oct 2016 18:10:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Oct 2016 18:10:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id A9D45C0C69 for ; Thu, 20 Oct 2016 18:10:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 98kNz1UYtxrn for ; Thu, 20 Oct 2016 18:10:27 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id DDDDE5F59E for ; Thu, 20 Oct 2016 18:10:26 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5B4DDE0339 for ; Thu, 20 Oct 2016 18:10:26 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 573873A0D2A for ; Thu, 20 Oct 2016 18:10:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1765855 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java Date: Thu, 20 Oct 2016 18:10:26 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161020181026.573873A0D2A@svn01-us-west.apache.org> archived-at: Thu, 20 Oct 2016 18:10:29 -0000 Author: tilman Date: Thu Oct 20 18:10:26 2016 New Revision: 1765855 URL: http://svn.apache.org/viewvc?rev=1765855&view=rev Log: PDFBOX-2852: avoid potential ClassCastException Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java?rev=1765855&r1=1765854&r2=1765855&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java Thu Oct 20 18:10:26 2016 @@ -17,6 +17,7 @@ package org.apache.pdfbox.pdmodel.interactive.form; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -113,11 +114,10 @@ final class PDFieldFactory String retval = dic.getNameAsString(COSName.FT); if (retval == null) { - COSDictionary parent = (COSDictionary) dic.getDictionaryObject(COSName.PARENT, - COSName.P); - if (parent != null) + COSBase base = dic.getDictionaryObject(COSName.PARENT, COSName.P); + if (base instanceof COSDictionary) { - retval = findFieldType(parent); + retval = findFieldType((COSDictionary) base); } } return retval;