A RetroSearch Logo

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

Search Query:

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

[java] CloseResource false-positive with URLClassLoader in cast expression · Issue #2056 · pmd/pmd · GitHub

That one could be considered a FP, since we don't create the URLClassLoader here. We just cast the method argument, which is a ClassLoader, to a local variable, which is a URLClassLoader and therefore AutoCloseable...

_Originally posted by @adangel in #1955 _

Code example:

public void checkValidity(final RuleSets ruleSets, final ClassLoader auxclassPathClassLoader) { boolean cacheIsValid = cacheExists(); if (cacheIsValid && ruleSets.getChecksum() != rulesetChecksum) { LOG.info("Analysis cache invalidated, rulesets changed."); cacheIsValid = false; } final long currentAuxClassPathChecksum; if (auxclassPathClassLoader instanceof URLClassLoader) { final URLClassLoader urlClassLoader = (URLClassLoader) auxclassPathClassLoader;

The variable "urlClassLoader" is not closed in this method and this is detected by the rule.
However, since the URLClassLoader is not created within this method, it should be ignored.


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