Program: 120636
Project: 120636
Buggy source:
/** 
 * Generate Code Parts for a Sub Process .
 * @param subProcess the suprocess
 * @param node the subprocess root
 * @param part the part of code to generate
 * @return the generated code
 * @throws CodeGeneratorException if an error occurs during Code Generation
 */
private StringBuffer generateComponentsCode(NodesSubTree subProcess,INode node,ECodePart part,String incomingName,ETypeGen typeGen) throws CodeGeneratorException {
  StringBuffer codeComponent=new StringBuffer();
  Boolean isMarked=subProcess.isMarkedNode(node,part);
  boolean isIterate=isSpecifyInputNode(node,incomingName,EConnectionType.ITERATE);
  boolean isOnRowsEnd=isSpecifyInputNode(node,incomingName,EConnectionType.ON_ROWS_END);
  if ((isMarked != null) && (!isMarked)) {
switch (part) {
case BEGIN:
      codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.BEGIN,typeGen));
    codeComponent.append(generateComponentCode(subProcess,node,ECodePart.BEGIN,incomingName,typeGen));
  break;
case MAIN:
if (isIterate) {
  codeComponent.append(generateTypedComponentCode(EInternalTemplate.ITERATE_SUBPROCESS_HEADER,node,ECodePart.BEGIN,incomingName,subProcess));
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.BEGIN,typeGen));
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.BEGIN,incomingName,typeGen));
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.MAIN,incomingName,typeGen));
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.MAIN,typeGen));
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.END,incomingName,typeGen));
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.END,typeGen));
  codeComponent.append(generateTypedComponentCode(EInternalTemplate.ITERATE_SUBPROCESS_FOOTER,node,ECodePart.END,incomingName,subProcess));
}
 else {
  if (ETypeGen.CAMEL == typeGen) {
    if (node.getIncomingConnections() != null && node.getIncomingConnections().size() > 0) {
      if (!(node.getIncomingConnections().get(0).getLineStyle().equals(EConnectionType.ROUTE))) {
        codeComponent.append(generateTypedComponentCode(EInternalTemplate.CAMEL_SPECIALLINKS,node));
      }
    }
  }
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.MAIN,incomingName,typeGen));
  if (ETypeGen.CAMEL == typeGen) {
    String label=null;
    IElementParameter parameter=node.getElementParameter("String_Node_Str");
    if (parameter != null && !"String_Node_Str".equals(parameter.getValue())) {
      label=(String)parameter.getValue();
    }
    if (label == null) {
      label=node.getUniqueName();
    }
 else {
      label+="String_Node_Str" + node.getUniqueName();
    }
    List<? extends IConnection> inConnections=node.getIncomingConnections();
    int size=inConnections.size();
    if (size < 1) {
      if ("String_Node_Str".equals(node.getComponent().getName())) {
      }
 else {
        codeComponent.append("String_Node_Str" + label + "String_Node_Str");
      }
    }
 else     if (size == 1) {
      IConnection iConnection=inConnections.get(0);
      INode source=iConnection.getSource();
      if ("String_Node_Str".equals(source.getComponent().getName()) && source.getIncomingConnections().size() < 1) {
        if ("String_Node_Str".equals(node.getPropertyValue(EParameterName.STARTABLE.getName()))) {
          codeComponent.append("String_Node_Str" + label + "String_Node_Str");
        }
 else {
        }
      }
 else {
        codeComponent.append("String_Node_Str" + node.getUniqueName() + "String_Node_Str");
      }
    }
 else {
      codeComponent.append("String_Node_Str" + node.getUniqueName() + "String_Node_Str");
    }
  }
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.MAIN,typeGen));
}
break;
case END:
if (isOnRowsEnd) {
codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.BEGIN,typeGen));
codeComponent.append(generateComponentCode(subProcess,node,ECodePart.BEGIN,incomingName,typeGen));
codeComponent.append(generateComponentCode(subProcess,node,ECodePart.MAIN,incomingName,typeGen));
codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.MAIN,typeGen));
codeComponent.append(generateComponentCode(subProcess,node,ECodePart.END,incomingName,typeGen));
codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.END,typeGen));
}
 else {
codeComponent.append(generateComponentCode(subProcess,node,ECodePart.END,incomingName,typeGen));
codeComponent.append(generatesTreeCode(subProcess,node,part,typeGen));
}
break;
default :
}
subProcess.markNode(node,part);
}
return codeComponent;
}

Fixed version (ground truth):
/** 
 * Generate Code Parts for a Sub Process .
 * @param subProcess the suprocess
 * @param node the subprocess root
 * @param part the part of code to generate
 * @return the generated code
 * @throws CodeGeneratorException if an error occurs during Code Generation
 */
