throw new MalformedURLException("Mispelled XML:DB URL. " +
"The syntax is \"xmldb:databasetype://host/collection/resource\"");
}
String type = location.substring(start, end);
SourceCredential credential = (SourceCredential)credentialMap.get(type);
if (credential == null) {
throw new MalformedURLException("xmldb type '" + type + "' is unknown for URL " + location);
}
String base = (String)baseMap.get(type);
if (base != null && base.length() > 0) {
String path = location.substring(end+1);
if (!path.startsWith("//")) {
// URL is not absolute, add base, avoiding to double the '/'
if (path.charAt(0) == '/') {
path = path.substring(1);
}
location = location.substring(0, end + 1) + base + path;
}
}
return new XMLDBSource(this.getLogger(), credential.getPrincipal(), credential.getPassword(), location);
}