static ModuleSpec parse( final ModuleIdentifier moduleIdentifier, final File root, final File moduleInfoFile) throws ModuleLoadException { final FileInputStream fis; try { fis = new FileInputStream(moduleInfoFile); } catch (FileNotFoundException e) { throw new ModuleLoadException("No module.xml file found at " + moduleInfoFile); } try { return parse(root, fis, moduleInfoFile, moduleIdentifier); } finally { safeClose(fis); } }
private static ModuleSpec parse( final File root, InputStream source, final File moduleInfoFile, final ModuleIdentifier moduleIdentifier) throws ModuleLoadException { try { final XMLInputFactory inputFactory = INPUT_FACTORY; setIfSupported(inputFactory, XMLInputFactory.IS_VALIDATING, Boolean.FALSE); setIfSupported(inputFactory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); final XMLStreamReader streamReader = inputFactory.createXMLStreamReader(source); try { return parseDocument(root, streamReader, ModuleSpec.build(moduleIdentifier)); } finally { safeClose(streamReader); } } catch (XMLStreamException e) { throw new ModuleLoadException("Error loading module from " + moduleInfoFile.getPath(), e); } }