Program: 56095
Project: 56095
Buggy source:
/** 
 * @param connection
 * @param outputVertex
 * @param inputVertex
 * @throws JobGraphDefinitionException
 * @throws CompilerException
 */
private void connectJobVertices(PactConnection connection,AbstractJobVertex outputVertex,AbstractJobVertex inputVertex) throws JobGraphDefinitionException, CompilerException {
  ChannelType channelType=null;
switch (connection.getShipStrategy()) {
case FORWARD:
case PARTITION_LOCAL_HASH:
    channelType=ChannelType.INMEMORY;
  break;
case PARTITION_HASH:
case BROADCAST:
case SFR:
channelType=ChannelType.NETWORK;
break;
default :
throw new IllegalArgumentException("String_Node_Str" + connection.getShipStrategy().name());
}
TaskConfig outputConfig=new TaskConfig(outputVertex.getConfiguration());
TaskConfig inputConfig=new TaskConfig(inputVertex.getConfiguration());
TaskConfig tempConfig=null;
switch (connection.getTempMode()) {
case NONE:
outputVertex.connectTo(inputVertex,channelType,CompressionLevel.NO_COMPRESSION);
outputConfig.addOutputShipStrategy(connection.getShipStrategy());
inputConfig.addInputShipStrategy(connection.getShipStrategy());
break;
case TEMP_SENDER_SIDE:
int pd=connection.getSourcePact().getDegreeOfParallelism();
JobTaskVertex tempVertex=generateTempVertex((Class<? extends Stub<?,?>>)connection.getSourcePact().getPactContract().getStubClass(),pd);
outputVertex.connectTo(tempVertex,ChannelType.INMEMORY,CompressionLevel.NO_COMPRESSION);
tempVertex.connectTo(inputVertex,channelType,CompressionLevel.NO_COMPRESSION);
tempConfig=new TaskConfig(tempVertex.getConfiguration());
outputConfig.addOutputShipStrategy(ShipStrategy.FORWARD);
tempConfig.addInputShipStrategy(ShipStrategy.FORWARD);
tempConfig.addOutputShipStrategy(connection.getShipStrategy());
inputConfig.addInputShipStrategy(connection.getShipStrategy());
break;
case TEMP_RECEIVER_SIDE:
int pdr=connection.getTargetPact().getDegreeOfParallelism();
tempVertex=generateTempVertex((Class<? extends Stub<?,?>>)connection.getSourcePact().getPactContract().getStubClass(),pdr);
outputVertex.connectTo(tempVertex,channelType,CompressionLevel.NO_COMPRESSION);
tempVertex.connectTo(inputVertex,ChannelType.INMEMORY,CompressionLevel.NO_COMPRESSION);
tempConfig=new TaskConfig(tempVertex.getConfiguration());
outputConfig.addOutputShipStrategy(connection.getShipStrategy());
tempConfig.addInputShipStrategy(connection.getShipStrategy());
tempConfig.addOutputShipStrategy(ShipStrategy.FORWARD);
inputConfig.addInputShipStrategy(ShipStrategy.FORWARD);
break;
default :
throw new CompilerException("String_Node_Str" + connection.getTempMode());
}
}

Fixed version (ground truth):
/** 
 * @param connection
 * @param outputVertex
 * @param inputVertex
 * @throws JobGraphDefinitionException
 * @throws CompilerException
 */
private void connectJobVertices(PactConnection connection,AbstractJobVertex outputVertex,AbstractJobVertex inputVertex) throws JobGraphDefinitionException, CompilerException {
  ChannelType channelType=null;
switch (connection.getShipStrategy()) {
case FORWARD:
case PARTITION_LOCAL_HASH:
    int sourceDOP=connection.getSourcePact().getDegreeOfParallelism();
  int sourceInnerDOP=connection.getSourcePact().getInstancesPerMachine();
int sourceNumInstances=(int)Math.ceil((double)sourceDOP / (double)sourceInnerDOP);
int targetDOP=connection.getTargetPact().getDegreeOfParallelism();
int targetInnerDOP=connection.getTargetPact().getInstancesPerMachine();
int targetNumInstances=(int)Math.ceil((double)targetDOP / (double)targetInnerDOP);
channelType=sourceNumInstances == targetNumInstances ? ChannelType.INMEMORY : ChannelType.NETWORK;
break;
case PARTITION_HASH:
case BROADCAST:
case SFR:
channelType=ChannelType.NETWORK;
break;
default :
throw new IllegalArgumentException("String_Node_Str" + connection.getShipStrategy().name());
}
TaskConfig outputConfig=new TaskConfig(outputVertex.getConfiguration());
TaskConfig inputConfig=new TaskConfig(inputVertex.getConfiguration());
TaskConfig tempConfig=null;
switch (connection.getTempMode()) {
case NONE:
outputVertex.connectTo(inputVertex,channelType,CompressionLevel.NO_COMPRESSION);
outputConfig.addOutputShipStrategy(connection.getShipStrategy());
inputConfig.addInputShipStrategy(connection.getShipStrategy());
break;
case TEMP_SENDER_SIDE:
int pd=connection.getSourcePact().getDegreeOfParallelism();
JobTaskVertex tempVertex=generateTempVertex((Class<? extends Stub<?,?>>)connection.getSourcePact().getPactContract().getStubClass(),pd);
outputVertex.connectTo(tempVertex,ChannelType.INMEMORY,CompressionLevel.NO_COMPRESSION);
tempVertex.connectTo(inputVertex,channelType,CompressionLevel.NO_COMPRESSION);
tempConfig=new TaskConfig(tempVertex.getConfiguration());
outputConfig.addOutputShipStrategy(ShipStrategy.FORWARD);
tempConfig.addInputShipStrategy(ShipStrategy.FORWARD);
tempConfig.addOutputShipStrategy(connection.getShipStrategy());
inputConfig.addInputShipStrategy(connection.getShipStrategy());
break;
case TEMP_RECEIVER_SIDE:
int pdr=connection.getTargetPact().getDegreeOfParallelism();
tempVertex=generateTempVertex((Class<? extends Stub<?,?>>)connection.getSourcePact().getPactContract().getStubClass(),pdr);
outputVertex.connectTo(tempVertex,channelType,CompressionLevel.NO_COMPRESSION);
tempVertex.connectTo(inputVertex,ChannelType.INMEMORY,CompressionLevel.NO_COMPRESSION);
tempConfig=new TaskConfig(tempVertex.getConfiguration());
outputConfig.addOutputShipStrategy(connection.getShipStrategy());
tempConfig.addInputShipStrategy(connection.getShipStrategy());
tempConfig.addOutputShipStrategy(ShipStrategy.FORWARD);
inputConfig.addInputShipStrategy(ShipStrategy.FORWARD);
break;
default :
throw new CompilerException("String_Node_Str" + connection.getTempMode());
}
}