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

Maurice Betzel updated PDFBOX-3575:
-----------------------------------
    Description: 
In org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory the method 
createFromFile instantiates a new RandomAccessFile but does not close it when 
done. This keeps a lock on the File untill the JVM is closed.
Using close or autocloseable resolves the issue.

public static PDImageXObject createFromFile(PDDocument document, File file, int 
number)
            throws IOException
    {
        return createFromRandomAccessImpl(document, new RandomAccessFile(file, 
"r"), number);
    }

  was:
In org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory the method 
createFromFile instantiates a new RandomAccessFile but does not close it wen 
done. This keeps a lock on the File untill the JVM is closed.
Use close or autocloseable resolves the issue.

public static PDImageXObject createFromFile(PDDocument document, File file, int 
number)
            throws IOException
    {
        return createFromRandomAccessImpl(document, new RandomAccessFile(file, 
"r"), number);
    }


> Missing (auto)close on RandomFileAccess in CCITTFactory
> -------------------------------------------------------
>
>                 Key: PDFBOX-3575
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3575
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.3
>         Environment: Windows 10/64, java version "1.8.0_112" Java(TM) SE 
> Runtime Environment (build 1.8.0_112-b15) Java HotSpot(TM) 64-Bit Server VM 
> (build 25.112-b15, mixed mode)
>            Reporter: Maurice Betzel
>
> In org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory the method 
> createFromFile instantiates a new RandomAccessFile but does not close it when 
> done. This keeps a lock on the File untill the JVM is closed.
> Using close or autocloseable resolves the issue.
> public static PDImageXObject createFromFile(PDDocument document, File file, 
> int number)
>             throws IOException
>     {
>         return createFromRandomAccessImpl(document, new 
> RandomAccessFile(file, "r"), number);
>     }



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

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

Reply via email to