=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/DefaultSchemaValidator.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/DefaultSchemaValidator.java 2015-01-15 09:50:45 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/schema/DefaultSchemaValidator.java 2015-01-16 06:55:12 +0000 @@ -121,7 +121,7 @@ if ( PropertyType.COLOR == property.getPropertyType() && !ValidationUtils.isValidHexColor( value ) ) { - validationViolations.add( new ValidationViolation( property.getName(), "Not a valid color (in hex format).", value ) ); + validationViolations.add( new ValidationViolation( property.getName(), "Not a valid hex color.", value ) ); } /* TODO add proper validation for both Points and Polygons, ValidationUtils only supports points at this time === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2014-12-22 09:56:13 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2015-01-16 06:55:12 +0000 @@ -374,7 +374,7 @@ } /** - * Checks to see if given parameter is a valid hex color string (#xxx and #xxxxxx). + * Checks to see if given parameter is a valid hex color string (#xxx and #xxxxxx, xxx, xxxxxx). * * @param value Value to check against * @return true if value is a hex color string, false otherwise @@ -386,21 +386,19 @@ return false; } - if ( !value.startsWith( "#" ) ) - { - return false; - } - - if ( !(value.length() == 4 || value.length() == 7) ) - { - return false; - } - - char[] chars = value.toCharArray(); - - for ( int i = 1; i < chars.length; i++ ) - { - if ( !Verifier.isHexDigit( chars[i] ) ) + if ( value.startsWith( "#" ) ) + { + value = value.substring( 1 ); + } + + if ( !(value.length() == 3 || value.length() == 6) ) + { + return false; + } + + for ( char aChar : value.toCharArray() ) + { + if ( !Verifier.isHexDigit( aChar ) ) { return false; }