Program: 56110
Project: 56110
Buggy source:
@Override public void postVisit(OptimizerNode visitable){
  jsonString.append("String_Node_Str");
  jsonString.append("String_Node_Str" + nodeIds.get(visitable));
  String type;
switch (visitable.getPactType()) {
case DataSink:
    type="String_Node_Str";
  break;
case DataSource:
type="String_Node_Str";
break;
default :
type="String_Node_Str";
break;
}
jsonString.append("String_Node_Str" + type + "String_Node_Str");
if (type.equals("String_Node_Str")) {
jsonString.append("String_Node_Str" + visitable.getName() + "String_Node_Str");
}
String contents;
switch (visitable.getPactType()) {
case DataSink:
contents=((DataSinkContract<?,?>)visitable.getPactContract()).getFilePath();
break;
case DataSource:
contents=((DataSourceContract<?,?>)visitable.getPactContract()).getFilePath();
break;
default :
contents=visitable.getPactContract().getName();
break;
}
jsonString.append("String_Node_Str" + contents + "String_Node_Str");
OutputContract outContr=visitable.getOutputContract();
if (outContr != null && outContr != OutputContract.None) {
jsonString.append("String_Node_Str" + outContr.name() + "String_Node_Str");
}
jsonString.append("String_Node_Str" + (visitable.getDegreeOfParallelism() >= 1 ? visitable.getDegreeOfParallelism() : "String_Node_Str") + "String_Node_Str");
List<PactConnection> connList=visitable.getIncomingConnections();
String child1name=null, child2name=null;
if (connList != null && connList.size() > 0) {
jsonString.append("String_Node_Str");
int connCnt=0;
for (PactConnection conn : connList) {
jsonString.append(connCnt == 0 ? "String_Node_Str" : "String_Node_Str");
if (connCnt == 0) {
child1name=conn.getSourcePact().getPactContract().getName();
}
 else if (connCnt == 1) {
child2name=conn.getSourcePact().getPactContract().getName();
}
jsonString.append("String_Node_Str" + nodeIds.get(conn.getSourcePact()));
if (connList.size() == 2) {
jsonString.append("String_Node_Str" + (connCnt == 0 ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
}
String shipStrategy=null;
String channelType=null;
switch (conn.getShipStrategy()) {
case NONE:
break;
case FORWARD:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case BROADCAST:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case PARTITION_HASH:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case PARTITION_RANGE:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case SFR:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
default :
throw new CompilerException("String_Node_Str" + conn.getShipStrategy().name() + "String_Node_Str");
}
if (shipStrategy != null) {
jsonString.append("String_Node_Str" + shipStrategy + "String_Node_Str");
}
if (channelType != null) {
jsonString.append("String_Node_Str" + channelType + "String_Node_Str");
}
if (conn.getTempMode() != TempMode.NONE) {
String tempMode=conn.getTempMode().toString();
jsonString.append("String_Node_Str" + tempMode + "String_Node_Str");
}
jsonString.append('}');
connCnt++;
}
jsonString.append("String_Node_Str");
}
String locString=null;
if (visitable.getLocalStrategy() != null) {
switch (visitable.getLocalStrategy()) {
case NONE:
break;
case HYBRIDHASH_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case HYBRIDHASH_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case MMHASH_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case MMHASH_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case NESTEDLOOP_BLOCKED_OUTER_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case NESTEDLOOP_BLOCKED_OUTER_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case NESTEDLOOP_STREAMED_OUTER_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case NESTEDLOOP_STREAMED_OUTER_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case SORTMERGE:
locString="String_Node_Str";
break;
case SORT:
locString="String_Node_Str";
break;
case COMBININGSORT:
locString="String_Node_Str";
break;
default :
throw new CompilerException("String_Node_Str" + visitable.getLocalStrategy().name() + "String_Node_Str");
}
if (locString != null) {
jsonString.append("String_Node_Str");
jsonString.append(locString);
jsonString.append("String_Node_Str");
}
}
{
GlobalProperties gp=visitable.getGlobalProperties();
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",gp.getPartitioning().name(),true);
addProperty(jsonString,"String_Node_Str",gp.getKeyOrder().name(),false);
addProperty(jsonString,"String_Node_Str",gp.isKeyUnique() ? "String_Node_Str" : "String_Node_Str",false);
jsonString.append("String_Node_Str");
}
{
LocalProperties lp=visitable.getLocalProperties();
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",lp.getKeyOrder().name(),true);
addProperty(jsonString,"String_Node_Str",lp.isKeyUnique() ? "String_Node_Str" : "String_Node_Str",false);
addProperty(jsonString,"String_Node_Str",lp.areKeysGrouped() ? "String_Node_Str" : "String_Node_Str",false);
jsonString.append("String_Node_Str");
}
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedNumRecords() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedNumRecords()),true);
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedKeyCardinality() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedKeyCardinality()),false);
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedOutputSize() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedOutputSize(),"String_Node_Str"),false);
jsonString.append("String_Node_Str");
if (visitable.getNodeCosts() != null) {
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",visitable.getNodeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getNetworkCost(),"String_Node_Str"),true);
addProperty(jsonString,"String_Node_Str",visitable.getNodeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
addProperty(jsonString,"String_Node_Str",visitable.getCumulativeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getNetworkCost(),"String_Node_Str"),false);
addProperty(jsonString,"String_Node_Str",visitable.getCumulativeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
jsonString.append("String_Node_Str");
}
if (visitable.getPactContract().getCompilerHints() != null) {
CompilerHints hints=visitable.getPactContract().getCompilerHints();
CompilerHints defaults=new CompilerHints();
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",hints.getKeyCardinality() == defaults.getKeyCardinality() ? "String_Node_Str" : formatNumber(hints.getKeyCardinality()),true);
addProperty(jsonString,"String_Node_Str",hints.getSelectivity() == defaults.getSelectivity() ? "String_Node_Str" : String.valueOf(hints.getSelectivity()),false);
addProperty(jsonString,"String_Node_Str",hints.getAvgNumValuesPerKey() == defaults.getAvgNumValuesPerKey() ? "String_Node_Str" : String.valueOf(hints.getAvgNumValuesPerKey()),false);
addProperty(jsonString,"String_Node_Str",hints.getAvgBytesPerRecord() == defaults.getAvgBytesPerRecord() ? "String_Node_Str" : String.valueOf(hints.getAvgBytesPerRecord()),false);
jsonString.append("String_Node_Str");
}
jsonString.append("String_Node_Str");
}