private StringBuffer generateComponentsCode(NodesSubTree subProcess,INode node,ECodePart part,String incomingName,ETypeGen typeGen) throws CodeGeneratorException {
  StringBuffer codeComponent=new StringBuffer();
  Boolean isMarked=subProcess.isMarkedNode(node,part);
  boolean isIterate=isSpecifyInputNode(node,incomingName,EConnectionType.ITERATE);
  if ((isMarked != null) && (!isMarked)) {
switch (part) {
case BEGIN:
      codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.BEGIN,typeGen));
    codeComponent.append(generateComponentCode(subProcess,node,ECodePart.BEGIN,incomingName,typeGen));
  break;
case MAIN:
if (isIterate) {
  codeComponent.append(generateTypedComponentCode(EInternalTemplate.ITERATE_SUBPROCESS_HEADER,node,ECodePart.BEGIN,incomingName,subProcess));
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.BEGIN,typeGen));
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.BEGIN,incomingName,typeGen));
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.MAIN,incomingName,typeGen));
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.MAIN,typeGen));
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.END,incomingName,typeGen));
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.END,typeGen));
  codeComponent.append(generateTypedComponentCode(EInternalTemplate.ITERATE_SUBPROCESS_FOOTER,node,ECodePart.END,incomingName,subProcess));
}
 else {
  if (ETypeGen.CAMEL == typeGen) {
    if (node.getIncomingConnections() != null && node.getIncomingConnections().size() > 0) {
      if (!(node.getIncomingConnections().get(0).getLineStyle().equals(EConnectionType.ROUTE))) {
        codeComponent.append(generateTypedComponentCode(EInternalTemplate.CAMEL_SPECIALLINKS,node));
      }
    }
  }
  codeComponent.append(generateComponentCode(subProcess,node,ECodePart.MAIN,incomingName,typeGen));
  if (ETypeGen.CAMEL == typeGen) {
    String label=null;
    IElementParameter parameter=node.getElementParameter("String_Node_Str");
    if (parameter != null && !"String_Node_Str".equals(parameter.getValue())) {
      label=(String)parameter.getValue();
    }
    if (label == null) {
      label=node.getUniqueName();
    }
 else {
      label+="String_Node_Str" + node.getUniqueName();
    }
    List<? extends IConnection> inConnections=node.getIncomingConnections();
    int size=inConnections.size();
    if (size < 1) {
      if ("String_Node_Str".equals(node.getComponent().getName())) {
      }
 else {
        codeComponent.append("String_Node_Str" + label + "String_Node_Str");
      }
    }
 else     if (size == 1) {
      IConnection iConnection=inConnections.get(0);
      INode source=iConnection.getSource();
      if ("String_Node_Str".equals(source.getComponent().getName()) && source.getIncomingConnections().size() < 1) {
        if ("String_Node_Str".equals(node.getPropertyValue(EParameterName.STARTABLE.getName()))) {
          codeComponent.append("String_Node_Str" + label + "String_Node_Str");
        }
 else {
        }
      }
 else {
        codeComponent.append("String_Node_Str" + node.getUniqueName() + "String_Node_Str");
      }
    }
 else {
      codeComponent.append("String_Node_Str" + node.getUniqueName() + "String_Node_Str");
    }
  }
  boolean isNextOnRowsEnd=false;
  IConnection conn=null;
  if (node.getOutgoingConnections(EConnectionType.ON_ROWS_END).size() == 1) {
    conn=node.getOutgoingConnections(EConnectionType.ON_ROWS_END).get(0);
    isNextOnRowsEnd=isSpecifyInputNode(conn.getTarget(),conn.getName(),EConnectionType.ON_ROWS_END);
  }
  if (isNextOnRowsEnd && conn != null && (onRowsEndCode.getMarked(conn.getTarget().getUniqueName()) == null)) {
    StringBuffer buffer=new StringBuffer();
    onRowsEndCode.add(buffer);
    onRowsEndCode.mark(conn.getTarget().getUniqueName());
    onRowsEndCode.increase();
    buffer.append(generatesTreeCode(subProcess,conn.getTarget(),ECodePart.BEGIN,typeGen));
    buffer.append(generateComponentCode(subProcess,conn.getTarget(),ECodePart.BEGIN,incomingName,typeGen));
    buffer.append(generateComponentCode(subProcess,conn.getTarget(),ECodePart.MAIN,incomingName,typeGen));
    buffer.append(generatesTreeCode(subProcess,conn.getTarget(),ECodePart.MAIN,typeGen));
    buffer.append(generateComponentCode(subProcess,conn.getTarget(),ECodePart.END,incomingName,typeGen));
    buffer.append(generatesTreeCode(subProcess,conn.getTarget(),ECodePart.END,typeGen));
  }
  codeComponent.append(generatesTreeCode(subProcess,node,ECodePart.MAIN,typeGen));
}
break;
case END:
boolean isOnRowsEnd=isSpecifyInputNode(node,incomingName,EConnectionType.ON_ROWS_END);
if (isOnRowsEnd) {
onRowsEndCode.decrease();
if (onRowsEndCode.getCount() == 0) {
for (int i=0; i < onRowsEndCode.getBuffers().size(); i++) {
codeComponent.append(onRowsEndCode.getBuffers().get(i));
}
onRowsEndCode.clear();
}
}
 else {
codeComponent.append(generateComponentCode(subProcess,node,ECodePart.END,incomingName,typeGen));
codeComponent.append(generatesTreeCode(subProcess,node,part,typeGen));
}
break;
default :
}
subProcess.markNode(node,part);
}
return codeComponent;
}