private Set < String > detectInvalidFields ( final String name , final String fname , final Map < String , String > attributes ) { final Set < String > rslt = new HashSet <> ( ) ; // Name & Fname try { tenantService . validateName ( name ) ; // Fname is generated from name; the only way to // fix an invalid fname is to change the name. tenantService . validateFname ( fname ) ; } catch ( Exception e ) { log . warn ( "Validation failure for tenant name={}" , name , e ) ; rslt . add ( "name" ) ; } // Attributes for ( String attributeName : tenantManagerAttributes . keySet ( ) ) { try { final String value = attributes . get ( attributeName ) ; tenantService . validateAttribute ( attributeName , value ) ; } catch ( Exception e ) { log . warn ( "Validation failure for tenant name={}" , name , e ) ; rslt . add ( attributeName ) ; } } return rslt ; }
Returns a collection of invalid fields if any .