private SingletonDeploymentConfiguration parse(DeploymentUnit unit, File file) throws DeploymentUnitProcessingException { try (BufferedReader reader = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) { XMLStreamReader xmlReader = XML_INPUT_FACTORY.createXMLStreamReader(reader); try { MutableSingletonDeploymentConfiguration config = new MutableSingletonDeploymentConfiguration(unit); this.mapper.parseDocument(config, xmlReader); return config; } finally { xmlReader.close(); } } catch (XMLStreamException e) { throw ServerLogger.ROOT_LOGGER.errorLoadingDeploymentStructureFile(file.getPath(), e); } catch (FileNotFoundException e) { throw ServerLogger.ROOT_LOGGER.deploymentStructureFileNotFound(file); } catch (IOException e) { throw ServerLogger.ROOT_LOGGER.deploymentStructureFileNotFound(file); } } }
private SingletonDeploymentConfiguration parse(DeploymentUnit unit, File file) throws DeploymentUnitProcessingException { try (FileReader reader = new FileReader(file)) { XMLStreamReader xmlReader = XML_INPUT_FACTORY.createXMLStreamReader(reader); try { MutableSingletonDeploymentConfiguration config = new MutableSingletonDeploymentConfiguration(unit); this.mapper.parseDocument(config, xmlReader); return config; } finally { xmlReader.close(); } } catch (XMLStreamException e) { throw ServerLogger.ROOT_LOGGER.errorLoadingDeploymentStructureFile(file.getPath(), e); } catch (FileNotFoundException e) { throw ServerLogger.ROOT_LOGGER.deploymentStructureFileNotFound(file); } catch (IOException e) { throw ServerLogger.ROOT_LOGGER.deploymentStructureFileNotFound(file); } } }
private ParseResult parse(final InputStream source, final File file, final DeploymentUnit deploymentUnit, final ModuleLoader moduleLoader) throws DeploymentUnitProcessingException { 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 { final ParseResult result = new ParseResult(moduleLoader, deploymentUnit); mapper.parseDocument(result, streamReader); return result; } finally { safeClose(streamReader); } } catch (XMLStreamException e) { throw ServerLogger.ROOT_LOGGER.errorLoadingDeploymentStructureFile(file.getPath(), e); } }
private ParseResult parse(final InputStream source, final File file, final DeploymentUnit deploymentUnit, final ModuleLoader moduleLoader) throws DeploymentUnitProcessingException { 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 { final ParseResult result = new ParseResult(moduleLoader, deploymentUnit); mapper.parseDocument(result, streamReader); return result; } finally { safeClose(streamReader); } } catch (XMLStreamException e) { throw ServerLogger.ROOT_LOGGER.errorLoadingDeploymentStructureFile(file.getPath(), e); } }