ConnectorDocument connectorDocument = ConnectorDocument.Factory.parse(new UnclosableInputStream(jarInputStream));
XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setLoadLineNumbers();
Collection errors = new ArrayList();
xmlOptions.setErrorListener(errors);
if (!connectorDocument.validate(xmlOptions)) {
throw new DeploymentException("Invalid deployment descriptor: errors: " + errors);
}
return connectorDocument;
}