Program: 87574
Project: 87574
Buggy source:
@Override public void postVisit(OptimizerNode visitable){
  this.jsonString.append("String_Node_Str");
  this.jsonString.append("String_Node_Str" + this.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;
}
this.jsonString.append("String_Node_Str" + type + "String_Node_Str");
String contents;
switch (visitable.getPactType()) {
case DataSink:
contents=visitable.getPactContract().toString();
break;
case DataSource:
contents=visitable.getPactContract().toString();
break;
default :
jsonString.append("String_Node_Str" + visitable.getName() + "String_Node_Str");
contents=visitable.getPactContract().getName();
break;
}
this.jsonString.append("String_Node_Str" + contents + "String_Node_Str");
this.jsonString.append("String_Node_Str" + (visitable.getDegreeOfParallelism() >= 1 ? visitable.getDegreeOfParallelism() : "String_Node_Str") + "String_Node_Str");
List<PactConnection> inConns=visitable.getIncomingConnections();
String child1name="String_Node_Str", child2name="String_Node_Str";
if (inConns != null && inConns.size() > 0) {
this.jsonString.append("String_Node_Str");
int connCnt=0;
for (PactConnection conn : inConns) {
this.jsonString.append(connCnt == 0 ? "String_Node_Str" : "String_Node_Str");
if (connCnt == 0) {
child1name+=child1name.length() > 0 ? "String_Node_Str" : "String_Node_Str";
child1name+=conn.getSourcePact().getPactContract().getName();
}
 else if (connCnt == 1) {
child2name+=child2name.length() > 0 ? "String_Node_Str" : "String_Node_Str";
child2name=conn.getSourcePact().getPactContract().getName();
}
this.jsonString.append("String_Node_Str" + this.nodeIds.get(conn.getSourcePact()));
if (inConns.size() == 2) {
this.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) {
this.jsonString.append("String_Node_Str" + shipStrategy + "String_Node_Str");
}
if (channelType != null) {
this.jsonString.append("String_Node_Str" + channelType + "String_Node_Str");
}
if (conn.getTempMode() != TempMode.NONE) {
String tempMode=conn.getTempMode().toString();
this.jsonString.append("String_Node_Str" + tempMode + "String_Node_Str");
}
this.jsonString.append('}');
connCnt++;
}
this.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 SORT_BOTH_MERGE:
locString="String_Node_Str";
break;
case SORT_FIRST_MERGE:
locString="String_Node_Str";
break;
case SORT_SECOND_MERGE:
locString="String_Node_Str";
break;
case MERGE:
locString="String_Node_Str";
break;
case SORT:
locString="String_Node_Str";
break;
case COMBININGSORT:
locString="String_Node_Str";
break;
case SORT_SELF_NESTEDLOOP:
locString="String_Node_Str";
break;
case SELF_NESTEDLOOP:
locString="String_Node_Str";
break;
default :
throw new CompilerException("String_Node_Str" + visitable.getLocalStrategy().name() + "String_Node_Str");
}
if (locString != null) {
this.jsonString.append("String_Node_Str");
this.jsonString.append(locString);
this.jsonString.append("String_Node_Str");
}
}
{
GlobalProperties gp=visitable.getGlobalProperties();
this.jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",gp.getPartitioning().name(),true);
if (gp.getPartitioning() != PartitionProperty.NONE) {
addProperty(jsonString,"String_Node_Str",gp.getPartitionedFields().toString(),false);
}
if (gp.getOrdering() != null) {
addProperty(jsonString,"String_Node_Str",gp.getOrdering().toString(),false);
}
 else {
addProperty(jsonString,"String_Node_Str","String_Node_Str",false);
}
if (visitable.getUniqueFields() == null || visitable.getUniqueFields().size() == 0) {
addProperty(jsonString,"String_Node_Str","String_Node_Str",false);
}
 else {
addProperty(jsonString,"String_Node_Str",visitable.getUniqueFields().toString(),false);
}
this.jsonString.append("String_Node_Str");
}
{
LocalProperties lp=visitable.getLocalProperties();
this.jsonString.append("String_Node_Str");
if (lp.getOrdering() != null) {
addProperty(jsonString,"String_Node_Str",lp.getOrdering().toString(),true);
}
 else {
addProperty(jsonString,"String_Node_Str","String_Node_Str",true);
}
if (visitable.getUniqueFields() == null || visitable.getUniqueFields().size() == 0) {
addProperty(jsonString,"String_Node_Str","String_Node_Str",false);
}
 else {
addProperty(jsonString,"String_Node_Str",visitable.getUniqueFields().toString(),false);
}
addProperty(jsonString,"String_Node_Str",lp.isGrouped() ? "String_Node_Str" : "String_Node_Str",false);
if (lp.isGrouped()) {
addProperty(jsonString,"String_Node_Str",lp.getGroupedFields().toString(),false);
}
this.jsonString.append("String_Node_Str");
}
this.jsonString.append("String_Node_Str");
addProperty(this.jsonString,"String_Node_Str",visitable.getEstimatedNumRecords() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedNumRecords()),true);
String estCardinality="String_Node_Str";
if (visitable.getEstimatedCardinalities().size() > 0) {
estCardinality="String_Node_Str";
for (Entry<FieldSet,Long> entry : visitable.getEstimatedCardinalities().entrySet()) {
estCardinality+="String_Node_Str" + entry.getKey().toString() + "String_Node_Str"+ entry.getValue()+ "String_Node_Str";
}
}
addProperty(jsonString,"String_Node_Str",estCardinality,false);
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedOutputSize() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedOutputSize(),"String_Node_Str"),false);
this.jsonString.append("String_Node_Str");
if (visitable.getNodeCosts() != null) {
this.jsonString.append("String_Node_Str");
addProperty(this.jsonString,"String_Node_Str",visitable.getNodeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getNetworkCost(),"String_Node_Str"),true);
addProperty(this.jsonString,"String_Node_Str",visitable.getNodeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
addProperty(this.jsonString,"String_Node_Str",visitable.getCumulativeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getNetworkCost(),"String_Node_Str"),false);
addProperty(this.jsonString,"String_Node_Str",visitable.getCumulativeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
this.jsonString.append("String_Node_Str");
}
if (visitable.getPactContract().getCompilerHints() != null) {
CompilerHints hints=visitable.getPactContract().getCompilerHints();
CompilerHints defaults=new CompilerHints();
this.jsonString.append("String_Node_Str");
String hintCardinality="String_Node_Str";
if (hints.getDistinctCounts().size() > 0) {
hintCardinality="String_Node_Str";
for (Entry<FieldSet,Long> entry : visitable.getEstimatedCardinalities().entrySet()) {
hintCardinality+="String_Node_Str" + entry.getKey().toString() + "String_Node_Str"+ entry.getValue()+ "String_Node_Str";
}
}
addProperty(jsonString,"String_Node_Str",hintCardinality,true);
addProperty(jsonString,"String_Node_Str",hints.getAvgRecordsEmittedPerStubCall() == defaults.getAvgRecordsEmittedPerStubCall() ? "String_Node_Str" : String.valueOf(hints.getAvgRecordsEmittedPerStubCall()),false);
String valuesKey="String_Node_Str";
if (hints.getAvgNumRecordsPerDistinctFields().size() > 0) {
valuesKey="String_Node_Str";
for (Entry<FieldSet,Float> entry : hints.getAvgNumRecordsPerDistinctFields().entrySet()) {
valuesKey+="String_Node_Str" + entry.getKey().toString() + "String_Node_Str"+ entry.getValue()+ "String_Node_Str";
}
}
addProperty(jsonString,"String_Node_Str",valuesKey,false);
addProperty(jsonString,"String_Node_Str",hints.getAvgBytesPerRecord() == defaults.getAvgBytesPerRecord() ? "String_Node_Str" : String.valueOf(hints.getAvgBytesPerRecord()),false);
this.jsonString.append("String_Node_Str");
}
this.jsonString.append("String_Node_Str");
}

Fixed version (ground truth):
@Override public void postVisit(OptimizerNode visitable){
  this.jsonString.append("String_Node_Str");
  this.jsonString.append("String_Node_Str" + this.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;
}
this.jsonString.append("String_Node_Str" + type + "String_Node_Str");
String contents;
switch (visitable.getPactType()) {
case DataSink:
contents=visitable.getPactContract().toString();
break;
case DataSource:
contents=visitable.getPactContract().toString();
break;
default :
jsonString.append("String_Node_Str" + visitable.getName() + "String_Node_Str");
contents=visitable.getPactContract().getName();
break;
}
this.jsonString.append("String_Node_Str" + contents + "String_Node_Str");
this.jsonString.append("String_Node_Str" + (visitable.getDegreeOfParallelism() >= 1 ? visitable.getDegreeOfParallelism() : "String_Node_Str") + "String_Node_Str");
List<PactConnection> inConns=visitable.getIncomingConnections();
String child1name="String_Node_Str", child2name="String_Node_Str";
if (inConns != null && inConns.size() > 0) {
this.jsonString.append("String_Node_Str");
int connCnt=0;
for (PactConnection conn : inConns) {
this.jsonString.append(connCnt == 0 ? "String_Node_Str" : "String_Node_Str");
if (connCnt == 0) {
child1name+=child1name.length() > 0 ? "String_Node_Str" : "String_Node_Str";
child1name+=conn.getSourcePact().getPactContract().getName();
}
 else if (connCnt == 1) {
child2name+=child2name.length() > 0 ? "String_Node_Str" : "String_Node_Str";
child2name=conn.getSourcePact().getPactContract().getName();
}
this.jsonString.append("String_Node_Str" + this.nodeIds.get(conn.getSourcePact()));
if (inConns.size() == 2) {
this.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";
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) {
this.jsonString.append("String_Node_Str" + shipStrategy + "String_Node_Str");
}
if (channelType != null) {
this.jsonString.append("String_Node_Str" + channelType + "String_Node_Str");
}
if (conn.getTempMode() != TempMode.NONE) {
String tempMode=conn.getTempMode().toString();
this.jsonString.append("String_Node_Str" + tempMode + "String_Node_Str");
}
this.jsonString.append('}');
connCnt++;
}
this.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 SORT_BOTH_MERGE:
locString="String_Node_Str";
break;
case SORT_FIRST_MERGE:
locString="String_Node_Str";
break;
case SORT_SECOND_MERGE:
locString="String_Node_Str";
break;
case MERGE:
locString="String_Node_Str";
break;
case SORT:
locString="String_Node_Str";
break;
case COMBININGSORT:
locString="String_Node_Str";
break;
case SORT_SELF_NESTEDLOOP:
locString="String_Node_Str";
break;
case SELF_NESTEDLOOP:
locString="String_Node_Str";
break;
default :
throw new CompilerException("String_Node_Str" + visitable.getLocalStrategy().name() + "String_Node_Str");
}
if (locString != null) {
this.jsonString.append("String_Node_Str");
this.jsonString.append(locString);
this.jsonString.append("String_Node_Str");
}
}
{
GlobalProperties gp=visitable.getGlobalProperties();
this.jsonString.append("String_Node_Str");
addProperty(jsonString,"String_Node_Str",gp.getPartitioning().name(),true);
if (gp.getPartitioning() != PartitionProperty.NONE) {
addProperty(jsonString,"String_Node_Str",gp.getPartitionedFields().toString(),false);
}
if (gp.getOrdering() != null) {
addProperty(jsonString,"String_Node_Str",gp.getOrdering().toString(),false);
}
 else {
addProperty(jsonString,"String_Node_Str","String_Node_Str",false);
}
if (visitable.getUniqueFields() == null || visitable.getUniqueFields().size() == 0) {
addProperty(jsonString,"String_Node_Str","String_Node_Str",false);
}
 else {
addProperty(jsonString,"String_Node_Str",visitable.getUniqueFields().toString(),false);
}
this.jsonString.append("String_Node_Str");
}
{
LocalProperties lp=visitable.getLocalProperties();
this.jsonString.append("String_Node_Str");
if (lp.getOrdering() != null) {
addProperty(jsonString,"String_Node_Str",lp.getOrdering().toString(),true);
}
 else {
addProperty(jsonString,"String_Node_Str","String_Node_Str",true);
}
if (visitable.getUniqueFields() == null || visitable.getUniqueFields().size() == 0) {
addProperty(jsonString,"String_Node_Str","String_Node_Str",false);
}
 else {
addProperty(jsonString,"String_Node_Str",visitable.getUniqueFields().toString(),false);
}
addProperty(jsonString,"String_Node_Str",lp.isGrouped() ? "String_Node_Str" : "String_Node_Str",false);
if (lp.isGrouped()) {
addProperty(jsonString,"String_Node_Str",lp.getGroupedFields().toString(),false);
}
this.jsonString.append("String_Node_Str");
}
this.jsonString.append("String_Node_Str");
addProperty(this.jsonString,"String_Node_Str",visitable.getEstimatedNumRecords() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedNumRecords()),true);
String estCardinality="String_Node_Str";
if (visitable.getEstimatedCardinalities().size() > 0) {
estCardinality="String_Node_Str";
for (Entry<FieldSet,Long> entry : visitable.getEstimatedCardinalities().entrySet()) {
estCardinality+="String_Node_Str" + entry.getKey().toString() + "String_Node_Str"+ entry.getValue()+ "String_Node_Str";
}
}
addProperty(jsonString,"String_Node_Str",estCardinality,false);
addProperty(jsonString,"String_Node_Str",visitable.getEstimatedOutputSize() == -1 ? "String_Node_Str" : formatNumber(visitable.getEstimatedOutputSize(),"String_Node_Str"),false);
this.jsonString.append("String_Node_Str");
if (visitable.getNodeCosts() != null) {
this.jsonString.append("String_Node_Str");
addProperty(this.jsonString,"String_Node_Str",visitable.getNodeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getNetworkCost(),"String_Node_Str"),true);
addProperty(this.jsonString,"String_Node_Str",visitable.getNodeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getNodeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
addProperty(this.jsonString,"String_Node_Str",visitable.getCumulativeCosts().getNetworkCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getNetworkCost(),"String_Node_Str"),false);
addProperty(this.jsonString,"String_Node_Str",visitable.getCumulativeCosts().getSecondaryStorageCost() == -1 ? "String_Node_Str" : formatNumber(visitable.getCumulativeCosts().getSecondaryStorageCost(),"String_Node_Str"),false);
this.jsonString.append("String_Node_Str");
}
if (visitable.getPactContract().getCompilerHints() != null) {
CompilerHints hints=visitable.getPactContract().getCompilerHints();
CompilerHints defaults=new CompilerHints();
this.jsonString.append("String_Node_Str");
String hintCardinality="String_Node_Str";
if (hints.getDistinctCounts().size() > 0) {
hintCardinality="String_Node_Str";
for (Entry<FieldSet,Long> entry : visitable.getEstimatedCardinalities().entrySet()) {
hintCardinality+="String_Node_Str" + entry.getKey().toString() + "String_Node_Str"+ entry.getValue()+ "String_Node_Str";
}
}
addProperty(jsonString,"String_Node_Str",hintCardinality,true);
addProperty(jsonString,"String_Node_Str",hints.getAvgRecordsEmittedPerStubCall() == defaults.getAvgRecordsEmittedPerStubCall() ? "String_Node_Str" : String.valueOf(hints.getAvgRecordsEmittedPerStubCall()),false);
String valuesKey="String_Node_Str";
if (hints.getAvgNumRecordsPerDistinctFields().size() > 0) {
valuesKey="String_Node_Str";
for (Entry<FieldSet,Float> entry : hints.getAvgNumRecordsPerDistinctFields().entrySet()) {
valuesKey+="String_Node_Str" + entry.getKey().toString() + "String_Node_Str"+ entry.getValue()+ "String_Node_Str";
}
}
addProperty(jsonString,"String_Node_Str",valuesKey,false);
addProperty(jsonString,"String_Node_Str",hints.getAvgBytesPerRecord() == defaults.getAvgBytesPerRecord() ? "String_Node_Str" : String.valueOf(hints.getAvgBytesPerRecord()),false);
this.jsonString.append("String_Node_Str");
}
this.jsonString.append("String_Node_Str");
}