Buggy code:
public class CoreDocumentImpl extends ParentNode implements Document { static final long serialVersionUID = 0 ; protected DocumentTypeImpl docType ; protected ElementImpl docElement ; transient NodeListCache fFreeNLCache ; protected String encoding ; protected String actualEncoding ; protected String version ; protected boolean standalone ; protected String fDocumentURI ; protected Hashtable userData ; protected Hashtable identifiers ; transient DOMNormalizer domNormalizer = null ; transient DOMConfigurationImpl fConfiguration = null ; transient Object fXPathEvaluator = null ; private static final int [ ] kidOK ; protected int changes = 0 ; protected boolean allowGrammarAccess ; protected boolean errorChecking = true ; protected boolean xmlVersionChanged = false ; private int documentNumber = 0 ; private int nodeCounter = 0 ; private Hashtable nodeTable ; private boolean xml11Version = false ; public CoreDocumentImpl ( ) { } public CoreDocumentImpl ( boolean grammarAccess ) { } public CoreDocumentImpl ( DocumentType doctype ) { } public CoreDocumentImpl ( DocumentType doctype , boolean grammarAccess ) { } public final Document getOwnerDocument ( ) { } public short getNodeType ( ) { } public String getNodeName ( ) { } public Node cloneNode ( boolean deep ) { } protected void cloneNode ( CoreDocumentImpl newdoc , boolean deep ) { } public Node insertBefore ( Node newChild , Node refChild ) throws DOMException { } public Node removeChild ( Node oldChild ) throws DOMException { } public Node replaceChild ( Node newChild , Node oldChild ) throws DOMException { } public String getTextContent ( ) throws DOMException { } public void setTextContent ( String textContent ) throws DOMException { } public Object getFeature ( String feature , String version ) { } public Attr createAttribute ( String name ) throws DOMException { } public CDATASection createCDATASection ( String data ) throws DOMException { } public Comment createComment ( String data ) { } public DocumentFragment createDocumentFragment ( ) { } public Element createElement ( String tagName ) throws DOMException { } public EntityReference createEntityReference ( String name ) throws DOMException { } public ProcessingInstruction createProcessingInstruction ( String target , String data ) throws DOMException { } public Text createTextNode ( String data ) { } public DocumentType getDoctype ( ) { } public Element getDocumentElement ( ) { } public NodeList getElementsByTagName ( String tagname ) { } public DOMImplementation getImplementation ( ) { } public void setErrorChecking ( boolean check ) { } public void setStrictErrorChecking ( boolean check ) { } public boolean getErrorChecking ( ) { } public boolean getStrictErrorChecking ( ) { } public String getInputEncoding ( ) { } public void setInputEncoding ( String value ) { } public void setXmlEncoding ( String value ) { } public void setEncoding ( String value ) { } public String getXmlEncoding ( ) { } public String getEncoding ( ) { } public void setXmlVersion ( String value ) { } public void setVersion ( String value ) { } public String getXmlVersion ( ) { } public String getVersion ( ) { } public void setXmlStandalone ( boolean value ) throws DOMException { } public void setStandalone ( boolean value ) { } public boolean getXmlStandalone ( ) { } public boolean getStandalone ( ) { } public String getDocumentURI ( ) { } public Node renameNode ( Node n , String namespaceURI , String name ) throws DOMException { } public void normalizeDocument ( ) { } public DOMConfiguration getDomConfig ( ) { } public String getBaseURI ( ) { if ( ( ( fDocumentURI ) != null ) && ( ( fDocumentURI . length ( ) ) != 0 ) ) { try { <START_BUG> fDocumentURI = new URI ( fDocumentURI ) . toString ( ) ; <END_BUG> } catch ( org . apache . xerces . util e ) { return null ; } } return fDocumentURI ; } public void setDocumentURI ( String documentURI ) { } public boolean getAsync ( ) { } public void setAsync ( boolean async ) { } public void abort ( ) { } public boolean load ( String uri ) { } public boolean loadXML ( String source ) { } public String saveXML ( Node node ) throws DOMException { } void setMutationEvents ( boolean set ) { } boolean getMutationEvents ( ) { } public DocumentType createDocumentType ( String qualifiedName , String publicID , String systemID ) throws DOMException { } public Entity createEntity ( String name ) throws DOMException { } public Notation createNotation ( String name ) throws DOMException { } public ElementDefinitionImpl createElementDefinition ( String name ) throws DOMException { } protected int getNodeNumber ( ) { } protected int getNodeNumber ( Node node ) { } public Node importNode ( Node source , boolean deep ) throws DOMException { } private Node importNode ( Node source , boolean deep , boolean cloningDoc , Hashtable reversedIdentifiers ) throws DOMException { } public Node adoptNode ( Node source ) { } public Element getElementById ( String elementId ) { } protected final void clearIdentifiers ( ) { } public void putIdentifier ( String idName , Element element ) { } public Element getIdentifier ( String idName ) { } public void removeIdentifier ( String idName ) { } public Enumeration getIdentifiers ( ) { } public Element createElementNS ( String namespaceURI , String qualifiedName ) throws DOMException { } public Element createElementNS ( String namespaceURI , String qualifiedName , String localpart ) throws DOMException { } public Attr createAttributeNS ( String namespaceURI , String qualifiedName ) throws DOMException { } public Attr createAttributeNS ( String namespaceURI , String qualifiedName , String localpart ) throws DOMException { } public NodeList getElementsByTagNameNS ( String namespaceURI , String localName ) { } public Object clone ( ) throws CloneNotSupportedException { } public static final boolean isXMLName ( String s , boolean xml11Version ) { } public static final boolean isValidQName ( String prefix , String local , boolean xml11Version ) { } protected boolean isKidOK ( Node parent , Node child ) { }

Fix:
return new URI ( fDocumentURI ) . toString ( ) ;