Program: 138406
Project: 138406
Buggy source:
/** 
 * DOC qiongli Comment method "evaluateByMDM".
 * @param sqlStatement
 * @param returnCode
 * @return
 */
private ReturnCode evaluateByMDM(String sqlStatement,ReturnCode returnCode){
  if (mdmWebserviceConn == null || tdXmlDocument == null) {
    returnCode.setOk(false);
    return returnCode;
  }
  MdmStatement statement=mdmWebserviceConn.createStatement();
  String[] resultSet=null;
  this.getAnalyzedElements();
  if (continueRun()) {
    try {
      List<String> strResultList=new ArrayList<String>();
      returnCode.setOk(true);
      returnCode.setOk(returnCode.isOk() && statement.execute(tdXmlDocument,sqlStatement));
      List<String> strResultListTemp=Arrays.asList(statement.getResultSet());
      strResultList.addAll(strResultListTemp.subList(1,strResultListTemp.size()));
      resultSet=strResultList.toArray(new String[strResultList.size()]);
    }
 catch (    RemoteException e) {
      returnCode.setMessage(e.getMessage());
    }
catch (    ServiceException e) {
      returnCode.setMessage(e.getMessage());
    }
  }
  if (resultSet == null) {
    String mess="String_Node_Str" + sqlStatement;
    log.warn(mess);
    returnCode.setReturnCode(mess,false);
    return returnCode;
  }
  List<Map<String,String>> resultSetList=new ArrayList<Map<String,String>>();
  List<ModelElement> analysisElementList=this.analysis.getContext().getAnalysedElements();
  TdXmlElementType parentElement=SwitchHelpers.XMLELEMENTTYPE_SWITCH.doSwitch(XmlElementHelper.getParentElement(SwitchHelpers.XMLELEMENTTYPE_SWITCH.doSwitch(analysisElementList.get(0))));
  List<TdXmlElementType> columnList=org.talend.cwm.db.connection.ConnectionUtils.getXMLElements(parentElement);
  if (analysis.getParameters().isStoreData()) {
    resultSetList=statement.tidyResultSet(columnList.toArray(new ModelElement[columnList.size()]),resultSet);
  }
 else {
    resultSetList=statement.tidyResultSet(analysisElementList.toArray(new ModelElement[analysisElementList.size()]),resultSet);
  }
  List<String> columnNames=getAnalyzedElementsName();
  for (int i=0; i < resultSetList.size(); i++) {
    Map<String,String> rowMap=(Map<String,String>)resultSetList.get(i);
    EList<Object> objectLs=new BasicEList<Object>();
    Iterator<String> it=columnNames.iterator();
    while (it.hasNext()) {
      Object obj=rowMap.get(it.next());
      if (obj != null && (PluginConstant.EMPTY_STRING.equals(obj.toString().trim()))) {
        obj=obj.toString().trim();
      }
      objectLs.add(obj);
    }
    if (objectLs.size() == 0) {
      continue;
    }
    handleObjects(rowMap,objectLs,columnList);
  }
  return returnCode;
}

Fixed version (ground truth):
/** 
 * DOC qiongli Comment method "evaluateByMDM".
 * @param sqlStatement
 * @param returnCode
 * @return
 */
private ReturnCode evaluateByMDM(String sqlStatement,ReturnCode returnCode){
  if (mdmWebserviceConn == null || tdXmlDocument == null) {
    returnCode.setOk(false);
    return returnCode;
  }
  MdmStatement statement=mdmWebserviceConn.createStatement();
  String[] resultSet=null;
  this.getAnalyzedElements();
  if (continueRun()) {
    try {
      returnCode.setOk(true);
      returnCode.setOk(returnCode.isOk() && statement.execute(tdXmlDocument,sqlStatement));
      List<String> strResultList=Arrays.asList(statement.getResultSet());
      resultSet=strResultList.toArray(new String[strResultList.size()]);
    }
 catch (    RemoteException e) {
      returnCode.setMessage(e.getMessage());
    }
catch (    ServiceException e) {
      returnCode.setMessage(e.getMessage());
    }
  }
  if (resultSet == null) {
    String mess="String_Node_Str" + sqlStatement;
    log.warn(mess);
    returnCode.setReturnCode(mess,false);
    return returnCode;
  }
  List<Map<String,String>> resultSetList=new ArrayList<Map<String,String>>();
  List<ModelElement> analysisElementList=this.analysis.getContext().getAnalysedElements();
  TdXmlElementType parentElement=SwitchHelpers.XMLELEMENTTYPE_SWITCH.doSwitch(XmlElementHelper.getParentElement(SwitchHelpers.XMLELEMENTTYPE_SWITCH.doSwitch(analysisElementList.get(0))));
  List<TdXmlElementType> columnList=org.talend.cwm.db.connection.ConnectionUtils.getXMLElements(parentElement);
  if (analysis.getParameters().isStoreData()) {
    resultSetList=statement.tidyResultSet(columnList.toArray(new ModelElement[columnList.size()]),resultSet);
  }
 else {
    resultSetList=statement.tidyResultSet(analysisElementList.toArray(new ModelElement[analysisElementList.size()]),resultSet);
  }
  List<String> columnNames=getAnalyzedElementsName();
  for (int i=0; i < resultSetList.size(); i++) {
    Map<String,String> rowMap=(Map<String,String>)resultSetList.get(i);
    EList<Object> objectLs=new BasicEList<Object>();
    Iterator<String> it=columnNames.iterator();
    while (it.hasNext()) {
      Object obj=rowMap.get(it.next());
      if (obj != null && (PluginConstant.EMPTY_STRING.equals(obj.toString().trim()))) {
        obj=obj.toString().trim();
      }
      objectLs.add(obj);
    }
    if (objectLs.size() == 0) {
      continue;
    }
    handleObjects(rowMap,objectLs,columnList);
  }
  return returnCode;
}