if (prefix != null && namespace != null) {
if (namespace.endsWith("/") || namespace.endsWith("#")) {
try {
new URI(namespace);
} catch (URISyntaxException e) {
throw new InvalidNamespaceException("'" + namespace + "' is not a URI");
}
return mappings.put(prefix, namespace);
} else {
throw new InvalidNamespaceException("'" + namespace + "' is not a valid URI for a namespace");
}
} else {
//FIXME: this implementation (HashBiMap) allows null keys and values, but we don't want them!
throw new IllegalArgumentException("null parameters are not allowed");
}