This commit is contained in:
Clebert Suconic 2018-11-15 20:18:20 -05:00
commit 9263bb4355
1 changed files with 16 additions and 6 deletions

View File

@ -68,15 +68,25 @@ public class CleanupSystemPropertiesRule extends ExternalResource {
System.out.println("======================================================================================================");
if (!newProperties.isEmpty()) {
System.out.println("Clearing system property...");
int i = 1;
for (Object key : newProperties) {
System.out.println("Cleaning up system property " + key);
System.out.printf("\t%3d. %s = %s%n", i++, key, System.getProperty(key.toString()));
System.clearProperty(key.toString());
}
}
if (!changed.isEmpty()) {
System.out.println("Resetting system property...");
int i = 1;
for (Map.Entry<Object, Object> entry : changed.entrySet()) {
System.out.println("Setting up old system property, key=" + entry.getKey() + ", value = " + entry.getValue());
System.out.printf("\t%3d. %s = %s (was %s)%n", i++, entry.getKey(), entry.getValue(), System.getProperty(entry.getKey().toString()));
System.setProperty(entry.getKey().toString(), entry.getValue().toString());
}
}
System.out.println("======================================================================================================");
}