private Properties loadPropertiesFile ( ) throws IOException { Properties props = new Properties ( ) ; File propsFile ; if ( propertiesFile != null ) { propsFile = new File ( propertiesFile ) ; checkArgument ( propsFile . isFile ( ) , "Invalid properties file '%s'." , propertiesFile ) ; } else { propsFile = new File ( getConfDir ( ) , DEFAULT_PROPERTIES_FILE ) ; } if ( propsFile . isFile ( ) ) { try ( InputStreamReader isr = new InputStreamReader ( new FileInputStream ( propsFile ) , StandardCharsets . UTF_8 ) ) { props . load ( isr ) ; for ( Map . Entry < Object , Object > e : props . entrySet ( ) ) { e . setValue ( e . getValue ( ) . toString ( ) . trim ( ) ) ; } } } return props ; }
Loads the configuration file for the application if it exists . This is either the user - specified properties file or the spark - defaults . conf file under the Spark configuration directory .