Program: 24521
Project: 24521
Buggy source:
private GiraphScenario buildGiraphScnearioFromWrapper(GiraphScenarioWrapper<I,V,E,M1,M2> scenarioWrapper){
  GiraphScenario.Builder giraphScenarioBuilder=GiraphScenario.newBuilder();
  Context.Builder contextBuilder=Context.newBuilder();
  Neighbor.Builder neighborBuilder=Neighbor.newBuilder();
  OutMsg.Builder outMsgBuilder=OutMsg.newBuilder();
  giraphScenarioBuilder.clear();
  giraphScenarioBuilder.setClassUnderTest(scenarioWrapper.getClassUnderTest().getName());
  giraphScenarioBuilder.setVertexIdClass(scenarioWrapper.getVertexIdClass().getName());
  giraphScenarioBuilder.setVertexValueClass(scenarioWrapper.getVertexValueClass().getName());
  giraphScenarioBuilder.setEdgeValueClass(scenarioWrapper.getEdgeValueClass().getName());
  giraphScenarioBuilder.setIncomingMessageClass(scenarioWrapper.getIncomingMessageClass().getName());
  giraphScenarioBuilder.setOutgoingMessageClass(scenarioWrapper.getOutgoingMessageClass().getName());
  GiraphScenarioWrapper<I,V,E,M1,M2>.ContextWrapper contextWrapper=scenarioWrapper.getContextWrapper();
  contextBuilder.clear();
  contextBuilder.setSuperstepNo(contextWrapper.getSuperstepNoWrapper()).setVertexId(toByteString(contextWrapper.getVertexIdWrapper())).setVertexValueBefore(toByteString(contextWrapper.getVertexValueBeforeWrapper())).setVertexValueAfter(toByteString(contextWrapper.getVertexValueAfterWrapper()));
  for (  GiraphScenarioWrapper<I,V,E,M1,M2>.ContextWrapper.NeighborWrapper neighbor : contextWrapper.getNeighborWrappers()) {
    neighborBuilder.clear();
    neighborBuilder.setNeighborId(toByteString(neighbor.getNbrId()));
    E edgeValue=neighbor.getEdgeValue();
    if (edgeValue != null) {
      neighborBuilder.setEdgeValue(toByteString(edgeValue));
    }
 else {
      neighborBuilder.clearEdgeValue();
    }
    contextBuilder.addNeighbor(neighborBuilder);
  }
  for (  M1 msg : contextWrapper.getIncomingMessageWrappers()) {
    contextBuilder.addInMessage(toByteString(msg));
  }
  for (  OutgoingMessageWrapper msg : contextWrapper.getOutgoingMessageWrappers()) {
    outMsgBuilder.setMsgData(toByteString(msg.message));
    outMsgBuilder.setDestinationId(toByteString(msg.destinationId));
    contextBuilder.addOutMessage(outMsgBuilder);
  }
  giraphScenarioBuilder.setContext(contextBuilder.build());
  GiraphScenario giraphScenario=giraphScenarioBuilder.build();
  return giraphScenario;
}

Fixed version (ground truth):
private GiraphScenario buildGiraphScnearioFromWrapper(GiraphScenarioWrapper<I,V,E,M1,M2> scenarioWrapper){
  GiraphScenario.Builder giraphScenarioBuilder=GiraphScenario.newBuilder();
  giraphScenarioBuilder.setClassUnderTest(scenarioWrapper.getClassUnderTest().getName());
  giraphScenarioBuilder.setVertexIdClass(scenarioWrapper.getVertexIdClass().getName());
  giraphScenarioBuilder.setVertexValueClass(scenarioWrapper.getVertexValueClass().getName());
  giraphScenarioBuilder.setEdgeValueClass(scenarioWrapper.getEdgeValueClass().getName());
  giraphScenarioBuilder.setIncomingMessageClass(scenarioWrapper.getIncomingMessageClass().getName());
  giraphScenarioBuilder.setOutgoingMessageClass(scenarioWrapper.getOutgoingMessageClass().getName());
  GiraphScenarioWrapper<I,V,E,M1,M2>.ContextWrapper contextWrapper=scenarioWrapper.getContextWrapper();
  Context.Builder contextBuilder=Context.newBuilder();
  contextBuilder.setSuperstepNo(contextWrapper.getSuperstepNoWrapper()).setVertexId(toByteString(contextWrapper.getVertexIdWrapper())).setVertexValueBefore(toByteString(contextWrapper.getVertexValueBeforeWrapper())).setVertexValueAfter(toByteString(contextWrapper.getVertexValueAfterWrapper()));
  for (  GiraphScenarioWrapper<I,V,E,M1,M2>.ContextWrapper.NeighborWrapper neighbor : contextWrapper.getNeighborWrappers()) {
    Neighbor.Builder neighborBuilder=Neighbor.newBuilder();
    neighborBuilder.setNeighborId(toByteString(neighbor.getNbrId()));
    E edgeValue=neighbor.getEdgeValue();
    if (edgeValue != null) {
      neighborBuilder.setEdgeValue(toByteString(edgeValue));
    }
 else {
      neighborBuilder.clearEdgeValue();
    }
    contextBuilder.addNeighbor(neighborBuilder.build());
  }
  for (  M1 msg : contextWrapper.getIncomingMessageWrappers()) {
    contextBuilder.addInMessage(toByteString(msg));
  }
  for (  OutgoingMessageWrapper msg : contextWrapper.getOutgoingMessageWrappers()) {
    OutMsg.Builder outMsgBuilder=OutMsg.newBuilder();
    outMsgBuilder.setMsgData(toByteString(msg.message));
    outMsgBuilder.setDestinationId(toByteString(msg.destinationId));
    contextBuilder.addOutMessage(outMsgBuilder);
  }
  giraphScenarioBuilder.setContext(contextBuilder.build());
  GiraphScenario giraphScenario=giraphScenarioBuilder.build();
  return giraphScenario;
}