public static void validate ( String styleAttribute ) throws InvalidInputException { try { final Map < String , String > styleMap = Splitter . on ( ";" ) . omitEmptyStrings ( ) . withKeyValueSeparator ( ":" ) . split ( styleAttribute ) ; final HashSet < String > inputStyleProperties = new HashSet <> ( styleMap . keySet ( ) ) ; inputStyleProperties . removeAll ( ALLOWED_PROPERTIES ) ; if ( ! inputStyleProperties . isEmpty ( ) ) { throw new InvalidInputException ( "Invalid property(s): [" + Joiner . on ( "," ) . join ( inputStyleProperties ) + "] in the \"style\" attribute" ) ; } } catch ( IllegalArgumentException ex ) { throw new InvalidInputException ( "Unparseable \"style\" attribute: " + styleAttribute , ex ) ; } }
Validate that the input style attribute is allowed