Program: 152911
Project: 152911
Buggy source:
/** 
 * Parse a map element.
 */
private Map<?,?> parseMapElement(Element mapEle,BeanDefinition bd){
  String defaultKeyTypeClassName=mapEle.getAttribute(BeanDefinitionParserDelegate.KEY_TYPE_ATTRIBUTE);
  String defaultValueTypeClassName=mapEle.getAttribute(BeanDefinitionParserDelegate.VALUE_TYPE_ATTRIBUTE);
  List<Element> entryEles=DomUtils.getChildElementsByTagName(mapEle,BeanDefinitionParserDelegate.ENTRY_ELEMENT);
  ManagedMap map=new ManagedMap(entryEles.size());
  map.setMergeEnabled(parserContext.getDelegate().parseMergeAttribute(mapEle));
  map.setSource(parserContext.extractSource(mapEle));
  for (  Element entryEle : entryEles) {
    NodeList entrySubNodes=entryEle.getChildNodes();
    Element keyEle=null;
    Element valueEle=null;
    for (int j=0; j < entrySubNodes.getLength(); j++) {
      Node node=entrySubNodes.item(j);
      if (node instanceof Element) {
        Element candidateEle=(Element)node;
        if (DomUtils.nodeNameEquals(candidateEle,BeanDefinitionParserDelegate.KEY_ELEMENT)) {
          if (keyEle != null) {
            error("String_Node_Str",entryEle);
          }
 else {
            keyEle=candidateEle;
          }
        }
 else {
          if (valueEle != null) {
            error("String_Node_Str",entryEle);
          }
 else {
            valueEle=candidateEle;
          }
        }
      }
    }
    Object key=null;
    boolean hasKeyAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.KEY_ATTRIBUTE);
    boolean hasKeyRefAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.KEY_REF_ATTRIBUTE);
    if ((hasKeyAttribute && hasKeyRefAttribute) || ((hasKeyAttribute || hasKeyRefAttribute)) && keyEle != null) {
      error("String_Node_Str" + "String_Node_Str",entryEle);
    }
    if (hasKeyAttribute) {
      key=buildTypedStringValueForMap(entryEle.getAttribute(BeanDefinitionParserDelegate.KEY_ATTRIBUTE),defaultKeyTypeClassName,entryEle);
    }
 else     if (hasKeyRefAttribute) {
      String refName=entryEle.getAttribute(BeanDefinitionParserDelegate.KEY_REF_ATTRIBUTE);
      if (!StringUtils.hasText(refName)) {
        error("String_Node_Str",entryEle);
      }
      RuntimeBeanReference ref=new RuntimeBeanReference(refName);
      ref.setSource(parserContext.extractSource(entryEle));
      key=ref;
    }
 else     if (keyEle != null) {
      key=parseKeyElement(keyEle,bd,defaultKeyTypeClassName);
    }
 else {
      error("String_Node_Str",entryEle);
    }
    Object value=null;
    boolean hasValueAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.VALUE_ATTRIBUTE);
    boolean hasValueRefAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.VALUE_REF_ATTRIBUTE);
    if ((hasValueAttribute && hasValueRefAttribute) || ((hasValueAttribute || hasValueRefAttribute)) && valueEle != null) {
      error("String_Node_Str" + "String_Node_Str",entryEle);
    }
    if (hasValueAttribute) {
      value=buildTypedStringValueForMap(entryEle.getAttribute(BeanDefinitionParserDelegate.VALUE_ATTRIBUTE),defaultValueTypeClassName,entryEle);
    }
 else     if (hasValueRefAttribute) {
      String refName=entryEle.getAttribute(BeanDefinitionParserDelegate.VALUE_REF_ATTRIBUTE);
      if (!StringUtils.hasText(refName)) {
        error("String_Node_Str",entryEle);
      }
      RuntimeBeanReference ref=new RuntimeBeanReference(refName);
      ref.setSource(parserContext.extractSource(entryEle));
      value=ref;
    }
 else     if (valueEle != null) {
      value=parsePropertySubElement(valueEle,bd,defaultValueTypeClassName);
    }
 else {
      error("String_Node_Str",entryEle);
    }
    map.put(key,value);
  }
  return map;
}

Fixed version (ground truth):
/** 
 * Parse a map element.
 */
