A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/coobird/thumbnailator/issues/148 below:

Thumbnails.of() do not close output file on v0.4.9 · Issue #148 · coobird/thumbnailator · GitHub

My test-cases was failed after moving on v0.4.9. Rollback on v0.4.8 restore functionality.

Here is simple test which allow to reproduce the issue:

@Test
public void failure() throws IOException {
    File tmpDir = new File(System.getProperty("user.dir") + "\\target\\tmp");
    String sourceDirString = System.getProperty("user.dir") + "\\src\\test\\resources";
    File dscfJpg = new File(sourceDirString,"DSCF0001.JPG");

    // @Before
    if(!tmpDir.exists()) {
        tmpDir.mkdirs();
    }
    // @Before

    Thumbnails.of( new FileInputStream(dscfJpg) )
            .size(500, 500)
            .toFile( new File(tmpDir.getAbsolutePath(), "toJpeg.jpg") );

    // @After
    if(tmpDir.exists()) {
        FileUtils.deleteDirectory(tmpDir);
    }
    // @After
}

In result:
java.io.IOException: Unable to delete file: D:{cut}\target\tmp\toJpeg.jpg
File stay locked while java process works.
If I will call several Thumbnails.of() in a row just last one will be locked.

Windows 10 1607 LTSC
OpenJDK 11.0.1


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4