public Data dereference(URIReference uriReference, XMLCryptoContext context) throws URIReferenceException { if (uriReference == null) { throw new NullPointerException("Parameter 'uriReference' cannot be null."); } if (context == null) { throw new NullPointerException("Parameter 'context' can notbe null."); } if (!(uriReference instanceof DOMURIReference && context instanceof DOMCryptoContext)) { throw new IllegalArgumentException(String.format("This %s implementation supports the DOM XML mechanism only.", URIDereferencer.class.getName())); } String uriString = uriReference.getURI(); if (uriString == null) { throw new URIReferenceException("Cannot resolve a URI of value 'null'."); } if (uriString != null && ((uriString.length() != 0 && uriString.charAt(0) == '#') || uriString.isEmpty())) { // same document uri XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); return fac.getURIDereferencer().dereference(uriReference, context); } throw new URIReferenceException(String.format("URI reference %s not supported", uriString)); }