private Map<?,?> parseMapElement(Element mapEle,BeanDefinition bd){
  String defaultKeyTypeClassName=mapEle.getAttribute(BeanDefinitionParserDelegate.KEY_TYPE_ATTRIBUTE);
  String defaultValueTypeClassName=mapEle.getAttribute(BeanDefinitionParserDelegate.VALUE_TYPE_ATTRIBUTE);
  List<Element> entryEles=DomUtils.getChildElementsByTagName(mapEle,BeanDefinitionParserDelegate.ENTRY_ELEMENT);
  ManagedMap map=new TempManagedMap(entryEles.size(),defaultKeyTypeClassName,defaultValueTypeClassName);
  map.setMergeEnabled(parserContext.getDelegate().parseMergeAttribute(mapEle));
  map.setSource(parserContext.extractSource(mapEle));
  for (  Element entryEle : entryEles) {
    NodeList entrySubNodes=entryEle.getChildNodes();
    Element keyEle=null;
    Element valueEle=null;
    for (int j=0; j < entrySubNodes.getLength(); j++) {
      Node node=entrySubNodes.item(j);
      if (node instanceof Element) {
        Element candidateEle=(Element)node;
        if (DomUtils.nodeNameEquals(candidateEle,BeanDefinitionParserDelegate.KEY_ELEMENT)) {
          if (keyEle != null) {
            error("String_Node_Str",entryEle);
          }
 else {
            keyEle=candidateEle;
          }
        }
 else {
          if (valueEle != null) {
            error("String_Node_Str",entryEle);
          }
 else {
            valueEle=candidateEle;
          }
        }
      }
    }
    Object key=null;
    boolean hasKeyAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.KEY_ATTRIBUTE);
    boolean hasKeyRefAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.KEY_REF_ATTRIBUTE);
    if ((hasKeyAttribute && hasKeyRefAttribute) || ((hasKeyAttribute || hasKeyRefAttribute)) && keyEle != null) {
      error("String_Node_Str" + "String_Node_Str",entryEle);
    }
    if (hasKeyAttribute) {
      key=buildTypedStringValueForMap(entryEle.getAttribute(BeanDefinitionParserDelegate.KEY_ATTRIBUTE),defaultKeyTypeClassName,entryEle);
    }
 else     if (hasKeyRefAttribute) {
      String refName=entryEle.getAttribute(BeanDefinitionParserDelegate.KEY_REF_ATTRIBUTE);
      if (!StringUtils.hasText(refName)) {
        error("String_Node_Str",entryEle);
      }
      RuntimeBeanReference ref=new RuntimeBeanReference(refName);
      ref.setSource(parserContext.extractSource(entryEle));
      key=ref;
    }
 else     if (keyEle != null) {
      key=parseKeyElement(keyEle,bd,defaultKeyTypeClassName);
    }
 else {
      error("String_Node_Str",entryEle);
    }
    Object value=null;
    boolean hasValueAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.VALUE_ATTRIBUTE);
    boolean hasValueRefAttribute=entryEle.hasAttribute(BeanDefinitionParserDelegate.VALUE_REF_ATTRIBUTE);
    if ((hasValueAttribute && hasValueRefAttribute) || ((hasValueAttribute || hasValueRefAttribute)) && valueEle != null) {
      error("String_Node_Str" + "String_Node_Str",entryEle);
    }
    if (hasValueAttribute) {
      value=buildTypedStringValueForMap(entryEle.getAttribute(BeanDefinitionParserDelegate.VALUE_ATTRIBUTE),defaultValueTypeClassName,entryEle);
    }
 else     if (hasValueRefAttribute) {
      String refName=entryEle.getAttribute(BeanDefinitionParserDelegate.VALUE_REF_ATTRIBUTE);
      if (!StringUtils.hasText(refName)) {
        error("String_Node_Str",entryEle);
      }
      RuntimeBeanReference ref=new RuntimeBeanReference(refName);
      ref.setSource(parserContext.extractSource(entryEle));
      value=ref;
    }
 else     if (valueEle != null) {
      value=parsePropertySubElement(valueEle,bd,defaultValueTypeClassName);
    }
 else {
      error("String_Node_Str",entryEle);
    }
    map.put(key,value);
  }
  return map;
}