private String validateColor ( String color ) { String validated = color ; if ( color != null ) { if ( ! color . startsWith ( "#" ) ) { validated = "#" + color ; } if ( ! colorPattern . matcher ( validated ) . matches ( ) ) { throw new GeoPackageException ( "Color must be in hex format #RRGGBB or #RGB, invalid value: " + color ) ; } validated = validated . toUpperCase ( ) ; } return validated ; }
Validate and adjust the color value