You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2015/01/30 09:26:34 UTC

[jira] [Commented] (PDFBOX-2644) Load FDF document creates Temp file when called with file parameter

    [ https://issues.apache.org/jira/browse/PDFBOX-2644?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14298360#comment-14298360 ] 

Andreas Lehmkühler commented on PDFBOX-2644:
--------------------------------------------

[~tilman]You're right, the contructor could be used instead of the current implementation. Just have a look at the new FDFParser in the trunk.

> Load FDF document creates Temp file when called with file parameter
> -------------------------------------------------------------------
>
>                 Key: PDFBOX-2644
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2644
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 1.8.8
>            Reporter: Tilman Hausherr
>
> Load FDF document creates Temp file when called with file parameter, as shown by this stack trace from 
> https://stackoverflow.com/questions/28229085/temp-file-creation-error-on-gae-with-pdfbox
> {code}
> com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
> java.lang.SecurityException: Unable to create temporary file
> 	at java.io.File.checkAndCreate(File.java:1873)
> 	at java.io.File.createTempFile(File.java:1968)
> 	at java.io.File.createTempFile(File.java:2013)
> 	at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.createTmpFile(NonSequentialPDFParser.java:298)
> 	at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.<init>(NonSequentialPDFParser.java:278)
> 	at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.<init>(NonSequentialPDFParser.java:264)
> 	at org.apache.pdfbox.pdmodel.fdf.FDFDocument.load(FDFDocument.java:200)
> 	at org.apache.pdfbox.pdmodel.fdf.FDFDocument.load(FDFDocument.java:172)
> {code}
> and this source code
> {code}
>         File pdfFile = new File("resources/GenerateFDF.pdf");
>         File fdfFile = new File("resources/fdftest.fdf");
>         PDDocument pdfDoc = PDDocument.load(pdfFile);
>         FDFDocument fdfDoc = FDFDocument.load(fdfFile);
> {code}
> I had a quick look at the sources of FDFDocument:
> {code}
>     public static FDFDocument load( File file ) throws IOException
>     {
>         return load( new BufferedInputStream( new FileInputStream( file ) ) );
>     }
> {code}
> Is it needed this way, i.e. can't the NonSequentialPDFParser constructor be called instead, as it is done when opening a *P*DF Document?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org