forked from phoedos/pmd
Merge pull request #4718 from adangel:issue-4717-xsltrenderer-leak
[core] XSLTRenderer: Close original writer at the end #4718
This commit is contained in:
@ -7279,6 +7279,15 @@
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "nakul777",
|
||||
"name": "Nakul Sharma",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1551545?v=4",
|
||||
"profile": "https://github.com/nakul777",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "shai-bennathan",
|
||||
"name": "Shai Bennathan",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -107,6 +107,7 @@ in the Migration Guide.
|
||||
* [#1027](https://github.com/pmd/pmd/issues/1027): \[core] Apply the new PropertyDescriptor<Pattern> type where applicable
|
||||
* [#4674](https://github.com/pmd/pmd/issues/4674): \[core] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass
|
||||
* [#4694](https://github.com/pmd/pmd/pull/4694): \[core] Fix line/col numbers in TokenMgrError
|
||||
* [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file
|
||||
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer
|
||||
* doc
|
||||
* [#3175](https://github.com/pmd/pmd/issues/3175): \[doc] Document language module features
|
||||
@ -574,6 +575,7 @@ See also [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.
|
||||
* [#4621](https://github.com/pmd/pmd/issues/4621): \[core] Make `ClasspathClassLoader::getResource` child first
|
||||
* [#4674](https://github.com/pmd/pmd/issues/4674): \[core] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass
|
||||
* [#4694](https://github.com/pmd/pmd/pull/4694): \[core] Fix line/col numbers in TokenMgrError
|
||||
* [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file
|
||||
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer
|
||||
* cli
|
||||
* [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command
|
||||
|
@ -96,6 +96,7 @@ public abstract class AbstractRenderer extends AbstractPropertySource implements
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO: consider to rename the flush method - this is actually closing the writer
|
||||
public void flush() {
|
||||
if (writer == null) {
|
||||
// might happen, if no writer is set. E.g. in maven-pmd-plugin's PmdCollectingRenderer
|
||||
|
@ -28,6 +28,7 @@ import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import net.sourceforge.pmd.internal.util.IOUtil;
|
||||
import net.sourceforge.pmd.properties.PropertyDescriptor;
|
||||
import net.sourceforge.pmd.properties.PropertyFactory;
|
||||
|
||||
@ -129,6 +130,8 @@ public class XSLTRenderer extends XMLRenderer {
|
||||
transformer.transform(source, result);
|
||||
} catch (TransformerException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
IOUtil.closeQuietly(outputWriter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,9 @@ abstract class BaseParsingHelper<Self : BaseParsingHelper<Self, T>, T : RootNode
|
||||
val input = resourceLoader.getResourceAsStream(params.resourcePrefix + resourceName)
|
||||
?: throw IllegalArgumentException("Unable to find resource file ${params.resourcePrefix + resourceName} from $resourceLoader")
|
||||
|
||||
return consume(input)
|
||||
input.use {
|
||||
return consume(input)
|
||||
}
|
||||
}
|
||||
|
||||
private fun consume(input: InputStream) =
|
||||
@ -214,7 +216,9 @@ abstract class BaseParsingHelper<Self : BaseParsingHelper<Self, T>, T : RootNode
|
||||
val input = (params.resourceLoader ?: javaClass).classLoader.getResourceAsStream(sourceFile)
|
||||
?: throw IllegalArgumentException("Unable to find source file $sourceFile for $clazz")
|
||||
|
||||
return consume(input)
|
||||
input.use {
|
||||
return consume(input)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
|
Reference in New Issue
Block a user