Program: 152906
Project: 152906
Buggy source:
/** 
 * Creates the equivalent value for the given Spring metadata. Since Spring's metadata is a superset of the Blueprint spec, not all Spring types are supported.
 * @param metadata
 * @return
 */
static Value buildValue(Object metadata){
  if (metadata instanceof BeanMetadataElement) {
    if (metadata instanceof RuntimeBeanReference) {
      RuntimeBeanReference reference=(RuntimeBeanReference)metadata;
      return new SimpleReferenceValue(reference.getBeanName());
    }
    if (metadata instanceof RuntimeBeanNameReference) {
      RuntimeBeanNameReference reference=(RuntimeBeanNameReference)metadata;
      return new SimpleReferenceNameValue(reference.getBeanName());
    }
    if (metadata instanceof TypedStringValue) {
      TypedStringValue typedString=(TypedStringValue)metadata;
      return (typedString.getValue() == null ? NullValue.NULL : new SimpleTypedStringValue(typedString));
    }
    if (metadata instanceof BeanDefinition) {
      ComponentMetadata componentMetadata=MetadataFactory.buildComponentMetadataFor(null,(BeanDefinition)metadata);
      return new SimpleComponentValue((LocalComponentMetadata)componentMetadata);
    }
    if (metadata instanceof BeanDefinitionHolder) {
      BeanDefinitionHolder holder=(BeanDefinitionHolder)metadata;
      ComponentMetadata componentMetadata=MetadataFactory.buildComponentMetadataFor(holder.getBeanName(),holder.getBeanDefinition());
      return new SimpleComponentValue((LocalComponentMetadata)componentMetadata);
    }
    if (metadata instanceof ManagedList) {
      ManagedList list=(ManagedList)metadata;
      Value[] values=new Value[list.size()];
      for (int i=0; i < values.length; i++) {
        Object element=list.get(i);
        values[i]=ValueFactory.buildValue(element);
      }
      String defaultType=null;
      if (list instanceof TempManagedList) {
        defaultType=((TempManagedList)list).getDefaultTypeClassName();
      }
      return new SimpleListValue(values,defaultType);
    }
    if (metadata instanceof ManagedSet) {
      ManagedSet set=(ManagedSet)metadata;
      Value[] values=new Value[set.size()];
      int i=0;
      for (      Object element : set) {
        values[i++]=ValueFactory.buildValue(element);
      }
      String defaultType=null;
      if (set instanceof TempManagedSet) {
        defaultType=((TempManagedSet)set).getDefaultTypeClassName();
      }
      return new SimpleSetValue(values,defaultType);
    }
    if (metadata instanceof ManagedMap) {
      ManagedMap map=(ManagedMap)metadata;
      Value[] keys=new Value[map.size()];
      Value[] values=new Value[map.size()];
      int i=0;
      Set<Map.Entry> entrySet=(Set<Map.Entry>)map.entrySet();
      for (Iterator<Map.Entry> iterator=entrySet.iterator(); iterator.hasNext(); ) {
        Map.Entry next=iterator.next();
        keys[i]=ValueFactory.buildValue(next.getKey());
        values[i]=ValueFactory.buildValue(next.getValue());
        i++;
      }
      String defaultKeyType=null, defaultValueType=null;
      if (map instanceof TempManagedMap) {
        defaultKeyType=((TempManagedMap)map).getKeyDefaultTypeClassName();
        defaultValueType=((TempManagedMap)map).getValueDefaultTypeClassName();
      }
      return new SimpleMapValue(keys,defaultKeyType,values,defaultValueType);
    }
    if (metadata instanceof ManagedProperties) {
      ManagedProperties properties=(ManagedProperties)metadata;
      Properties props=new Properties();
      Set<Map.Entry<Object,Object>> entrySet=(Set<Map.Entry<Object,Object>>)properties.entrySet();
      for (Iterator<Map.Entry<Object,Object>> iterator=entrySet.iterator(); iterator.hasNext(); ) {
        Map.Entry<Object,Object> next=iterator.next();
        Object key=ValueFactory.buildValue(next.getKey());
        Object value=ValueFactory.buildValue(next.getValue());
        props.put(key,value);
      }
      return new SimplePropertiesValue(props);
    }
    throw new IllegalArgumentException("String_Node_Str" + metadata.getClass());
  }
  throw new UnsupportedOperationException("String_Node_Str" + metadata + "String_Node_Str"+ metadata.getClass());
}

