}
public Policy resolveReference(String uri) {
int pos = uri.indexOf('#');
String documentURI = pos == -1 ? uri : uri.substring(0, pos);
ExtendedURIResolver resolver = new ExtendedURIResolver();
InputSource is = resolver.resolve(documentURI, baseURI);
if (null == is) {
return null;
}
Document doc = null;
try {
doc = DOMUtils.readXml(is.getByteStream());
} catch (Exception ex) {
throw new PolicyException(ex);
} finally {
resolver.close();
}
if (pos == -1) {
return builder.getPolicy(doc.getDocumentElement());
} else {
String id = uri.substring(pos + 1);