reqs.add(requirement);
}
}
private Version processScrXml(Resource resource, String path, List<Capability> caps, List<Requirement> reqs) throws IOException {
Resource childResource = resource.getChild(path);
if (childResource == null) {
if (log != null)
log.log(LogService.LOG_WARNING,
MessageFormat.format("Cannot analyse SCR requirement version: resource {0} does not contain path {1} referred from Service-Component header.",
resource.getLocation(), path));
return null;
}
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
try {
SAXParser parser = spf.newSAXParser();
SCRContentHandler handler = new SCRContentHandler(caps, reqs);
parser.parse(childResource.getStream(), handler);
return handler.highest;
} catch (Exception e) {
if (log != null)
log.log(LogService.LOG_ERROR, MessageFormat.format("Processing error: failed to parse child resource {0} in resource {1}.", path, resource.getLocation()), e);