Import GNU Classpath (libgcj-import-20081021).
2008-10-22 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (libgcj-import-20081021). * Regenerate class and header files. * Regenerate auto* files. From-SVN: r141302
This commit is contained in:
parent
51c869cac9
commit
58ddc179d4
20 changed files with 242 additions and 550 deletions
|
@ -546,20 +546,28 @@ public final class System
|
|||
SecurityManager sm = SecurityManager.current; // Be thread-safe.
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("getenv.*"));
|
||||
|
||||
if (environmentMap == null)
|
||||
{
|
||||
List<String> environ = (List<String>)VMSystem.environ();
|
||||
Map<String,String> variables = new EnvironmentMap();
|
||||
for (String pair : environ)
|
||||
{
|
||||
String[] parts = pair.split("=");
|
||||
if (parts.length == 2)
|
||||
variables.put(parts[0], parts[1]);
|
||||
else
|
||||
variables.put(parts[0], "");
|
||||
}
|
||||
environmentMap = Collections.unmodifiableMap(variables);
|
||||
List<String> environ = (List<String>)VMSystem.environ();
|
||||
for (String envEntry : environ)
|
||||
{
|
||||
// avoid broken and null entries
|
||||
if (envEntry != null && !envEntry.endsWith("="))
|
||||
{
|
||||
// it's perfectly legal that some entries may be in the form
|
||||
// key=value=value=value
|
||||
int equalSignIndex = envEntry.indexOf('=');
|
||||
String key = envEntry.substring(0, equalSignIndex);
|
||||
String value = envEntry.substring(equalSignIndex + 1);
|
||||
variables.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
environmentMap = Collections.unmodifiableMap(variables);
|
||||
}
|
||||
|
||||
return environmentMap;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue