public static Map < String , String > read ( final String path ) { Map < String , String > map = new HashMap < String , String > ( ) ; if ( path != null ) { try { Properties p = loadProperties ( path ) ; for ( Object key : p . keySet ( ) ) { String value = p . getProperty ( String . valueOf ( key ) ) ; // remove single/double quotes if ( ( value . startsWith ( "\"" ) && value . endsWith ( "\"" ) ) || ( value . startsWith ( "\'" ) && value . endsWith ( "\'" ) ) ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; } value = value . trim ( ) ; if ( ! value . equals ( "" ) ) { map . put ( String . valueOf ( key ) , value ) ; } } } catch ( Exception e ) { log . error ( e . getMessage ( ) , e ) ; } } return map ; }
Reads properties from file path or classpath