Program: 31469
Project: 31469
Buggy source:
public static void setItems(@Nonnull EntityPlayer player,@Nonnull Map<Integer,ItemStack> slotMap,@Nonnull Collection<Integer> craftingSlots,@Nonnull Collection<Integer> inventorySlots){
  Container container=player.openContainer;
  List<ItemStack> removeRecipeItems=new ArrayList<>();
  for (  ItemStack matchingStack : slotMap.values()) {
    ItemStack requiredStack=matchingStack.copy();
    while (requiredStack.stackSize > 0) {
      Slot inventorySlot=getSlotWithStack(container,craftingSlots,requiredStack);
      if (inventorySlot == null) {
        inventorySlot=getSlotWithStack(container,inventorySlots,requiredStack);
        if (inventorySlot == null) {
          Log.error("String_Node_Str");
          List<Integer> allSlots=new ArrayList<>();
          allSlots.addAll(inventorySlots);
          allSlots.addAll(craftingSlots);
          for (          ItemStack removedRecipeItem : removeRecipeItems) {
            StackUtil.addStack(container,allSlots,removedRecipeItem,true);
          }
          return;
        }
      }
      ItemStack removed=inventorySlot.decrStackSize(requiredStack.stackSize);
      removeRecipeItems.add(removed);
      requiredStack.stackSize-=removed.stackSize;
    }
  }
  List<ItemStack> clearedCraftingItems=new ArrayList<>();
  for (  Integer craftingSlotIndex : craftingSlots) {
    Slot craftingSlot=container.getSlot(craftingSlotIndex);
    if (craftingSlot != null && craftingSlot.getHasStack()) {
      ItemStack craftingItem=craftingSlot.decrStackSize(Integer.MAX_VALUE);
      clearedCraftingItems.add(craftingItem);
    }
  }
  for (  Map.Entry<Integer,ItemStack> entry : slotMap.entrySet()) {
    ItemStack stack=entry.getValue();
    Integer slotIndex=entry.getKey();
    Slot slot=container.getSlot(slotIndex);
    slot.putStack(stack);
  }
  for (  ItemStack oldCraftingItem : clearedCraftingItems) {
    StackUtil.addStack(container,inventorySlots,oldCraftingItem,true);
  }
  container.detectAndSendChanges();
}

Fixed version (ground truth):
public static void setItems(@Nonnull EntityPlayer player,@Nonnull Map<Integer,ItemStack> slotMap,@Nonnull List<Integer> craftingSlots,@Nonnull List<Integer> inventorySlots){
  Container container=player.openContainer;
  List<ItemStack> removeRecipeItems=new ArrayList<>();
  for (  ItemStack matchingStack : slotMap.values()) {
    ItemStack requiredStack=matchingStack.copy();
    while (requiredStack.stackSize > 0) {
      Slot inventorySlot=getSlotWithStack(container,craftingSlots,requiredStack);
      if (inventorySlot == null) {
        inventorySlot=getSlotWithStack(container,inventorySlots,requiredStack);
        if (inventorySlot == null) {
          Log.error("String_Node_Str");
          List<Integer> allSlots=new ArrayList<>();
          allSlots.addAll(inventorySlots);
          allSlots.addAll(craftingSlots);
          for (          ItemStack removedRecipeItem : removeRecipeItems) {
            StackUtil.addStack(container,allSlots,removedRecipeItem,true);
          }
          return;
        }
      }
      ItemStack removed=inventorySlot.decrStackSize(requiredStack.stackSize);
      removeRecipeItems.add(removed);
      requiredStack.stackSize-=removed.stackSize;
    }
  }
  List<ItemStack> clearedCraftingItems=new ArrayList<>();
  for (  Integer craftingSlotNumber : craftingSlots) {
    Slot craftingSlot=container.getSlot(craftingSlotNumber);
    if (craftingSlot != null && craftingSlot.getHasStack()) {
      ItemStack craftingItem=craftingSlot.decrStackSize(Integer.MAX_VALUE);
      clearedCraftingItems.add(craftingItem);
    }
  }
  for (  Map.Entry<Integer,ItemStack> entry : slotMap.entrySet()) {
    ItemStack stack=entry.getValue();
    Integer craftNumber=entry.getKey();
    Integer slotNumber=craftingSlots.get(craftNumber);
    Slot slot=container.getSlot(slotNumber);
    slot.putStack(stack);
  }
  for (  ItemStack oldCraftingItem : clearedCraftingItems) {
    StackUtil.addStack(container,inventorySlots,oldCraftingItem,true);
  }
  container.detectAndSendChanges();
}