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 Wed, 03 Sep 2014 18:33:05 GMT
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