private Vocabulary loadFromFile(File localFile) throws InvalidConfigException {
  Preconditions.checkNotNull(localFile);
  Preconditions.checkState(localFile.exists());
  Closer closer=Closer.create();
  try {
    InputStream fileIn=closer.register(new FileInputStream(localFile));
    Vocabulary v=vocabFactory.build(fileIn);
    v.setModified(new Date(localFile.lastModified()));
    log.info("Successfully loaded vocabulary: " + v.getUriString());
    return v;
  }
 catch (  IOException e) {
    log.error("Can't access local vocabulary file (" + localFile.getAbsolutePath() + ")",e);
    throw new InvalidConfigException(InvalidConfigException.TYPE.INVALID_VOCABULARY,"Can't access local vocabulary file");
  }
catch (  SAXException e) {
    log.error("Can't parse local extension file (" + localFile.getAbsolutePath() + ")",e);
    throw new InvalidConfigException(InvalidConfigException.TYPE.INVALID_VOCABULARY,"Can't parse local vocabulary file");
  }
catch (  ParserConfigurationException e) {
    log.error("Can't create sax parser",e);
    throw new InvalidConfigException(InvalidConfigException.TYPE.INVALID_VOCABULARY,"Can't create sax parser");
  }
 finally {
    try {
      closer.close();
    }
 catch (    IOException e) {
      log.debug("Failed to close input stream on vocabulary file",e);
    }
  }
}

private Vocabulary loadFromFile ( File localFile ) throws InvalidConfigException { Preconditions . checkNotNull ( localFile ) ; Preconditions . checkState ( localFile . exists ( ) ) ; Closer closer = Closer . create ( ) ; try { InputStream fileIn = closer . register ( new FileInputStream ( localFile ) ) ; Vocabulary v = vocabFactory . build ( fileIn ) ; v . setModified ( new Date ( localFile . lastModified ( ) ) ) ; log . info ( "Successfully loaded vocabulary: " + v . getUriString ( ) ) ; return v ; } catch ( IOException e ) { log . error ( "Can't access local vocabulary file (" + localFile . getAbsolutePath ( ) + ")" , e ) ; throw new InvalidConfigException ( InvalidConfigException . TYPE . INVALID_VOCABULARY , "Can't access local vocabulary file" ) ; } catch ( SAXException e ) { log . error ( "Can't parse local extension file (" + localFile . getAbsolutePath ( ) + ")" , e ) ; throw new InvalidConfigException ( InvalidConfigException . TYPE . INVALID_VOCABULARY , "Can't parse local vocabulary file" ) ; } catch ( ParserConfigurationException e ) { log . error ( "Can't create sax parser" , e ) ; throw new InvalidConfigException ( InvalidConfigException . TYPE . INVALID_VOCABULARY , "Can't create sax parser" ) ; } finally { try { closer . close ( ) ; } catch ( IOException e ) { log . debug ( "Failed to close input stream on vocabulary file" , e ) ; } } }
load the vocabulary object from the xml definition file .
