Program: 157066
Project: 157066
Buggy source:
public EnergyValue getEnergyValueFromMap(Map<WrappedStack,EnergyValue> stackEnergyValueMap,Object object,boolean strict){
  if (WrappedStack.canBeWrapped(object)) {
    WrappedStack wrappedStackObject=new WrappedStack(object);
    WrappedStack unitWrappedStackObject=new WrappedStack(object);
    unitWrappedStackObject.setStackSize(1);
    Object wrappedObject=wrappedStackObject.getWrappedObject();
    if (wrappedObject instanceof ItemStack && ((ItemStack)wrappedObject).getItem() instanceof IEnergyValueProvider && !strict) {
      ItemStack itemStack=(ItemStack)wrappedObject;
      IEnergyValueProvider iEnergyValueProvider=(IEnergyValueProvider)itemStack.getItem();
      EnergyValue energyValue=iEnergyValueProvider.getEnergyValue(itemStack);
      if (energyValue != null && energyValue.getEnergyValue() > 0f) {
        return energyValue;
      }
    }
 else     if (stackEnergyValueMap != null) {
      if (stackEnergyValueMap.containsKey(unitWrappedStackObject)) {
        return stackEnergyValueMap.get(unitWrappedStackObject);
      }
 else       if (!strict) {
        if (wrappedObject instanceof ItemStack) {
          EnergyValue lowestValue=null;
          ItemStack wrappedItemStack=(ItemStack)wrappedObject;
          if (CachedOreDictionary.getInstance().getOreNamesForItemStack(wrappedItemStack).size() == 1) {
            OreStack oreStack=new OreStack(wrappedItemStack);
            if (stackEnergyValueMap.containsKey(new WrappedStack(oreStack))) {
              return stackEnergyValueMap.get(new WrappedStack(oreStack));
            }
          }
 else {
            for (            WrappedStack valuedStack : stackEnergyValueMap.keySet()) {
              if (valuedStack.getWrappedObject() instanceof ItemStack) {
                ItemStack valuedItemStack=(ItemStack)valuedStack.getWrappedObject();
                if (Item.getIdFromItem(valuedItemStack.getItem()) == Item.getIdFromItem(wrappedItemStack.getItem())) {
                  if (valuedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || wrappedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
                    EnergyValue stackValue=stackEnergyValueMap.get(valuedStack);
                    if (stackValue.compareTo(lowestValue) < 0) {
                      lowestValue=stackValue;
                    }
                  }
 else                   if (wrappedItemStack.getItem().isDamageable() && wrappedItemStack.isItemDamaged()) {
                    EnergyValue stackValue=new EnergyValue(stackEnergyValueMap.get(valuedStack).getEnergyValue() * (1 - (wrappedItemStack.getItemDamage() * 1.0F / wrappedItemStack.getMaxDamage())));
                    if (stackValue.compareTo(lowestValue) < 0) {
                      lowestValue=stackValue;
                    }
                  }
                }
              }
            }
            return lowestValue;
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public EnergyValue getEnergyValueFromMap(Map<WrappedStack,EnergyValue> stackEnergyValueMap,Object object,boolean strict){
  if (WrappedStack.canBeWrapped(object)) {
    WrappedStack wrappedStackObject=new WrappedStack(object);
    WrappedStack unitWrappedStackObject=new WrappedStack(object);
    unitWrappedStackObject.setStackSize(1);
    Object wrappedObject=wrappedStackObject.getWrappedObject();
    if (wrappedObject instanceof ItemStack && ((ItemStack)wrappedObject).getItem() instanceof IEnergyValueProvider && !strict) {
      ItemStack itemStack=(ItemStack)wrappedObject;
      IEnergyValueProvider iEnergyValueProvider=(IEnergyValueProvider)itemStack.getItem();
      EnergyValue energyValue=iEnergyValueProvider.getEnergyValue(itemStack);
      if (energyValue != null && energyValue.getEnergyValue() > 0f) {
        return energyValue;
      }
    }
 else     if (stackEnergyValueMap != null) {
      if (stackEnergyValueMap.containsKey(unitWrappedStackObject)) {
        return stackEnergyValueMap.get(unitWrappedStackObject);
      }
 else       if (!strict) {
        if (wrappedObject instanceof ItemStack) {
          EnergyValue lowestValue=null;
          ItemStack wrappedItemStack=(ItemStack)wrappedObject;
          if (OreDictionary.getOreIDs(wrappedItemStack).length == 1) {
            OreStack oreStack=new OreStack(OreDictionary.getOreName(OreDictionary.getOreIDs(wrappedItemStack)[0]));
            if (stackEnergyValueMap.containsKey(new WrappedStack(oreStack))) {
              return stackEnergyValueMap.get(new WrappedStack(oreStack));
            }
          }
 else {
            for (            WrappedStack valuedStack : stackEnergyValueMap.keySet()) {
              if (valuedStack.getWrappedObject() instanceof ItemStack) {
                ItemStack valuedItemStack=(ItemStack)valuedStack.getWrappedObject();
                if (Item.getIdFromItem(valuedItemStack.getItem()) == Item.getIdFromItem(wrappedItemStack.getItem())) {
                  if (valuedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || wrappedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
                    EnergyValue stackValue=stackEnergyValueMap.get(valuedStack);
                    if (stackValue.compareTo(lowestValue) < 0) {
                      lowestValue=stackValue;
                    }
                  }
 else                   if (wrappedItemStack.getItem().isDamageable() && wrappedItemStack.isItemDamaged()) {
                    EnergyValue stackValue=new EnergyValue(stackEnergyValueMap.get(valuedStack).getEnergyValue() * (1 - (wrappedItemStack.getItemDamage() * 1.0F / wrappedItemStack.getMaxDamage())));
                    if (stackValue.compareTo(lowestValue) < 0) {
                      lowestValue=stackValue;
                    }
                  }
                }
              }
            }
            return lowestValue;
          }
        }
      }
    }
  }
  return null;
}