You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/11/21 17:47:00 UTC

[jira] [Commented] (PDFBOX-4383) PDFMergerUtility seems to leave source file open

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

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

Commit 1847125 from tilman@apache.org in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1847125 ]

PDFBOX-4383: don't store file as FileInputStream, add "previously failing" test

> PDFMergerUtility seems to leave source file open
> ------------------------------------------------
>
>                 Key: PDFBOX-4383
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4383
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.0.12
>            Reporter: David Schreck
>            Assignee: Tilman Hausherr
>            Priority: Major
>
> Hi,
>  
> Having migrated from 2.0.11 to 2.0.12. I am facing the following issue:
>  
> When merging multiple pdf files into one, I can no longer delete the source files.
>  
> Here is a sample code (worked in 2.0.11):
>  
> {code:java}
> public void mergePDFFiles(List<File> inFiles, File outFile)
>     throws InvalidPasswordException, IOException
>     {
>         try (OutputStream out = new BufferedOutputStream(new FileOutputStream(outFile))) {
>             PDFMergerUtility merger = new PDFMergerUtility();
>             merger.setDestinationStream(out);
>             for(File toMerge : inFiles) {
>                 merger.addSource(toMerge);
>             }
>             merger.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly());
>         }
>     
>         for(File f : inFiles) {
>             // IOException thrown
>             FileUtils.forceDelete(f);
>         }
>     }
> {code}
> Has something changed or do I do something wrong ?
>  
> Br,
>  
> David Schreck
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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