Program: 120584
Project: 120584
Buggy source:
private void runShadowProcess(final Property property,final Node inputNode,final IContext selectContext,final IElementParameter switchParam){
  DatabaseConnection connt=TracesConnectionUtils.createConnection(connParameters);
  String dbmsId=connt.getDbmsId();
  if (dbmsId == null) {
    Shell shell=Display.getCurrent().getActiveShell();
    MessageDialog.openError(shell,"String_Node_Str","String_Node_Str");
    MappingFileSelectDialog dialog=new MappingFileSelectDialog(shell);
    dialog.open();
    dbmsId=dialog.getSelectId();
  }
  GuessSchemaProcess gsp=new GuessSchemaProcess(property,inputNode,selectContext,memoSQL,info,part.getProcess());
  try {
    List<Integer> indexsForSameNamedColumn=new ArrayList<Integer>();
    CsvArray array=gsp.run();
    List<String[]> schemaContent=array.getRows();
    List<String> columnLabels=new ArrayList<String>();
    if (columns != null) {
      columns.clear();
    }
    if (!schemaContent.isEmpty()) {
      int numbOfColumn=schemaContent.get(0).length;
      for (int i=1; i <= numbOfColumn; i++) {
        indexsForSameNamedColumn.clear();
        Boolean b=false;
        IMetadataColumn oneColum=new MetadataColumn();
        String labelName=(schemaContent.get(0))[i - 1];
        String name=labelName;
        String sub="String_Node_Str";
        String sub2="String_Node_Str";
        if (labelName != null && labelName.length() > 0 && labelName.startsWith("String_Node_Str")) {
          sub=labelName.substring(1);
          if (sub != null && sub.length() > 0) {
            sub2=sub.substring(1);
          }
        }
        if (KeywordsValidator.isKeyword(labelName) || KeywordsValidator.isKeyword(sub) || KeywordsValidator.isKeyword(sub2)) {
          labelName="String_Node_Str" + labelName;
          b=true;
        }
        oneColum.setLabel(MetadataToolHelper.validateColumnName(labelName,i,columnLabels));
        oneColum.setOriginalDbColumnName(name);
        if (schemaContent.size() > 5) {
          oneColum.setPrecision(Integer.parseInt(schemaContent.get(2)[i - 1]));
          oneColum.setLength(Integer.parseInt(schemaContent.get(3)[i - 1]));
        }
        try {
          String talendType=null;
          if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
            if (schemaContent.size() >= 5) {
              talendType=MetadataTalendType.getMappingTypeRetriever(dbmsId).getDefaultSelectedTalendType(schemaContent.get(4)[i - 1]);
            }
 else {
              talendType=JavaTypesManager.STRING.getId();
            }
          }
 else {
            if (schemaContent.size() >= 5) {
              talendType=PerlDataTypeHelper.getNewTalendTypeOfValue(schemaContent.get(4)[i - 1]);
            }
 else {
              talendType=PerlTypesManager.STRING;
            }
          }
          oneColum.setTalendType(talendType);
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
        oneColum.setNullable((schemaContent.get(1))[i - 1].equals(Boolean.TRUE.toString()) ? true : false);
        columns.add(oneColum);
        columnLabels.add(oneColum.getLabel());
      }
      if (columns.size() > 0) {
        IElementParameter dqRule=elem.getElementParameter("String_Node_Str");
        if (dqRule != null) {
          ITDQRuleService ruleService=null;
          try {
            ruleService=(ITDQRuleService)GlobalServiceRegister.getDefault().getService(ITDQRuleService.class);
          }
 catch (          RuntimeException e) {
          }
          IElementParameter queryParam=elem.getElementParameter("String_Node_Str");
          if (ruleService != null && queryParam != null) {
            ruleService.updateOriginalColumnNames(columns,queryParam);
          }
        }
      }
      IMetadataTable tempMetatable=new MetadataTable();
      if (tempMetatable.getTableName() == null) {
        tempMetatable.setTableName(inputNode.getUniqueName());
      }
      IMetadataTable outputMetaCopy, originaleOutputTable;
      String propertyName=(String)btn.getData(PARAMETER_NAME);
      IElementParameter param=inputNode.getElementParameter(propertyName);
      for (      IElementParameter eParam : elem.getElementParameters()) {
        if (eParam.getContext() != null) {
          param=eParam;
        }
      }
      originaleOutputTable=inputNode.getMetadataFromConnector(param.getContext());
      if (originaleOutputTable != null) {
        outputMetaCopy=originaleOutputTable.clone();
      }
      tempMetatable.setListColumns(columns);
      MetadataDialog metaDialog=new MetadataDialog(composite.getShell(),tempMetatable,inputNode,getCommandStack());
      if (metaDialog != null) {
        metaDialog.setText(Messages.getString("String_Node_Str") + inputNode.getLabel());
      }
      if (metaDialog.open() == MetadataDialog.OK) {
        outputMetaCopy=metaDialog.getOutputMetaData();
        boolean modified=false;
        if (!outputMetaCopy.sameMetadataAs(originaleOutputTable,IMetadataColumn.OPTIONS_NONE)) {
          modified=true;
        }
        if (modified) {
          if (switchParam != null) {
            switchParam.setValue(Boolean.FALSE);
          }
          changeMetadataCommand=new ChangeMetadataCommand(inputNode,param,originaleOutputTable,outputMetaCopy);
        }
      }
    }
  }
 catch (  ProcessorException e) {
    ExtractMetaDataUtils.closeConnection();
    final String strExcepton=e.getMessage();
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        MessageDialog.openWarning(composite.getShell(),Messages.getString("String_Node_Str"),strExcepton);
      }
    }
);
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
private void runShadowProcess(final Property property,final Node inputNode,final IContext selectContext,final IElementParameter switchParam){
  DatabaseConnection connt=TracesConnectionUtils.createConnection(connParameters);
  String dbmsId=connt.getDbmsId();
  if (dbmsId == null) {
    Shell shell=Display.getCurrent().getActiveShell();
    MessageDialog.openError(shell,"String_Node_Str","String_Node_Str");
    MappingFileSelectDialog dialog=new MappingFileSelectDialog(shell);
    dialog.open();
    dbmsId=dialog.getSelectId();
  }
  GuessSchemaProcess gsp=new GuessSchemaProcess(property,inputNode,selectContext,memoSQL,info,part.getProcess());
  try {
    List<Integer> indexsForSameNamedColumn=new ArrayList<Integer>();
    CsvArray array=gsp.run();
    List<String[]> schemaContent=array.getRows();
    List<String> columnLabels=new ArrayList<String>();
    if (columns != null) {
      columns.clear();
    }
    if (!schemaContent.isEmpty()) {
      int numbOfColumn=schemaContent.get(0).length;
      for (int i=1; i <= numbOfColumn; i++) {
        indexsForSameNamedColumn.clear();
        Boolean b=false;
        IMetadataColumn oneColum=new MetadataColumn();
        String labelName=(schemaContent.get(0))[i - 1];
        String name=labelName;
        String sub="String_Node_Str";
        String sub2="String_Node_Str";
        if (labelName != null && labelName.length() > 0 && labelName.startsWith("String_Node_Str")) {
          sub=labelName.substring(1);
          if (sub != null && sub.length() > 0) {
            sub2=sub.substring(1);
          }
        }
        if (KeywordsValidator.isKeyword(labelName) || KeywordsValidator.isKeyword(sub) || KeywordsValidator.isKeyword(sub2)) {
          labelName="String_Node_Str" + labelName;
          b=true;
        }
        oneColum.setLabel(MetadataToolHelper.validateColumnName(labelName,i,columnLabels));
        oneColum.setOriginalDbColumnName(name);
        if (schemaContent.size() > 5) {
          oneColum.setPrecision(Integer.parseInt(schemaContent.get(2)[i - 1]));
          oneColum.setLength(Integer.parseInt(schemaContent.get(3)[i - 1]));
        }
        try {
          String talendType=null;
          if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
            if (schemaContent.size() >= 5) {
              talendType=MetadataTalendType.getMappingTypeRetriever(dbmsId).getDefaultSelectedTalendType(schemaContent.get(4)[i - 1]);
            }
 else {
              talendType=JavaTypesManager.STRING.getId();
            }
          }
 else {
            if (schemaContent.size() >= 5) {
              talendType=PerlDataTypeHelper.getNewTalendTypeOfValue(schemaContent.get(4)[i - 1]);
            }
 else {
              talendType=PerlTypesManager.STRING;
            }
          }
          oneColum.setTalendType(talendType);
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
        oneColum.setNullable((schemaContent.get(1))[i - 1].equals(Boolean.TRUE.toString()) ? true : false);
        columns.add(oneColum);
        columnLabels.add(oneColum.getLabel());
      }
      if (columns.size() > 0) {
        IElementParameter dqRule=elem.getElementParameter("String_Node_Str");
        if (dqRule != null) {
          ITDQRuleService ruleService=null;
          try {
            ruleService=(ITDQRuleService)GlobalServiceRegister.getDefault().getService(ITDQRuleService.class);
          }
 catch (          RuntimeException e) {
          }
          IElementParameter queryParam=elem.getElementParameter("String_Node_Str");
          if (ruleService != null && queryParam != null) {
            ruleService.updateOriginalColumnNames(columns,queryParam);
          }
        }
      }
      IMetadataTable tempMetatable=new MetadataTable();
      if (tempMetatable.getTableName() == null) {
        tempMetatable.setTableName(inputNode.getUniqueName());
      }
      IMetadataTable outputMetaCopy, originaleOutputTable;
      String propertyName=(String)btn.getData(PARAMETER_NAME);
      IElementParameter param=inputNode.getElementParameter(propertyName);
      for (      IElementParameter eParam : elem.getElementParameters()) {
        if (eParam.getContext() != null) {
          param=eParam;
        }
      }
      originaleOutputTable=inputNode.getMetadataFromConnector(param.getContext());
      if (originaleOutputTable != null) {
        outputMetaCopy=originaleOutputTable.clone();
      }
      tempMetatable.setListColumns(columns);
      MetadataDialog metaDialog=new MetadataDialog(composite.getShell(),tempMetatable,inputNode,getCommandStack());
      if (metaDialog != null) {
        metaDialog.setText(Messages.getString("String_Node_Str") + inputNode.getLabel());
      }
      if (metaDialog.open() == MetadataDialog.OK) {
        outputMetaCopy=metaDialog.getOutputMetaData();
        boolean modified=false;
        if (!outputMetaCopy.sameMetadataAs(originaleOutputTable,IMetadataColumn.OPTIONS_NONE)) {
          modified=true;
        }
        if (modified) {
          if (switchParam != null) {
            switchParam.setValue(Boolean.FALSE);
          }
          changeMetadataCommand=new ChangeMetadataCommand(inputNode,param,originaleOutputTable,outputMetaCopy);
        }
      }
    }
  }
 catch (  ProcessorException e) {
    ExtractMetaDataUtils.getInstance().closeConnection();
    final String strExcepton=e.getMessage();
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        MessageDialog.openWarning(composite.getShell(),Messages.getString("String_Node_Str"),strExcepton);
      }
    }
);
    ExceptionHandler.process(e);
  }
}