Buggy code:
public final Document getOwnerDocument ( ) { } public short getNodeType ( ) { } public String getNodeName ( ) { } public Node cloneNode ( 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 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 String getEncoding ( ) { } public String getVersion ( ) { } public boolean getStandalone ( ) { } public Element getDocumentElement ( ) { } public NodeList getElementsByTagName ( String tagname ) { } public DOMImplementation getImplementation ( ) { } public void setErrorChecking ( boolean check ) { } public void setEncoding ( String value ) { } public void setVersion ( String value ) { } public void setStandalone ( boolean value ) { } public boolean getErrorChecking ( ) { } public void setMutationEvents ( boolean set ) { } public 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 { } public Node importNode ( Node source , boolean deep ) throws DOMException { } private Node importNode ( Node source , boolean deep , Hashtable reversedIdentifiers ) throws DOMException { Node newnode = null ; DOMImplementation domImplementation = source . getOwnerDocument ( ) . getImplementation ( ) ; boolean domLevel20 = domImplementation . hasFeature ( "XML" , "2.0" ) ; int type = source . getNodeType ( ) ; switch ( type ) { case Node . ELEMENT_NODE : { Element newElement ; if ( ( domLevel20 == false ) || ( ( source . getLocalName ( ) ) == null ) ) newElement = createElement ( source . getNodeName ( ) ) ; else newElement = createElementNS ( source . getNamespaceURI ( ) , source . getNodeName ( ) ) ; NamedNodeMap sourceAttrs = source . getAttributes ( ) ; if ( sourceAttrs != null ) { int length = sourceAttrs . getLength ( ) ; for ( int index = 0 ; index < length ; index ++ ) { Attr attr = ( ( Attr ) ( sourceAttrs . item ( index ) ) ) ; if ( attr . getSpecified ( ) ) { Attr newAttr = ( ( Attr ) ( importNode ( attr , true , reversedIdentifiers ) ) ) ; if ( ( domLevel20 == false ) || ( ( attr . getLocalName ( ) ) == null ) ) newElement . setAttributeNode ( newAttr ) ; else newElement . setAttributeNodeNS ( newAttr ) ; } } } if ( reversedIdentifiers != null ) { Object elementId = reversedIdentifiers . get ( source ) ; if ( elementId != null ) { if ( ( identifiers ) == null ) identifiers = new Hashtable ( ) ; identifiers . put ( elementId , newElement ) ; } } newnode = newElement ; break ; } case Node . ATTRIBUTE_NODE : { if ( domLevel20 == true ) { if ( ( source . getLocalName ( ) ) == null ) { newnode = createAttribute ( source . getNodeName ( ) ) ; } else { newnode = createAttributeNS ( source . getNamespaceURI ( ) , source . getNodeName ( ) ) ; } } else { newnode = createAttribute ( source . getNodeName ( ) ) ; } if ( source instanceof AttrImpl ) { AttrImpl attr = ( ( AttrImpl ) ( source ) ) ; if ( attr . hasStringValue ( ) ) { AttrImpl newattr = ( ( AttrImpl ) ( newnode ) ) ; <START_BUG> newattr . setValue ( ( ( String ) ( attr . value ) ) ) ; <END_BUG> deep = false ; } else { deep = true ; } } else { deep = true ; } break ; } case Node . TEXT_NODE : { newnode = createTextNode ( source . getNodeValue ( ) ) ; break ; } case Node . CDATA_SECTION_NODE : { newnode = createCDATASection ( source . getNodeValue ( ) ) ; break ; } case Node . ENTITY_REFERENCE_NODE : { newnode = createEntityReference ( source . getNodeName ( ) ) ; ( ( EntityReferenceImpl ) ( newnode ) ) . isReadOnly ( false ) ; break ; } case Node . ENTITY_NODE : { Entity srcentity = ( ( Entity ) ( source ) ) ; EntityImpl newentity = ( ( EntityImpl ) ( createEntity ( source . getNodeName ( ) ) ) ) ; newentity . setPublicId ( srcentity . getPublicId ( ) ) ; newentity . setSystemId ( srcentity . getSystemId ( ) ) ; newentity . setNotationName ( srcentity . getNotationName ( ) ) ; newentity . isReadOnly ( false ) ; newnode = newentity ; break ; } case Node . PROCESSING_INSTRUCTION_NODE : { newnode = createProcessingInstruction ( source . getNodeName ( ) , source . getNodeValue ( ) ) ; break ; } case Node . COMMENT_NODE : { newnode = createComment ( source . getNodeValue ( ) ) ; break ; }

Fix:
newattr . setValue ( attr . getValue ( ) ) ;