diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java index 4af80661b..94743595d 100644 --- a/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java +++ b/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java @@ -114,7 +114,7 @@ public class PropertiesPropertyEditor extends AbstractPropertyEditor { * current value. */ public String getJavaInitializationString() { - return getAsText(); + return "new Properties()"; } /** @@ -128,7 +128,11 @@ public class PropertiesPropertyEditor extends AbstractPropertyEditor { * modified 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( value.getClass().getName() + " is not of type Properties."); } diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java index 62be02893..fa17dfe23 100644 --- a/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java +++ b/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java @@ -114,6 +114,9 @@ public class StringArrayPropertyEditor extends AbstractPropertyEditor { * modified value. */ public void setValue(Object value) { + if(value == null) { + value = new String[0]; + } if(!(value instanceof String[])) { throw new IllegalArgumentException( "Value must be of type String[]."); diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java index 7a7304fa0..00b756298 100644 --- a/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java +++ b/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java @@ -119,6 +119,10 @@ public class StringPropertyEditor extends AbstractPropertyEditor { * modified value. */ public void setValue(Object value) { + if(value == null) { + value = ""; + } + Object old = _widget.getText(); _widget.setText(String.valueOf(value)); } @@ -129,9 +133,6 @@ public class StringPropertyEditor extends AbstractPropertyEditor { * object type such as "java.lang.Integer". */ public Object getValue() { String retval = _widget.getText(); - if(retval != null && retval.length() == 0) { - retval = null; - } return retval; }