/**
* Normalizing a URI is resolving that URI according to the rewrite rules defined in an OASIS XML Catalog.
* If the catalog fails to resolve the URI to a file, then this method requires a parent uriConverter
* to delegate normalizing the URI.
*/
override def URI normalize(URI uri) {
if (uri.file)
uri
else {
val resolved = catalog.resolveURI(uri.toString)
if (null !== resolved && resolved.startsWith("file:"))
URI.createURI(resolved)
else if (null !== uriConverter)
uriConverter.normalize(uri)
else
throw new IllegalArgumentException('''No parent URIConverter and no catalog mapping for URI: «uri»''')
}
}
The above implicitly requires that the parent, uriConverter is not the same object as this.
This requirement can be violated in OMLExtensions:
// CatalogURIConverter!
static def OMLCatalog getCatalog(ResourceSet rs) {
val o = rs.loadOptions.get(RESOURCE_SET_CATALOG_INSTANCE) ?: getOrCreateCatalogResolver(rs).catalog
if (OMLCatalog.isInstance(o)) {
val c = OMLCatalog.cast(o)
rs.loadOptions.putIfAbsent(RESOURCE_SET_CATALOG_INSTANCE, c)
val omlc = new CatalogURIConverter(c, rs.URIConverter)
rs.URIConverter = omlc
return c
} else {
return null
}
}
With 0.9.2.1:
In
CatalogURIConveter
:The above implicitly requires that the parent,
uriConverter
is not the same object asthis
.This requirement can be violated in
OMLExtensions
: