Program: 92838
Project: 92838
Buggy source:
protected Object getNestedQueryMappingValue(ResultSet rs,MetaObject metaResultObject,ResultMapping propertyMapping,ResultLoaderMap lazyLoader,String columnPrefix) throws SQLException {
  final String nestedQueryId=propertyMapping.getNestedQueryId();
  final String property=propertyMapping.getProperty();
  final MappedStatement nestedQuery=configuration.getMappedStatement(nestedQueryId);
  final Class<?> nestedQueryParameterType=nestedQuery.getParameterMap().getType();
  final Object nestedQueryParameterObject=prepareParameterForNestedQuery(rs,propertyMapping,nestedQueryParameterType,columnPrefix);
  Object value=OMIT;
  if (nestedQueryParameterObject != null) {
    final BoundSql nestedBoundSql=nestedQuery.getBoundSql(nestedQueryParameterObject);
    final CacheKey key=executor.createCacheKey(nestedQuery,nestedQueryParameterObject,RowBounds.DEFAULT,nestedBoundSql);
    final Class<?> targetType=propertyMapping.getJavaType();
    final Object nestedQueryCacheObject=getNestedQueryCacheObject(nestedQuery,key);
    if (nestedQueryCacheObject != null && nestedQueryCacheObject instanceof List) {
      value=resultExtractor.extractObjectFromList((List<Object>)nestedQueryCacheObject,targetType);
    }
 else     if (executor.isCached(nestedQuery,key)) {
      executor.deferLoad(nestedQuery,metaResultObject,property,key);
    }
 else {
      final ResultLoader resultLoader=new ResultLoader(configuration,executor,nestedQuery,nestedQueryParameterObject,targetType,key,nestedBoundSql);
      if (configuration.isLazyLoadingEnabled()) {
        lazyLoader.addLoader(property,metaResultObject,resultLoader);
      }
 else {
        value=resultLoader.loadResult();
      }
    }
  }
  return value;
}

Fixed version (ground truth):
protected Object getNestedQueryMappingValue(ResultSet rs,MetaObject metaResultObject,ResultMapping propertyMapping,ResultLoaderMap lazyLoader,String columnPrefix) throws SQLException {
  final String nestedQueryId=propertyMapping.getNestedQueryId();
  final String property=propertyMapping.getProperty();
  final MappedStatement nestedQuery=configuration.getMappedStatement(nestedQueryId);
  final Class<?> nestedQueryParameterType=nestedQuery.getParameterMap().getType();
  final Object nestedQueryParameterObject=prepareParameterForNestedQuery(rs,propertyMapping,nestedQueryParameterType,columnPrefix);
  Object value=OMIT;
  if (nestedQueryParameterObject != null) {
    final BoundSql nestedBoundSql=nestedQuery.getBoundSql(nestedQueryParameterObject);
    final CacheKey key=executor.createCacheKey(nestedQuery,nestedQueryParameterObject,RowBounds.DEFAULT,nestedBoundSql);
    final Class<?> targetType=propertyMapping.getJavaType();
    final Object nestedQueryCacheObject=getNestedQueryCacheObject(nestedQuery,key);
    if (nestedQueryCacheObject != null && nestedQueryCacheObject instanceof List) {
      value=resultExtractor.extractObjectFromList((List<Object>)nestedQueryCacheObject,targetType);
    }
 else     if (executor.isCached(nestedQuery,key)) {
      executor.deferLoad(nestedQuery,metaResultObject,property,key,targetType);
    }
 else {
      final ResultLoader resultLoader=new ResultLoader(configuration,executor,nestedQuery,nestedQueryParameterObject,targetType,key,nestedBoundSql);
      if (configuration.isLazyLoadingEnabled()) {
        lazyLoader.addLoader(property,metaResultObject,resultLoader);
      }
 else {
        value=resultLoader.loadResult();
      }
    }
  }
  return value;
}