pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Sometimes I get a NullPointerException while saving the output
Date Thu, 04 Sep 2014 21:54:46 GMT
If it happens always with a file, please open an issue with JIRA. Make 
sure you are using the latest version (1.8.7), and attach the shortest 
possible code that reproduces the problem and of course one or more PDFs.

Please try also the snapshot 1.8.7 version
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/


Tilman

Am 04.09.2014 09:11, schrieb markus.sticker.epos@zf.com:
> No it isn't multithreaded.
> And there is no other process on that file.
>
> It happens with some files, maybe it deppends on the size.
> I'm not able to locate the reason.
>
> My Sample.PDF has 588,822  bytes
> My Test.PDF is about 11,748,062  bytes
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Tilman Hausherr [mailto:THausherr@t-online.de]
> Gesendet: Mittwoch, 3. September 2014 20:33
> An: users@pdfbox.apache.org
> Betreff: Re: Sometimes I get a NullPointerException while saving the output
>
> Do you have a multithreaded environment?
>
> Does it happen "sometimes" as "with some files" or "sometimes" with the same files?
>
> Tilman
>
> Am 03.09.2014 14:38, schrieb markus.sticker.epos@zf.com:
>> Hello,
>>
>> I've got an exception while trying to save a file.
>> Exception in thread "main" java.lang.NullPointerException
>>          at org.apache.pdfbox.io.RandomAccessFileInputStream.read(RandomAccessFileInputStream.java:94)
>>          at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
>>          at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
>>          at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
>>          at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:1232)
>>          at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:257)
>>          at org.apache.pdfbox.cos.COSObject.accept(COSObject.java:204)
>>          at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:541)
>>          at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:449)
>>          at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:1102)
>>          at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:568)
>>          at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1367)
>>          at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1236)
>>          at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1214)
>>          at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1202)
>>          at com.zf.swdoku.pdfmerger.Processing.combinePdf(Processing.java:61)
>>          at com.zf.swdoku.pdfmerger.Processing.run(Processing.java:43)
>>          at com.zf.swdoku.pdfmerger.Processing.<init>(Processing.java:36)
>>          at com.zf.swdoku.pdfpostprocess.Run.main(Run.java:81)
>>
>> this is a part of my implemention:
>>
>>          private void combinePdf() throws IOException {
>>                PDDocument sourcePDFDocument = brandedPdf;
>>                OverlayPDF overlay = new OverlayPDF();
>>                overlay.setSourcePDFDocument(sourcePDFDocument);
>>                overlay.setFirstPageOverlay(substitutedTextPdfTitle);
>>                overlay.setFollowerPageOverlay(substitutedTextPdfFollow);
>>                overlay.setStartPage(config.getStartPageFollower());
>>                overlay.setOverlayPosition("foreground");
>>                overlay.processPages();
>>                if (overlay.getSourcePDFDocument().getDocument() == null)
>>                       System.out.println("Nix wars");
>>
>>                // overlay.getSourcePDFDocument().save(outputFile);
>>
>>                overlay.getSourcePDFDocument().save(outputFile);
>>                overlay.getSourcePDFDocument().getDocument().close();
>>                overlay.getSourcePDFDocument().close();
>>
>>          }
>>
>>
>> Please give me an idea why this happens sometimes.
>> Thanks.
>> Mit freundlichen Grüßen/Kind regards
>> Markus Sticker
>> Forschung und Entwicklung ZF Konzern/Research and Development ZF Group
>> Infrastruktur/Infrastructure (DTEP4) ZF Friedrichshafen AG
>> 88038 Friedrichshafen, Deutschland/Germany Telefon/Phone  +49 7541
>> 77-7644, Telefax/Fax  +49 7541 77-907644
>> Markus.Sticker.Epos@zf.com<mailto:Markus.Sticker.Epos@zf.com>
>>
>> Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board:
>> Prof. Dr. Giorgio Behr Vorstand/Board of Management: Dr. Stefan Sommer
>> (Vorsitzender/CEO), Dr. Konstantin Sauer, Jürgen Holeksa, Michael
>> Hankel, Wilhelm Rehm, Rolf Lutz
>> Sitz/Headquarters: Friedrichshafen
>> Handelsregistereintrag Amtsgericht Ulm HRB 630206/Trade register of
>> the municipal court of Ulm HRB 630206
>>
>>


Mime
View raw message