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

ASF subversion and git services commented on PDFBOX-3363:
---------------------------------------------------------

Commit 1745522 from [~tilman] in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1745522 ]

PDFBOX-3363: close temp file, as suggested by Damien Butaye

> Leftover file in temp directory when signing
> --------------------------------------------
>
>                 Key: PDFBOX-3363
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3363
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 2.0.1, 2.0.2, 2.1.0
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>             Fix For: 2.0.2, 2.1.0
>
>
> As reported by Damien B. on the mailing list:
> {quote}
>    I'm trying to add a signature to a PDF using PDFBOX 2.0.1. During the
> process, a tmp file (e.g: tmpPDFBoxXXX.pdf) is stored inside the /tmp
> directory (RehHat server). This file is not deleted after completion.
> After some checks, it seems that the object responsible of the file
> creation is  "RandomAccessBufferedFileInputStream(InputStream is)". This
> object is used by the PDFParser object which doesn't close the stream
> after
> completion.
> {quote}
> and his solution:
> {quote}
>  For your information I found a workaround to avoid the problem of tmp file
> deletion. In the SignatureOptions object, I modified the method  *public
> void setVisualSignature(InputStream is)  *with the following content :
>       RandomAccessBufferedFileInputStream tmp=new
> RandomAccessBufferedFileInputStream(is); --> NEW LINE
>          PDFParser parser = new PDFParser(tmp);  --> NEW LINE
>          parser.parse();
>          visualSignature = parser.getDocument();
>          tmp.close();  --> NEW LINE
> Tmp files are well deleted and all unit tests passed without error on the
> pdfbox maven project.
> {quote}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to