Program: 59384
Project: 59384
Buggy source:
@Override public <T>T getCapability(Capability<T> capability,final EnumFacing from){
  if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
    return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(new IFluidHandler(){
      @Override public IFluidTankProperties[] getTankProperties(){
        FluidTankProperties[] properties=new FluidTankProperties[tanks.length];
        for (int i=0; i < tanks.length; i++) {
          FluidTankInfo info=tanks[i].getInfo();
          properties[i]=new FluidTankProperties(info.fluid,info.capacity);
        }
        return properties;
      }
      @Override public int fill(      FluidStack resource,      boolean doFill){
        if (from == null || allowInsertion(sideConfig.sideTypes[sideCache[from.ordinal()]])) {
          if (resource == null) {
            return 0;
          }
          for (int j=0; j < tanks.length && tanks[j].getSpace() > 0; j++) {
            int toFill=tanks[j].fill(resource,doFill);
            if (toFill > 0) {
              return toFill;
            }
          }
        }
        return 0;
      }
      @Nullable @Override public FluidStack drain(      FluidStack resource,      boolean doDrain){
        if (from == null || allowExtraction(sideConfig.sideTypes[sideCache[from.ordinal()]])) {
          if (resource == null) {
            return null;
          }
          for (int j=tanks.length - 1; j >= 0 && tanks[j].getFluidAmount() > 0; j--) {
            FluidStack toDrain=tanks[j].drain(resource,doDrain);
            if (toDrain != null) {
              return toDrain;
            }
          }
        }
        return null;
      }
      @Nullable @Override public FluidStack drain(      int maxDrain,      boolean doDrain){
        if (from == null || allowExtraction(sideConfig.sideTypes[sideCache[from.ordinal()]])) {
          if (maxDrain <= 0) {
            return null;
          }
          for (int j=tanks.length - 1; j >= 0 && tanks[j].getFluidAmount() > 0; j--) {
            FluidStack toDrain=tanks[j].drain(maxDrain,doDrain);
            if (toDrain != null) {
              return toDrain;
            }
          }
        }
        return null;
      }
    }
);
  }
  return super.getCapability(capability,from);
}

Fixed version (ground truth):
@Override public <T>T getCapability(Capability<T> capability,final EnumFacing from){
  if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
    return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(new IFluidHandler(){
      @Override public IFluidTankProperties[] getTankProperties(){
        FluidTankProperties[] properties=new FluidTankProperties[tanks.length];
        for (int i=0; i < tanks.length; i++) {
          FluidTankInfo info=tanks[i].getInfo();
          properties[i]=new FluidTankProperties(info.fluid,info.capacity);
        }
        return properties;
      }
      @Override public int fill(      FluidStack resource,      boolean doFill){
        if (from == null || allowInsertion(sideConfig.sideTypes[sideCache[from.ordinal()]])) {
          if (resource == null) {
            return 0;
          }
          for (int j=0; j < tanks.length && tanks[j].getSpace() > 0; j++) {
            int toFill=tanks[j].fill(new FluidStack(resource,Math.min(resource.amount,amountInput)),doFill);
            if (toFill > 0) {
              return toFill;
            }
          }
        }
        return 0;
      }
      @Nullable @Override public FluidStack drain(      FluidStack resource,      boolean doDrain){
        if (from == null || allowExtraction(sideConfig.sideTypes[sideCache[from.ordinal()]])) {
          if (resource == null) {
            return null;
          }
          for (int j=tanks.length - 1; j >= 0; j--) {
            if (tanks[j].getFluidAmount() <= 0) {
              continue;
            }
            return tanks[j].drain(new FluidStack(resource,Math.min(resource.amount,amountOutput)),doDrain);
          }
        }
        return null;
      }
      @Nullable @Override public FluidStack drain(      int maxDrain,      boolean doDrain){
        if (from == null || allowExtraction(sideConfig.sideTypes[sideCache[from.ordinal()]])) {
          if (maxDrain <= 0) {
            return null;
          }
          for (int j=tanks.length - 1; j >= 0; j--) {
            if (tanks[j].getFluidAmount() <= 0) {
              continue;
            }
            return tanks[j].drain(Math.min(maxDrain,amountOutput),doDrain);
          }
        }
        return null;
      }
    }
);
  }
  return super.getCapability(capability,from);
}