private Properties parseFile ( File file ) throws InvalidDeclarationFileException { Properties properties = new Properties ( ) ; InputStream is = null ; try { is = new FileInputStream ( file ) ; properties . load ( is ) ; } catch ( Exception e ) { throw new InvalidDeclarationFileException ( String . format ( "Error reading declaration file %s" , file . getAbsoluteFile ( ) ) , e ) ; } finally { if ( is != null ) { try { is . close ( ) ; } catch ( IOException e ) { LOG . error ( "IOException thrown while trying to close the declaration file." , e ) ; } } } if ( ! properties . containsKey ( Constants . ID ) ) { throw new InvalidDeclarationFileException ( String . format ( "File %s is not a correct declaration, needs to contains an id property" , file . getAbsoluteFile ( ) ) ) ; } return properties ; }
Parse the given file to obtains a Properties object .