1 package com
.google
.appengine
.api
.datastore
;
3 import com
.google
.common
.collect
.ImmutableMap
;
8 * Proxy around System.getenv() to enable testing and prevent errors in
9 * situations where the security manager does not allow access to environment
14 private static ImmutableMap
<String
, String
> envOverride
;
19 * Updates to {@code envOverride} made after calling this method will not be
20 * reflected in calls to {@link #getenv(String)}.
22 static synchronized void setEnvOverrideForTest(Map
<String
, String
> envOverride
) {
23 EnvProxy
.envOverride
= ImmutableMap
.copyOf(envOverride
);
26 static synchronized void clearEnvOverrideForTest() {
30 static String
getenv(String name
) {
31 synchronized (EnvProxy
.class) {
32 if (envOverride
!= null) {
33 return envOverride
.get(name
);
37 return System
.getenv(name
);
38 } catch (SecurityException e
) {