A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/pmd/pmd/issues/1921 below:

[java] CloseResource false positive with ByteArrayInputStream · Issue #1921 · pmd/pmd · GitHub

Affects PMD Version: 6.16
Rule: CloseResource
Description:

The rule makes an exception for ByteArrayOutputStream but not the input stream. From the doc:

Closing a ByteArrayInputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

Code Sample demonstrating the issue:

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;

class Foo {

    {
        ByteArrayInputStream bis = new ByteArrayInputStream("fooString".getBytes(StandardCharsets.UTF_8));
    }
}

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