@SuppressWarnings("unchecked")
    public static final Map<?, ?> hidePasswords(Map<?, ?> map) {
        map = new HashMap<Object, Object>(map);

        for (@SuppressWarnings("rawtypes")
        Map.Entry entry : map.entrySet())
            if (entry.getKey() instanceof String && PropertyService.isPassword((String) entry.getKey()))
                entry.setValue("******");
            else if(entry.getKey() instanceof String && entry.getValue() instanceof String && ((String) entry.getKey()).toLowerCase().contains("url"))
                entry.setValue(filterURL((String) entry.getValue()));
        return map;
    }
@ SuppressWarnings ( "unchecked" ) public static final Map < ? , ? > hidePasswords ( Map < ? , ? > map ) { map = new HashMap < Object , Object > ( map ) ; for ( @ SuppressWarnings ( "rawtypes" ) Map . Entry entry : map . entrySet ( ) ) if ( entry . getKey ( ) instanceof String && PropertyService . isPassword ( ( String ) entry . getKey ( ) ) ) entry . setValue ( "******" ) ; else if ( entry . getKey ( ) instanceof String && entry . getValue ( ) instanceof String && ( ( String ) entry . getKey ( ) ) . toLowerCase ( ) . contains ( "url" ) ) entry . setValue ( filterURL ( ( String ) entry . getValue ( ) ) ) ; return map ; }
Utility method to hide passwords from a map structure.
Make a copy of the map and replace password values with ******.

@param map collection of name/value pairs. Values might be passwords.
@return copy of the map with passwords hidden.