Revision: 293
Author:
b...@google.com
Date: Fri Jun 14 13:43:01 2013
Log: Restore system properties to initial values
java.vm.name is used by caliper to determine if it is running in Dalvik or
not.
Without this, it assumed it should use java.
The null checks are because the properities can be null, such as
java.vm.info
http://code.google.com/p/vogar/source/detail?r=293
Modified:
/trunk/src/vogar/target/TestEnvironment.java
=======================================
--- /trunk/src/vogar/target/TestEnvironment.java Mon Apr 15 20:51:56 2013
+++ /trunk/src/vogar/target/TestEnvironment.java Fri Jun 14 13:43:01 2013
@@ -41,6 +41,12 @@
private final HostnameVerifier defaultHostnameVerifier;
private final SSLSocketFactory defaultSSLSocketFactory;
+ private static final String JAVA_RUNTIME_VERSION =
System.getProperty("java.runtime.version");
+ private static final String JAVA_VM_INFO =
System.getProperty("
java.vm.info");
+ private static final String JAVA_VM_VERSION =
System.getProperty("java.vm.version");
+ private static final String JAVA_VM_VENDOR =
System.getProperty("java.vm.vendor");
+ private static final String JAVA_VM_NAME =
System.getProperty("
java.vm.name");
+
public TestEnvironment() {
System.setProperties(null); // Reset.
String tmpDir = System.getProperty("java.io.tmpdir");
@@ -59,13 +65,21 @@
// Reset system properties.
System.setProperties(null);
-
- System.setProperty("java.runtime.version", "x");
- System.setProperty("
java.vm.info", "x");
- System.setProperty("java.vm.version", "x");
- System.setProperty("java.vm.vendor", "x");
- System.setProperty("
java.vm.name", "x");
-
+ if (JAVA_RUNTIME_VERSION != null) {
+ System.setProperty("java.runtime.version",
JAVA_RUNTIME_VERSION);
+ }
+ if (JAVA_VM_INFO != null) {
+ System.setProperty("
java.vm.info", JAVA_VM_INFO);
+ }
+ if (JAVA_VM_VERSION != null) {
+ System.setProperty("java.vm.version", JAVA_VM_VERSION);
+ }
+ if (JAVA_VM_VENDOR != null) {
+ System.setProperty("java.vm.vendor", JAVA_VM_VENDOR);
+ }
+ if (JAVA_VM_NAME != null) {
+ System.setProperty("
java.vm.name", JAVA_VM_NAME);
+ }
// Require writable java.home and user.dir directories for
preferences
String tmpDir = System.getProperty("java.io.tmpdir");