Program: 101944
Project: 101944
Buggy source:
/** 
 * @param procedureNode
 * @param model
 * @return procedure
 * @throws Exception
 */
protected RelationalProcedure createVirtualProcedure(AstNode procedureNode,RelationalModel model) throws Exception {
  RelationalViewProcedure procedure=getFactory().createViewProcedure();
  Info info=createInfo(procedureNode,model);
  if (info.getSchema() == null)   model.addChild(procedure);
 else {
    info.getSchema().getProcedures().add(procedure);
    procedure.setParent(info.getSchema());
  }
  initialize(procedure,procedureNode,info.getName());
  if (procedureNode.getProperty(StandardDdlLexicon.DATATYPE_NAME) != null) {
    RelationalProcedureResultSet result=getFactory().createProcedureResultSet();
    procedure.setResultSet(result);
    initialize(result,procedureNode);
  }
  List<AstNode> procOptionNodes=new ArrayList<AstNode>();
  for (  AstNode child : procedureNode) {
    if (is(child,TeiidDdlLexicon.CreateProcedure.PARAMETER)) {
      createProcedureParameter(child,procedure);
    }
 else     if (is(child,TeiidDdlLexicon.CreateProcedure.RESULT_COLUMNS)) {
      RelationalProcedureResultSet result=getFactory().createProcedureResultSet();
      procedure.setResultSet(result);
      initialize(result,procedureNode);
      for (      AstNode resultCol : child) {
        if (resultCol.hasMixin(TeiidDdlLexicon.CreateProcedure.RESULT_COLUMN)) {
          createColumn(resultCol,result);
        }
      }
    }
 else     if (is(child,TeiidDdlLexicon.CreateProcedure.RESULT_DATA_TYPE)) {
      RelationalParameter param=createProcedureParameter(child,procedure);
      param.setDirection(DirectionKind.RETURN_LITERAL.toString());
      param.setName(TeiidDDLConstants.RETURNS);
    }
 else     if (is(child,StandardDdlLexicon.TYPE_STATEMENT_OPTION)) {
      procOptionNodes.add(child);
    }
  }
  try {
    NewModelObjectHelperManager.helpCreate(procedure,new Properties());
  }
 catch (  ModelerCoreException err) {
    DdlImporterPlugin.UTIL.log(IStatus.ERROR,err,err.getMessage());
  }
  String queryExpression=(String)procedureNode.getProperty(TeiidDdlLexicon.CreateProcedure.STATEMENT);
  if (!StringUtilities.isEmpty(queryExpression)) {
    procedure.setTransformationSQL(queryExpression);
  }
  processOptions(procOptionNodes,procedure);
  return procedure;
}

Fixed version (ground truth):
/** 
 * @param procedureNode
 * @param model
 * @return procedure
 * @throws Exception
 */
protected RelationalProcedure createVirtualProcedure(AstNode procedureNode,RelationalModel model) throws Exception {
  RelationalViewProcedure procedure=getFactory().createViewProcedure();
  Info info=createInfo(procedureNode,model);
  if (info.getSchema() == null)   model.addChild(procedure);
 else {
    info.getSchema().getProcedures().add(procedure);
    procedure.setParent(info.getSchema());
  }
  initialize(procedure,procedureNode,info.getName());
  if (procedureNode.getProperty(StandardDdlLexicon.DATATYPE_NAME) != null) {
    RelationalProcedureResultSet result=getFactory().createProcedureResultSet();
    procedure.setResultSet(result);
    initialize(result,procedureNode);
  }
  List<AstNode> procOptionNodes=new ArrayList<AstNode>();
  for (  AstNode child : procedureNode) {
    if (is(child,TeiidDdlLexicon.CreateProcedure.PARAMETER)) {
      createProcedureParameter(child,procedure);
    }
 else     if (is(child,TeiidDdlLexicon.CreateProcedure.RESULT_COLUMNS)) {
      RelationalProcedureResultSet result=getFactory().createProcedureResultSet();
      procedure.setResultSet(result);
      initialize(result,procedureNode);
      List<AstNode> resultOptionNodes=new ArrayList<AstNode>();
      for (      AstNode resultCol : child) {
        if (resultCol.hasMixin(TeiidDdlLexicon.CreateProcedure.RESULT_COLUMN)) {
          createColumn(resultCol,result);
        }
 else         if (is(resultCol,StandardDdlLexicon.TYPE_STATEMENT_OPTION)) {
          resultOptionNodes.add(resultCol);
        }
      }
      processOptions(resultOptionNodes,result);
    }
 else     if (is(child,TeiidDdlLexicon.CreateProcedure.RESULT_DATA_TYPE)) {
      RelationalParameter param=createProcedureParameter(child,procedure);
      param.setDirection(DirectionKind.RETURN_LITERAL.toString());
      param.setName(TeiidDDLConstants.RETURNS);
    }
 else     if (is(child,StandardDdlLexicon.TYPE_STATEMENT_OPTION)) {
      procOptionNodes.add(child);
    }
  }
  try {
    NewModelObjectHelperManager.helpCreate(procedure,new Properties());
  }
 catch (  ModelerCoreException err) {
    DdlImporterPlugin.UTIL.log(IStatus.ERROR,err,err.getMessage());
  }
  String queryExpression=(String)procedureNode.getProperty(TeiidDdlLexicon.CreateProcedure.STATEMENT);
  if (!StringUtilities.isEmpty(queryExpression)) {
    procedure.setTransformationSQL(queryExpression);
  }
  processOptions(procOptionNodes,procedure);
  return procedure;
}