in src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java [657:739]
private void includeStarted(Attributes attributes) throws SAXException {
final ExtendedBuffer buffer = new ExtendedBuffer(getContext());
buffers.push(buffer);
try {
URL url;
if (settings == null) {
// TODO : settings can be null, but I don't why.
// Check if the following code is correct in that case
String fileName = attributes.getValue("file");
if (fileName == null) {
String urlStr = attributes.getValue("url");
url = new URL(urlStr);
} else {
url = Checks.checkAbsolute(fileName, "settings.include").toURI().toURL();
}
} else {
url = settings.getRelativeUrlResolver().getURL(relativePathCtx,
settings.substitute(attributes.getValue("file")),
settings.substitute(attributes.getValue("url")));
}
XMLHelper.parse(url, null, new DefaultHandler() {
private boolean insideConfigurations = false;
private boolean doIndent = false;
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if ("configurations".equals(qName)) {
insideConfigurations = true;
String defaultconf = substitute(settings,
attributes.getValue("defaultconf"));
if (defaultconf != null) {
defaultConf = defaultconf;
}
String defaultMapping = substitute(settings,
attributes.getValue("defaultconfmapping"));
if (defaultMapping != null) {
defaultConfMapping = defaultMapping;
}
String mappingOverride = substitute(settings,
attributes.getValue("confmappingoverride"));
if (mappingOverride != null) {
confMappingOverride = Boolean.valueOf(mappingOverride);
}
} else if ("conf".equals(qName) && insideConfigurations) {
String confName = substitute(settings, attributes.getValue("name"));
if (!confs.contains(confName)) {
buffer.setPrint(true);
if (doIndent) {
write("/>\n\t\t");
}
String extend = substitute(settings, attributes.getValue("extends"));
if (extend != null) {
for (String tok : splitToArray(extend)) {
if (confs.contains(tok)) {
throw new IllegalArgumentException(
"Cannot exclude a configuration which is extended.");
}
}
}
write("<" + qName);
for (int i = 0; i < attributes.getLength(); i++) {
write(" " + attributes.getQName(i) + "=\""
+ substitute(settings, attributes.getValue(i)) + "\"");
}
doIndent = true;
}
}
}
public void endElement(String uri, String localName, String name)
throws SAXException {
if ("configurations".equals(name)) {
insideConfigurations = false;
}
}
});
} catch (Exception e) {
Message.warn("exception occurred while importing configurations: " + e.getMessage());
throw new SAXException(e);
}
}