Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D4A5218BA0 for ; Tue, 11 Aug 2015 17:55:38 +0000 (UTC) Received: (qmail 13922 invoked by uid 500); 11 Aug 2015 17:55:22 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 13899 invoked by uid 500); 11 Aug 2015 17:55:22 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 13886 invoked by uid 99); 11 Aug 2015 17:55:22 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2015 17:55:22 +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 03069C0DF9 for ; Tue, 11 Aug 2015 17:55:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1 X-Spam-Level: * X-Spam-Status: No, score=1 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id EemZxvKmkCyn for ; Tue, 11 Aug 2015 17:55:21 +0000 (UTC) Received: from us-smtp-delivery-105.mimecast.com (us-smtp-delivery-105.mimecast.com [216.205.24.105]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id A360C20CFF for ; Tue, 11 Aug 2015 17:55:20 +0000 (UTC) Received: from hubca1.pgac.com (email.pgac.com [12.68.231.192]) (Using TLS) by us-smtp-1.mimecast.com with ESMTP id us-mta-11-txALjcLlQNKGMF8OLeJ9Fw-7; Tue, 11 Aug 2015 13:55:12 -0400 Received: from EX07MAIL3.pgac.com ([172.23.10.5]) by hubca1.pgac.com ([172.23.10.3]) with mapi; Tue, 11 Aug 2015 12:55:09 -0500 From: Kevin Ternes To: "users@pdfbox.apache.org" Date: Tue, 11 Aug 2015 12:55:08 -0500 Subject: RE: NullPointerException from PDDocument Thread-Topic: NullPointerException from PDDocument Thread-Index: AdDUXh/AIv/gyfQASHy254NnGFajbgAADCDQ Message-ID: References: <55C52AEB.5060208@t-online.de> <55CA344C.3090004@t-online.de> In-Reply-To: <55CA344C.3090004@t-online.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-MC-Unique: txALjcLlQNKGMF8OLeJ9Fw-7 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable That's why I always travel to Europe when I go on vacation. -----Original Message----- From: Tilman Hausherr [mailto:THausherr@t-online.de]=20 Sent: Tuesday, August 11, 2015 12:44 PM To: users@pdfbox.apache.org Subject: Re: NullPointerException from PDDocument We'd probably put some messages everywhere.... please accept that if you do= illegal things, mayhem will follow :-) Tilman > > -----Original Message----- > From: Tilman Hausherr [mailto:THausherr@t-online.de] > Sent: Friday, August 07, 2015 5:02 PM > To: users@pdfbox.apache.org > Subject: Re: NullPointerException from PDDocument > > Can you upload the document somewhere? > > Tilman > > Am 07.08.2015 um 23:56 schrieb Kevin Ternes: >> I have a particular PDF that I have loaded that throws a NullPointerExce= ption from PDDocument.getDocumentCatalog(). >> From PDDocument: >> >> public PDDocumentCatalog getDocumentCatalog() { >> If (documentCatalog =3D=3D null) >> { >> COSDictionary trailer =3D document.getTrailer(); >> COSBase dictionary =3D trailer.getDictionaryObject( COSNam= e.ROOT ); >> if (dictionary instanceof COSDictionary) >> { >> documentCatalog =3D new PDDocumentCatalog(this, (COSDi= ctionary) dictionary); >> } >> else >> { >> documentCatalog =3D new PDDocumentCatalog(this); >> } >> } >> return documentCatalog; >> } >> >> The document.getTrailer() returns NULL for this PDF and thus the NullPoi= nterException from the next line. >> >> Is it possible that the PDF is malformed? >> I do not see where I might have cleared the document.trailer field. >> >> If any PDFBox developers are listening, would it be reasonable to put a = check into the above code to deal with the NULL document.trailer? >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org For additional commands, e-mail: users-help@pdfbox.apache.org