Fixed version (ground truth):
/** 
 * Creates the equivalent value for the given Spring metadata. Since Spring's metadata is a superset of the Blueprint spec, not all Spring types are supported.
 * @param metadata
 * @return
 */
static Value buildValue(Object metadata){
  if (metadata instanceof BeanMetadataElement) {
    if (metadata instanceof RuntimeBeanReference) {
      RuntimeBeanReference reference=(RuntimeBeanReference)metadata;
      return new SimpleReferenceValue(reference.getBeanName());
    }
    if (metadata instanceof RuntimeBeanNameReference) {
      RuntimeBeanNameReference reference=(RuntimeBeanNameReference)metadata;
      return new SimpleReferenceNameValue(reference.getBeanName());
    }
    if (metadata instanceof TypedStringValue) {
      TypedStringValue typedString=(TypedStringValue)metadata;
      return (typedString.getValue() == null ? NullValue.NULL : new SimpleTypedStringValue(typedString));
    }
    if (metadata instanceof BeanDefinition) {
      ComponentMetadata componentMetadata=MetadataFactory.buildComponentMetadataFor(null,(BeanDefinition)metadata);
      return new SimpleComponentValue((LocalComponentMetadata)componentMetadata);
    }
    if (metadata instanceof BeanDefinitionHolder) {
      BeanDefinitionHolder holder=(BeanDefinitionHolder)metadata;
      ComponentMetadata componentMetadata=MetadataFactory.buildComponentMetadataFor(null,holder.getBeanDefinition());
      return new SimpleComponentValue((LocalComponentMetadata)componentMetadata);
    }
    if (metadata instanceof ManagedList) {
      ManagedList list=(ManagedList)metadata;
      Value[] values=new Value[list.size()];
      for (int i=0; i < values.length; i++) {
        Object element=list.get(i);
        values[i]=ValueFactory.buildValue(element);
      }
      String defaultType=null;
      if (list instanceof TempManagedList) {
        defaultType=((TempManagedList)list).getDefaultTypeClassName();
      }
      return new SimpleListValue(values,defaultType);
    }
    if (metadata instanceof ManagedSet) {
      ManagedSet set=(ManagedSet)metadata;
      Value[] values=new Value[set.size()];
      int i=0;
      for (      Object element : set) {
        values[i++]=ValueFactory.buildValue(element);
      }
      String defaultType=null;
      if (set instanceof TempManagedSet) {
        defaultType=((TempManagedSet)set).getDefaultTypeClassName();
      }
      return new SimpleSetValue(values,defaultType);
    }
    if (metadata instanceof ManagedMap) {
      ManagedMap map=(ManagedMap)metadata;
      Value[] keys=new Value[map.size()];
      Value[] values=new Value[map.size()];
      int i=0;
      Set<Map.Entry> entrySet=(Set<Map.Entry>)map.entrySet();
      for (Iterator<Map.Entry> iterator=entrySet.iterator(); iterator.hasNext(); ) {
        Map.Entry next=iterator.next();
        keys[i]=ValueFactory.buildValue(next.getKey());
        values[i]=ValueFactory.buildValue(next.getValue());
        i++;
      }
      String defaultKeyType=null, defaultValueType=null;
      if (map instanceof TempManagedMap) {
        defaultKeyType=((TempManagedMap)map).getKeyDefaultTypeClassName();
        defaultValueType=((TempManagedMap)map).getValueDefaultTypeClassName();
      }
      return new SimpleMapValue(keys,defaultKeyType,values,defaultValueType);
    }
    if (metadata instanceof ManagedProperties) {
      ManagedProperties properties=(ManagedProperties)metadata;
      Properties props=new Properties();
      Set<Map.Entry<Object,Object>> entrySet=(Set<Map.Entry<Object,Object>>)properties.entrySet();
      for (Iterator<Map.Entry<Object,Object>> iterator=entrySet.iterator(); iterator.hasNext(); ) {
        Map.Entry<Object,Object> next=iterator.next();
        Object key=ValueFactory.buildValue(next.getKey());
        Object value=ValueFactory.buildValue(next.getValue());
        props.put(key,value);
      }
      return new SimplePropertiesValue(props);
    }
    throw new IllegalArgumentException("String_Node_Str" + metadata.getClass());
  }
  throw new UnsupportedOperationException("String_Node_Str" + metadata + "String_Node_Str"+ metadata.getClass());
}