Fixed version (ground truth):
@Override public void postVisit(OptimizerNode visitable){
  jsonString.append("String_Node_Str");
  jsonString.append("String_Node_Str" + nodeIds.get(visitable));
  String type;
switch (visitable.getPactType()) {
case DataSink:
    type="String_Node_Str";
  break;
case DataSource:
type="String_Node_Str";
break;
default :
type="String_Node_Str";
break;
}
jsonString.append("String_Node_Str" + type + "String_Node_Str");
if (type.equals("String_Node_Str")) {
jsonString.append("String_Node_Str" + visitable.getName() + "String_Node_Str");
}
String contents;
switch (visitable.getPactType()) {
case DataSink:
contents=((DataSinkContract<?,?>)visitable.getPactContract()).getFilePath();
break;
case DataSource:
contents=((DataSourceContract<?,?>)visitable.getPactContract()).getFilePath();
break;
default :
contents=visitable.getPactContract().getName();
break;
}
jsonString.append("String_Node_Str" + contents + "String_Node_Str");
OutputContract outContr=visitable.getOutputContract();
if (outContr != null && outContr != OutputContract.None) {
jsonString.append("String_Node_Str" + outContr.name() + "String_Node_Str");
}
jsonString.append("String_Node_Str" + (visitable.getDegreeOfParallelism() >= 1 ? visitable.getDegreeOfParallelism() : "String_Node_Str") + "String_Node_Str");
List<PactConnection> connList=visitable.getIncomingConnections();
String child1name=null, child2name=null;
if (connList != null && connList.size() > 0) {
jsonString.append("String_Node_Str");
int connCnt=0;
for (PactConnection conn : connList) {
jsonString.append(connCnt == 0 ? "String_Node_Str" : "String_Node_Str");
if (connCnt == 0) {
child1name=conn.getSourcePact().getPactContract().getName();
}
 else if (connCnt == 1) {
child2name=conn.getSourcePact().getPactContract().getName();
}
jsonString.append("String_Node_Str" + nodeIds.get(conn.getSourcePact()));
if (connList.size() == 2) {
jsonString.append("String_Node_Str" + (connCnt == 0 ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
}
String shipStrategy=null;
String channelType=null;
switch (conn.getShipStrategy()) {
case NONE:
break;
case FORWARD:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case BROADCAST:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case PARTITION_HASH:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case PARTITION_RANGE:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
case PARTITION_LOCAL_HASH:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
case SFR:
shipStrategy="String_Node_Str";
channelType="String_Node_Str";
break;
default :
throw new CompilerException("String_Node_Str" + conn.getShipStrategy().name() + "String_Node_Str");
}
if (shipStrategy != null) {
jsonString.append("String_Node_Str" + shipStrategy + "String_Node_Str");
}
if (channelType != null) {
jsonString.append("String_Node_Str" + channelType + "String_Node_Str");
}
if (conn.getTempMode() != TempMode.NONE) {
String tempMode=conn.getTempMode().toString();
jsonString.append("String_Node_Str" + tempMode + "String_Node_Str");
}
jsonString.append('}');
connCnt++;
}
jsonString.append("String_Node_Str");
}
String locString=null;
if (visitable.getLocalStrategy() != null) {
switch (visitable.getLocalStrategy()) {
case NONE:
break;
case HYBRIDHASH_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case HYBRIDHASH_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case MMHASH_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case MMHASH_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case NESTEDLOOP_BLOCKED_OUTER_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case NESTEDLOOP_BLOCKED_OUTER_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case NESTEDLOOP_STREAMED_OUTER_FIRST:
locString="String_Node_Str" + child1name + "String_Node_Str";
break;
case NESTEDLOOP_STREAMED_OUTER_SECOND:
locString="String_Node_Str" + child2name + "String_Node_Str";
break;
case SORTMERGE:
locString="String_Node_Str";
break;
case SORT:
locString="String_Node_Str";
break;
case COMBININGSORT:
locString="String_Node_Str";
break;
default :
throw new CompilerException("String_Node_Str" + visitable.getLocalStrategy().name() + "String_Node_Str");
}
if (locString != null) {
jsonString.append("String_Node_Str");
jsonString.append(locString);
jsonString.append("String_Node_Str");
}
}
{
GlobalProperties gp=visitable.getGlobalProperties();
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",gp.getPartitioning().name(),true);
addProperty(jsonString,"String_Node_Str",gp.getKeyOrder().name(),false);
addProperty(jsonString,"String_Node_Str",gp.isKeyUnique() ? "String_Node_Str" : "String_Node_Str",false);
jsonString.append("String_Node_Str");
}
{
LocalProperties lp=visitable.getLocalProperties();
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",lp.getKeyOrder().name(),true);
addProperty(jsonString,"String_Node_Str",lp.isKeyUnique() ? "String_Node_Str" : "String_Node_Str",false);
addProperty(jsonString,"String_Node_Str",lp.areKeysGrouped() ? "String_Node_Str" : "String_Node_Str",false);
jsonString.append("String_Node_Str");
}
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedNumRecords() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedNumRecords()),true);
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedKeyCardinality() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedKeyCardinality()),false);
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedOutputSize() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedOutputSize(),"String_Node_Str"),false);
jsonString.append("String_Node_Str");
if (visitable.getNodeCosts() != null) {
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",visitable.getNodeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getNetworkCost(),"String_Node_Str"),true);
addProperty(jsonString,"String_Node_Str",visitable.getNodeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
addProperty(jsonString,"String_Node_Str",visitable.getCumulativeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getNetworkCost(),"String_Node_Str"),false);
addProperty(jsonString,"String_Node_Str",visitable.getCumulativeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
jsonString.append("String_Node_Str");
}
if (visitable.getPactContract().getCompilerHints() != null) {
CompilerHints hints=visitable.getPactContract().getCompilerHints();
CompilerHints defaults=new CompilerHints();
jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",hints.getKeyCardinality() == defaults.getKeyCardinality() ? "String_Node_Str" : formatNumber(hints.getKeyCardinality()),true);
addProperty(jsonString,"String_Node_Str",hints.getSelectivity() == defaults.getSelectivity() ? "String_Node_Str" : String.valueOf(hints.getSelectivity()),false);
addProperty(jsonString,"String_Node_Str",hints.getAvgNumValuesPerKey() == defaults.getAvgNumValuesPerKey() ? "String_Node_Str" : String.valueOf(hints.getAvgNumValuesPerKey()),false);
addProperty(jsonString,"String_Node_Str",hints.getAvgBytesPerRecord() == defaults.getAvgBytesPerRecord() ? "String_Node_Str" : String.valueOf(hints.getAvgBytesPerRecord()),false);
jsonString.append("String_Node_Str");
}
jsonString.append("String_Node_Str");
}