public static Properties sanitize ( Properties properties ) { // convert any non-String keys/values to Strings Properties sanitizedEntries = new Properties ( ) ; for ( Iterator < ? > itr = properties . entrySet ( ) . iterator ( ) ; itr . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) itr . next ( ) ; if ( ! ( entry . getKey ( ) instanceof String ) ) { String key = sanitize ( entry . getKey ( ) ) ; if ( ! properties . containsKey ( key ) ) { sanitizedEntries . setProperty ( key , sanitize ( entry . getValue ( ) ) ) ; } itr . remove ( ) ; } else if ( ! ( entry . getValue ( ) instanceof String ) ) { entry . setValue ( sanitize ( entry . getValue ( ) ) ) ; } } properties . putAll ( sanitizedEntries ) ; return properties ; }
Utility method to sanitize the set of instructions .