Program: 168458
Project: 168458
Buggy source:
/** 
 * Adds an update relation.
 * @param left the left selector
 * @param operator the operator
 * @param right the right selector
 * @throws ExecutionException the execution exception
 */
public void addUpdateRelation(Selector left,Operator operator,Selector right) throws ExecutionException {
  BasicDBObject basicDBObject;
switch (operator) {
case EQ:
case ASSIGN:
    if (containsAnInnerRelation(left,right)) {
      Relation innerRelation=((RelationSelector)right).getRelation();
      addUpdateRelation(innerRelation.getLeftTerm(),innerRelation.getOperator(),innerRelation.getRightTerm());
    }
 else {
      if (relations.containsField(SET_COMMAND)) {
        basicDBObject=(BasicDBObject)relations.get(SET_COMMAND);
        basicDBObject.putAll(getBasicRelation(left,right));
      }
 else {
        basicDBObject=new BasicDBObject();
        basicDBObject.putAll(getBasicRelation(left,right));
        relations.put(SET_COMMAND,basicDBObject);
      }
    }
  break;
case ADD:
if (relations.containsField(INCREMENT_COMMAND)) {
  basicDBObject=(BasicDBObject)relations.get(INCREMENT_COMMAND);
  basicDBObject.putAll(getIncrementalRelation(left,right,false));
}
 else {
  basicDBObject=new BasicDBObject();
  basicDBObject.putAll(getIncrementalRelation(left,right,false));
  relations.put(INCREMENT_COMMAND,basicDBObject);
}
break;
case SUBTRACT:
if (relations.containsField(INCREMENT_COMMAND)) {
basicDBObject=(BasicDBObject)relations.get(INCREMENT_COMMAND);
basicDBObject.putAll(getIncrementalRelation(left,right,true));
}
 else {
basicDBObject=new BasicDBObject();
basicDBObject.putAll(getIncrementalRelation(left,right,true));
relations.put(INCREMENT_COMMAND,basicDBObject);
}
break;
case MULTIPLICATION:
if (relations.containsField(MUTLTIPLICATION_COMMAND)) {
basicDBObject=(BasicDBObject)relations.get(MUTLTIPLICATION_COMMAND);
basicDBObject.putAll(getNumberRelation(left,right));
}
 else {
basicDBObject=new BasicDBObject();
basicDBObject.putAll(getNumberRelation(left,right));
relations.put(MUTLTIPLICATION_COMMAND,basicDBObject);
}
break;
default :
String msg="String_Node_Str" + operator + "String_Node_Str";
logger.error(msg);
throw new MongoValidationException(msg);
}
}

Fixed version (ground truth):
/** 
 * Adds an update relation.
 * @param left the left selector
 * @param operator the operator
 * @param right the right selector
 * @throws ExecutionException the execution exception
 */
public void addUpdateRelation(Selector left,Operator operator,Selector right) throws ExecutionException {
  BasicDBObject basicDBObject;
switch (operator) {
case EQ:
case ASSIGN:
    if (containsAnInnerRelation(left,right)) {
      Relation innerRelation=((RelationSelector)right).getRelation();
      addUpdateRelation(innerRelation.getLeftTerm(),innerRelation.getOperator(),innerRelation.getRightTerm());
    }
 else {
      if (relations.containsField(SET_COMMAND)) {
        basicDBObject=(BasicDBObject)relations.get(SET_COMMAND);
        basicDBObject.putAll(getBasicRelation(left,right));
      }
 else {
        basicDBObject=new BasicDBObject();
        basicDBObject.putAll(getBasicRelation(left,right));
        relations.put(SET_COMMAND,basicDBObject);
      }
    }
  break;
case ADD:
if (relations.containsField(INCREMENT_COMMAND)) {
  basicDBObject=(BasicDBObject)relations.get(INCREMENT_COMMAND);
  basicDBObject.putAll(getIncrementalRelation(left,right,false));
}
 else {
  basicDBObject=new BasicDBObject();
  basicDBObject.putAll(getIncrementalRelation(left,right,false));
  relations.put(INCREMENT_COMMAND,basicDBObject);
}
break;
case SUBTRACT:
if (relations.containsField(INCREMENT_COMMAND)) {
basicDBObject=(BasicDBObject)relations.get(INCREMENT_COMMAND);
basicDBObject.putAll(getIncrementalRelation(left,right,true));
}
 else {
basicDBObject=new BasicDBObject();
basicDBObject.putAll(getIncrementalRelation(left,right,true));
relations.put(INCREMENT_COMMAND,basicDBObject);
}
break;
case MULTIPLICATION:
if (relations.containsField(MUTLTIPLICATION_COMMAND)) {
basicDBObject=(BasicDBObject)relations.get(MUTLTIPLICATION_COMMAND);
basicDBObject.putAll(getNumberRelation(left,right));
}
 else {
basicDBObject=new BasicDBObject();
basicDBObject.putAll(getNumberRelation(left,right));
relations.put(MUTLTIPLICATION_COMMAND,basicDBObject);
}
break;
default :
String msg="String_Node_Str" + operator + "String_Node_Str";
LOGGER.error(msg);
throw new MongoValidationException(msg);
}
}