You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2016/05/25 17:33:12 UTC

[jira] [Updated] (PDFBOX-3363) Leftover file in temp directory when signing

     [ https://issues.apache.org/jira/browse/PDFBOX-3363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr updated PDFBOX-3363:
------------------------------------
    Description: 
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}

  was:
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}


> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org