You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/01/24 00:45:56 UTC
[maven-surefire] 04/05: [SUREFIRE-1913] system properties should be restored after the in-process tests have been executed
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch release/2.22.3
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit f2db7449933ec3905bf96a19ba7c6fa9368f27c4
Author: tibordigana <ti...@gmail.com>
AuthorDate: Sat May 8 23:33:46 2021 +0200
[SUREFIRE-1913] system properties should be restored after the in-process tests have been executed
(cherry picked from commit e9e5193feee08230e934f5f0fbdc8f69eda0fb0c)
---
.../maven/plugin/surefire/AbstractSurefireMojo.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index be4ffea..2aa6dd4 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1167,11 +1167,19 @@ public abstract class AbstractSurefireMojo
if ( isNotForking() )
{
- createCopyAndReplaceForkNumPlaceholder( effectiveProperties, 1 ).copyToSystemProperties();
+ Properties originalSystemProperties = (Properties) System.getProperties().clone();
+ try
+ {
+ createCopyAndReplaceForkNumPlaceholder( effectiveProperties, 1 ).copyToSystemProperties();
- InPluginVMSurefireStarter surefireStarter =
- createInprocessStarter( provider, classLoaderConfiguration, runOrderParameters, scanResult );
- return surefireStarter.runSuitesInProcess( scanResult );
+ InPluginVMSurefireStarter surefireStarter =
+ createInprocessStarter( provider, classLoaderConfiguration, runOrderParameters, scanResult );
+ return surefireStarter.runSuitesInProcess( scanResult );
+ }
+ finally
+ {
+ System.setProperties( originalSystemProperties );
+ }
}
else
{