StAXOMBuilder builder = new StAXOMBuilder(parser);
OMElement omElement = builder.getDocumentElement();
omElement.build();
return omElement;
} catch (FileNotFoundException e) {
throw new BrokerConfigException(BrokerConstants.BROKER_CONF
+ "cannot be found in the path : " + path, e);
} catch (XMLStreamException e) {
throw new BrokerConfigException("Invalid XML for " + BrokerConstants.BROKER_CONF
+ " located in the path : " + path, e);
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException ingored) {
throw new BrokerConfigException("Can not close the input stream");
}
}
}