elharo commented on code in PR #1440:
URL: https://github.com/apache/maven-scm/pull/1440#discussion_r4600316259
##########
maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/ValidateMojoTest.java:
##########
@@ -52,4 +54,16 @@ void testValidateWithInvalidScmUrls(ValidateMojo mojo)
throws Exception {
MojoExecutionException exception =
assertThrows(MojoExecutionException.class, mojo::execute);
assertNotNull(exception.getMessage());
}
+
+ @Test
+ @InjectMojo(goal = "validate", pom =
"classpath:/mojos/validate/validateWithWorkingDirectoryCheck.xml")
+ void testWorkingDirectoryPropertyIsNotLeaked(ValidateMojo mojo) {
+
assertNull(System.getProperty(AbstractSvnScmProvider.CURRENT_WORKING_DIRECTORY));
+ try {
+ assertDoesNotThrow(mojo::execute);
+
assertNull(System.getProperty(AbstractSvnScmProvider.CURRENT_WORKING_DIRECTORY));
+ } finally {
+
System.clearProperty(AbstractSvnScmProvider.CURRENT_WORKING_DIRECTORY);
Review Comment:
do you want to restore the original property value instead?
maybe use a finally block here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]