A RetroSearch Logo

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

Search Query:

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

[java] The rule CloseResource should deal with IO stream as default · Issue #1000 · pmd/pmd · GitHub

As InputStream/OutputStream are also common resources in program, should you guys task them into consideration as the default value of the 'types' property? BTW, I add them into my ruleset configuration, but get no violation.
My config is here:

<rule ref="category/java/errorprone.xml/CloseResource" >
        <properties>
            <property name="types" value="[java.sql.Connection, java.sql.Statement, java.sql.ResultSet, java.io.InputStream]"/>
        </properties>
    </rule>

My code snippet:

InputStream is = new InputStream() {
	@Override
	public int read() throws IOException {
		// TODO Auto-generated method stub
		return 0;
	}
};
		
try {
	is.read();
} catch (IOException e) {
			
}

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