Program: 8723
Project: 8723
Buggy source:
/** 
 * Given a multimap returned by the merge iterator, return an Op that should be the new value in the live production cube, or null if the value in the live production cube should be deleted.
 * @return an ActionRowKeyAndOp telling what action should be taken for this row
 */
private static final ActionRowKeyAndOp makeNewLiveCubeOp(Deserializer<?> deserializer,Collection<Result> liveCubeResults,Collection<Result> snapshotResults,Collection<Result> backfilledResults,Context ctx) throws IOException {
  Op liveCubeOp=null;
  Op snapshotOp=null;
  Op backfilledOp=null;
  byte[] rowKey=null;
  if (!liveCubeResults.isEmpty()) {
    Result result=liveCubeResults.iterator().next();
    liveCubeOp=deserializer.fromBytes(result.value());
    rowKey=result.getRow();
  }
  if (!snapshotResults.isEmpty()) {
    Result result=snapshotResults.iterator().next();
    snapshotOp=deserializer.fromBytes(result.value());
    rowKey=result.getRow();
  }
  if (!backfilledResults.isEmpty()) {
    Result result=backfilledResults.iterator().next();
    backfilledOp=deserializer.fromBytes(result.value());
    rowKey=result.getRow();
  }
  if (snapshotOp != null && backfilledOp != null && liveCubeOp != null) {
    if (liveCubeOp.equals(snapshotOp)) {
      return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,backfilledOp);
    }
    Op newLiveCubeValue=(liveCubeOp.subtract(snapshotOp)).add(backfilledOp);
    if (newLiveCubeValue.equals(liveCubeOp)) {
      return new ActionRowKeyAndOp(Action.LEAVE_ALONE,rowKey,null);
    }
 else {
      return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,newLiveCubeValue);
    }
  }
 else   if (snapshotOp != null && backfilledOp == null && liveCubeOp != null) {
    if (liveCubeOp.equals(snapshotOp)) {
      return new ActionRowKeyAndOp(Action.DELETE,rowKey,null);
    }
 else {
      Op newLiveCubeValue=liveCubeOp.subtract(snapshotOp);
      return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,newLiveCubeValue);
    }
  }
 else   if (snapshotOp == null && backfilledOp != null && liveCubeOp != null) {
    Op newLiveCubeValue=backfilledOp.add(liveCubeOp);
    return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,newLiveCubeValue);
  }
 else   if (snapshotOp == null && backfilledOp != null && liveCubeOp == null) {
    return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,backfilledOp);
  }
 else   if (snapshotOp == null && backfilledOp == null && liveCubeOp != null) {
    return new ActionRowKeyAndOp(Action.LEAVE_ALONE,rowKey,null);
  }
 else   if (snapshotOp == null && backfilledOp == null && liveCubeOp == null) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
 else   if (snapshotOp != null && backfilledOp != null && liveCubeOp == null) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
 else {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Given a multimap returned by the merge iterator, return an Op that should be the new value in the live production cube, or null if the value in the live production cube should be deleted.
 * @return an ActionRowKeyAndOp telling what action should be taken for this row
 */
private static final ActionRowKeyAndOp makeNewLiveCubeOp(Deserializer<?> deserializer,Collection<Result> liveCubeResults,Collection<Result> snapshotResults,Collection<Result> backfilledResults,Context ctx) throws IOException {
  Op liveCubeOp=null;
  Op snapshotOp=null;
  Op backfilledOp=null;
  byte[] rowKey=null;
  if (!liveCubeResults.isEmpty()) {
    Result result=liveCubeResults.iterator().next();
    liveCubeOp=deserializer.fromBytes(result.value());
    rowKey=result.getRow();
  }
  if (!snapshotResults.isEmpty()) {
    Result result=snapshotResults.iterator().next();
    snapshotOp=deserializer.fromBytes(result.value());
    rowKey=result.getRow();
  }
  if (!backfilledResults.isEmpty()) {
    Result result=backfilledResults.iterator().next();
    backfilledOp=deserializer.fromBytes(result.value());
    rowKey=result.getRow();
  }
  if (snapshotOp != null && backfilledOp != null && liveCubeOp != null) {
    DebugHack.log("String_Node_Str");
    if (liveCubeOp.equals(snapshotOp)) {
      return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,backfilledOp);
    }
    Op newLiveCubeValue=(liveCubeOp.subtract(snapshotOp)).add(backfilledOp);
    if (newLiveCubeValue.equals(liveCubeOp)) {
      return new ActionRowKeyAndOp(Action.LEAVE_ALONE,rowKey,null);
    }
 else {
      return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,newLiveCubeValue);
    }
  }
 else   if (snapshotOp != null && backfilledOp == null && liveCubeOp != null) {
    DebugHack.log("String_Node_Str");
    if (liveCubeOp.equals(snapshotOp)) {
      return new ActionRowKeyAndOp(Action.DELETE,rowKey,null);
    }
 else {
      Op newLiveCubeValue=liveCubeOp.subtract(snapshotOp);
      return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,newLiveCubeValue);
    }
  }
 else   if (snapshotOp == null && backfilledOp != null && liveCubeOp != null) {
    DebugHack.log("String_Node_Str");
    Op newLiveCubeValue=backfilledOp.add(liveCubeOp);
    return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,newLiveCubeValue);
  }
 else   if (snapshotOp == null && backfilledOp != null && liveCubeOp == null) {
    DebugHack.log("String_Node_Str");
    return new ActionRowKeyAndOp(Action.OVERWRITE,rowKey,backfilledOp);
  }
 else   if (snapshotOp == null && backfilledOp == null && liveCubeOp != null) {
    DebugHack.log("String_Node_Str");
    return new ActionRowKeyAndOp(Action.LEAVE_ALONE,rowKey,null);
  }
 else   if (snapshotOp == null && backfilledOp == null && liveCubeOp == null) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
 else   if (snapshotOp != null && backfilledOp != null && liveCubeOp == null) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
 else {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
}