=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2014-09-02 15:24:29 +0000 @@ -33,6 +33,7 @@ import java.util.HashSet; import java.util.List; +import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.attribute.AttributeService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; @@ -248,21 +249,11 @@ // Prepare values // --------------------------------------------------------------------- - if ( alternativeName != null && alternativeName.trim().length() == 0 ) - { - alternativeName = null; - } - - if ( code != null && code.trim().length() == 0 ) - { - code = null; - } - - if ( description != null && description.trim().length() == 0 ) - { - description = null; - } - + alternativeName = StringUtils.trimToNull( alternativeName ); + code = StringUtils.trimToNull( code ); + description = StringUtils.trimToNull( description ); + formName = StringUtils.trimToNull( formName ); + // --------------------------------------------------------------------- // Create data element // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2014-09-02 15:24:29 +0000 @@ -33,6 +33,7 @@ import java.util.List; import java.util.Set; +import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.attribute.AttributeService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; @@ -272,26 +273,11 @@ // Prepare values // --------------------------------------------------------------------- - if ( alternativeName != null && alternativeName.trim().length() == 0 ) - { - alternativeName = null; - } - - if ( code != null && code.trim().length() == 0 ) - { - code = null; - } - - if ( description != null && description.trim().length() == 0 ) - { - description = null; - } - - if ( formName != null && formName.trim().length() == 0 ) - { - formName = null; - } - + alternativeName = StringUtils.trimToNull( alternativeName ); + code = StringUtils.trimToNull( code ); + description = StringUtils.trimToNull( description ); + formName = StringUtils.trimToNull( formName ); + // --------------------------------------------------------------------- // Update data element // ---------------------------------------------------------------------