System.setProperty() should return the previous value of the property, if any

This commit is contained in:
Joel Dice 2007-09-17 08:10:27 -06:00
parent dc9ae3d269
commit 07102aefad

View File

@ -63,15 +63,17 @@ public abstract class System {
} }
} }
public static void setProperty(String name, String value) { public static String setProperty(String name, String value) {
for (Property p = properties; p != null; p = p.next) { for (Property p = properties; p != null; p = p.next) {
if (p.name.equals(name)) { if (p.name.equals(name)) {
String oldValue = p.value;
p.value = value; p.value = value;
return; return oldValue;
} }
} }
properties = new Property(name, value, properties); properties = new Property(name, value, properties);
return null;
} }
private static native String getProperty(int code); private static native String getProperty(int code);