Skip to content

Commit

Permalink
[core] XSLTRenderer: Close original writer at the end
Browse files Browse the repository at this point in the history
Fixes #4717
  • Loading branch information
adangel committed Oct 18, 2023
1 parent 2bbb193 commit fc9767b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/pages/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ The remaining section describes the complete release notes for 7.0.0.

#### Fixed issues

* core
* [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file
* java-codestyle
* [#2847](https://github.com/pmd/pmd/issues/2847): \[java] New Rule: Use Explicit Types
* [#4578](https://github.com/pmd/pmd/issues/4578): \[java] CommentDefaultAccessModifier comment needs to be before annotation if present
Expand Down Expand Up @@ -439,6 +441,7 @@ See also [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.
* [#4454](https://github.com/pmd/pmd/issues/4454): \[core] "Unknown option: '-min'" but is referenced in documentation
* [#4611](https://github.com/pmd/pmd/pull/4611): \[core] Fix loading language properties from env vars
* [#4621](https://github.com/pmd/pmd/issues/4621): \[core] Make `ClasspathClassLoader::getResource` child first
* [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file
* cli
* [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command
* [#3828](https://github.com/pmd/pmd/issues/3828): \[core] Progress reporting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public Writer getWriter() {
}

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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;

Expand Down Expand Up @@ -129,6 +130,8 @@ private void transform(Document doc) {
transformer.transform(source, result);
} catch (TransformerException e) {
throw new RuntimeException(e);
} finally {
IOUtil.closeQuietly(outputWriter);
}
}

Expand Down

0 comments on commit fc9767b

Please sign in to comment.