[
https://issues.apache.org/jira/browse/MPMD-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17956766#comment-17956766
]
ASF GitHub Bot commented on MPMD-412:
-------------------------------------
slawekjaranowski commented on code in PR #226:
URL: https://github.com/apache/maven-pmd-plugin/pull/226#discussion_r2134569916
##########
src/test/java/org/apache/maven/plugins/pmd/stubs/CustomConfigurationMavenProjectStub.java:
##########
@@ -40,35 +41,26 @@ public class CustomConfigurationMavenProjectStub extends
PmdProjectStub {
private List<ReportPlugin> reportPlugins = new ArrayList<>();
- public CustomConfigurationMavenProjectStub() {
+ public CustomConfigurationMavenProjectStub() throws IOException,
XmlPullParserException {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
- Model model = null;
- try (InputStream is = new FileInputStream(new File(getBasedir() + "/"
+ getPOM()))) {
- model = pomReader.read(is);
- setModel(model);
- } catch (Exception e) {
- }
+ InputStream in = new FileInputStream(getBasedir() + "/" + getPOM());
Review Comment:
stream should be closed also in tests
> Tests are inobviously broken due to overly broad catch clauses
> --------------------------------------------------------------
>
> Key: MPMD-412
> URL: https://issues.apache.org/jira/browse/MPMD-412
> Project: Maven PMD Plugin (Moved to GitHub Issues)
> Issue Type: Bug
> Reporter: Elliotte Rusty Harold
> Priority: Blocker
>
> See https://github.com/apache/maven-pmd-plugin/pull/178
> We're catching java.lang.Exception and thus often missing that the wrong
> exception is being caught, and that the test is in fact failing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)