git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268472 13f79535-47bb-0310-9956-ffa450edef68master
@@ -114,7 +114,7 @@ public class PropertiesPropertyEditor extends AbstractPropertyEditor { | |||||
* current value. | * current value. | ||||
*/ | */ | ||||
public String getJavaInitializationString() { | public String getJavaInitializationString() { | ||||
return getAsText(); | |||||
return "new Properties()"; | |||||
} | } | ||||
/** | /** | ||||
@@ -128,7 +128,11 @@ public class PropertiesPropertyEditor extends AbstractPropertyEditor { | |||||
* modified value. | * modified value. | ||||
*/ | */ | ||||
public void setValue(Object value) { | public void setValue(Object value) { | ||||
if(value != null && !(value instanceof Properties)) { | |||||
if(value == null) { | |||||
value = new Properties(); | |||||
} | |||||
if(!(value instanceof Properties)) { | |||||
throw new IllegalArgumentException( | throw new IllegalArgumentException( | ||||
value.getClass().getName() + " is not of type Properties."); | value.getClass().getName() + " is not of type Properties."); | ||||
} | } | ||||
@@ -114,6 +114,9 @@ public class StringArrayPropertyEditor extends AbstractPropertyEditor { | |||||
* modified value. | * modified value. | ||||
*/ | */ | ||||
public void setValue(Object value) { | public void setValue(Object value) { | ||||
if(value == null) { | |||||
value = new String[0]; | |||||
} | |||||
if(!(value instanceof String[])) { | if(!(value instanceof String[])) { | ||||
throw new IllegalArgumentException( | throw new IllegalArgumentException( | ||||
"Value must be of type String[]."); | "Value must be of type String[]."); | ||||
@@ -119,6 +119,10 @@ public class StringPropertyEditor extends AbstractPropertyEditor { | |||||
* modified value. | * modified value. | ||||
*/ | */ | ||||
public void setValue(Object value) { | public void setValue(Object value) { | ||||
if(value == null) { | |||||
value = ""; | |||||
} | |||||
Object old = _widget.getText(); | Object old = _widget.getText(); | ||||
_widget.setText(String.valueOf(value)); | _widget.setText(String.valueOf(value)); | ||||
} | } | ||||
@@ -129,9 +133,6 @@ public class StringPropertyEditor extends AbstractPropertyEditor { | |||||
* object type such as "java.lang.Integer". */ | * object type such as "java.lang.Integer". */ | ||||
public Object getValue() { | public Object getValue() { | ||||
String retval = _widget.getText(); | String retval = _widget.getText(); | ||||
if(retval != null && retval.length() == 0) { | |||||
retval = null; | |||||
} | |||||
return retval; | return retval; | ||||
} | } | ||||