Program: 88311
Project: 88311
Buggy source:
/** 
 * Private utility method that generates the alternative Cross nodes, given fixed shipping strategies for the inputs.
 * @param target The list to put the alternatives in.
 * @param pred1 The predecessor node for the first input.
 * @param pred2 The predecessor node for the second input.
 * @param ss1 The shipping strategy for the first input.
 * @param ss2 The shipping strategy for the second input.
 * @param estimator The cost estimator.
 */
private void createLocalAlternatives(List<CrossNode> target,OptimizerNode pred1,OptimizerNode pred2,ShipStrategy ss1,ShipStrategy ss2,CostEstimator estimator){
  LocalProperties lpDefaults=new LocalProperties();
  GlobalProperties gp=null;
  LocalProperties lp=null;
  OutputContract oc=getOutputContract();
  boolean isFirst=false;
  if (oc.appliesToFirstInput()) {
    gp=PactConnection.getGlobalPropertiesAfterConnection(pred1,ss1);
    lp=PactConnection.getLocalPropertiesAfterConnection(pred1,ss1);
    isFirst=true;
  }
 else   if (oc.appliesToSecondInput()) {
    gp=PactConnection.getGlobalPropertiesAfterConnection(pred2,ss2);
    lp=PactConnection.getLocalPropertiesAfterConnection(pred2,ss2);
  }
 else {
    gp=new GlobalProperties();
    lp=new LocalProperties();
  }
  gp.setKeyUnique(false);
  lp.setKeyUnique(false);
  GlobalProperties gpNoOrder=gp.createCopy();
  gpNoOrder.setKeyOrder(Order.NONE);
  LocalStrategy ls=getLocalStrategy();
  if (ls != LocalStrategy.NONE) {
    if (ls == LocalStrategy.NESTEDLOOP_STREAMED_OUTER_FIRST) {
      gp=isFirst ? gp : gpNoOrder;
      lp=isFirst ? lp : lpDefaults;
    }
 else     if (ls == LocalStrategy.NESTEDLOOP_STREAMED_OUTER_SECOND) {
      gp=isFirst ? gpNoOrder : gp;
      lp=isFirst ? lpDefaults : lp;
    }
 else     if (ls == LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_FIRST || ls == LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_SECOND) {
      gp=gpNoOrder;
      lp=lpDefaults;
    }
 else {
      return;
    }
    createCrossAlternative(target,pred1,pred2,ss1,ss2,ls,gp,lp,estimator);
  }
 else {
    if (isFirst) {
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_FIRST,gp,lp,estimator);
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_SECOND,gpNoOrder.createCopy(),lpDefaults.createCopy(),estimator);
    }
 else {
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_SECOND,gp,lp,estimator);
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_FIRST,gpNoOrder.createCopy(),lpDefaults.createCopy(),estimator);
    }
    createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_FIRST,gpNoOrder.createCopy(),lpDefaults.createCopy(),estimator);
    createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_SECOND,gpNoOrder,lpDefaults,estimator);
  }
}

Fixed version (ground truth):
/** 
 * Private utility method that generates the alternative Cross nodes, given fixed shipping strategies for the inputs.
 * @param target The list to put the alternatives in.
 * @param pred1 The predecessor node for the first input.
 * @param pred2 The predecessor node for the second input.
 * @param ss1 The shipping strategy for the first input.
 * @param ss2 The shipping strategy for the second input.
 * @param estimator The cost estimator.
 */
private void createLocalAlternatives(List<CrossNode> target,OptimizerNode pred1,OptimizerNode pred2,ShipStrategy ss1,ShipStrategy ss2,CostEstimator estimator){
  LocalProperties lpDefaults=new LocalProperties();
  GlobalProperties gp=null;
  LocalProperties lp=null;
  OutputContract oc=getOutputContract();
  boolean isFirst=false;
  if (oc.appliesToFirstInput()) {
    gp=PactConnection.getGlobalPropertiesAfterConnection(pred1,this,ss1);
    lp=PactConnection.getLocalPropertiesAfterConnection(pred1,this,ss1);
    isFirst=true;
  }
 else   if (oc.appliesToSecondInput()) {
    gp=PactConnection.getGlobalPropertiesAfterConnection(pred2,this,ss2);
    lp=PactConnection.getLocalPropertiesAfterConnection(pred2,this,ss2);
  }
 else {
    gp=new GlobalProperties();
    lp=new LocalProperties();
  }
  gp.setKeyUnique(false);
  lp.setKeyUnique(false);
  GlobalProperties gpNoOrder=gp.createCopy();
  gpNoOrder.setKeyOrder(Order.NONE);
  LocalStrategy ls=getLocalStrategy();
  if (ls != LocalStrategy.NONE) {
    if (ls == LocalStrategy.NESTEDLOOP_STREAMED_OUTER_FIRST) {
      gp=isFirst ? gp : gpNoOrder;
      lp=isFirst ? lp : lpDefaults;
    }
 else     if (ls == LocalStrategy.NESTEDLOOP_STREAMED_OUTER_SECOND) {
      gp=isFirst ? gpNoOrder : gp;
      lp=isFirst ? lpDefaults : lp;
    }
 else     if (ls == LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_FIRST || ls == LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_SECOND) {
      gp=gpNoOrder;
      lp=lpDefaults;
    }
 else {
      return;
    }
    createCrossAlternative(target,pred1,pred2,ss1,ss2,ls,gp,lp,estimator);
  }
 else {
    if (isFirst) {
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_FIRST,gp,lp,estimator);
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_SECOND,gpNoOrder.createCopy(),lpDefaults.createCopy(),estimator);
    }
 else {
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_SECOND,gp,lp,estimator);
      createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_STREAMED_OUTER_FIRST,gpNoOrder.createCopy(),lpDefaults.createCopy(),estimator);
    }
    createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_FIRST,gpNoOrder.createCopy(),lpDefaults.createCopy(),estimator);
    createCrossAlternative(target,pred1,pred2,ss1,ss2,LocalStrategy.NESTEDLOOP_BLOCKED_OUTER_SECOND,gpNoOrder,lpDefaults,estimator);
  }
}