nus-yam/ex-repair huggingface dataset:
Program: 123270
Project: 123270
Buggy source:
@Override protected void okPressed(){
  for (  TableEditor editor : editors) {
    Control control=editor.getEditor();
    TableItem item=editor.getItem();
    ColumnInfo row=(ColumnInfo)item.getData();
    EParameterFieldType field=row.parameter.getFieldType();
    if (field == EParameterFieldType.CHECK) {
      Button button=(Button)control;
      row.defaultValue=button.getSelection();
    }
 else     if (field == EParameterFieldType.TEXT) {
      Text text=(Text)control;
      row.defaultValue=text.getText();
    }
 else     if (field == EParameterFieldType.CLOSED_LIST || field == EParameterFieldType.PREV_COLUMN_LIST) {
      CCombo combo=(CCombo)control;
      int index=combo.getSelectionIndex();
      Object[] values=row.parameter.getListItemsValue();
      row.defaultValue=values[index];
    }
  }
  super.okPressed();
}

Fixed version (ground truth):
@Override protected void okPressed(){
  for (  TableEditor editor : editors) {
    Control control=editor.getEditor();
    TableItem item=editor.getItem();
    ColumnInfo row=(ColumnInfo)item.getData();
    EParameterFieldType field=row.parameter.getFieldType();
    if (field == EParameterFieldType.CHECK) {
      Button button=(Button)control;
      row.defaultValue=button.getSelection();
    }
 else     if (field == EParameterFieldType.TEXT) {
      Text text=(Text)control;
      row.defaultValue=text.getText();
    }
 else     if (field == EParameterFieldType.CLOSED_LIST || field == EParameterFieldType.PREV_COLUMN_LIST) {
      CCombo combo=(CCombo)control;
      int index=combo.getSelectionIndex();
      if (index == -1) {
        row.defaultValue="String_Node_Str";
      }
 else {
        Object[] values=row.parameter.getListItemsValue();
        row.defaultValue=values[index];
      }
    }
  }
  super.okPressed();
}
Program: 123276
Project: 123276
Buggy source:
private String handleQuery(String query){
  if (query != null) {
    if (!query.trim().endsWith("String_Node_Str")) {
      query=query + "String_Node_Str";
    }
 else     if (isPostgres() && query.trim().endsWith("String_Node_Str")) {
      query=query + "String_Node_Str";
    }
 else {
      if (query.trim().endsWith("String_Node_Str")) {
        query=query.substring(0,query.lastIndexOf("String_Node_Str"));
      }
    }
  }
  return query;
}

Fixed version (ground truth):
private String handleQuery(String query){
  if (query != null) {
    if (!query.trim().endsWith("String_Node_Str")) {
      query=query + "String_Node_Str";
    }
 else     if (query.trim().endsWith("String_Node_Str")) {
      query=query + "String_Node_Str";
    }
 else {
      if (query.trim().endsWith("String_Node_Str")) {
        query=query.substring(0,query.lastIndexOf("String_Node_Str"));
      }
    }
  }
  return query;
}
Program: 123277
Project: 123277
Buggy source:
private List<String> getContextList(DbMapComponent component){
  List<String> contextList=new ArrayList<String>();
  IProcess process=component.getProcess();
  IContext context=process.getContextManager().getDefaultContext();
  List<IContextParameter> paraList=context.getContextParameterList();
  for (  IContextParameter para : paraList) {
    contextList.add(ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + para.getName());
  }
  return contextList;
}

Fixed version (ground truth):
protected List<String> getContextList(DbMapComponent component){
  List<String> contextList=new ArrayList<String>();
  IProcess process=component.getProcess();
  IContext context=process.getContextManager().getDefaultContext();
  List<IContextParameter> paraList=context.getContextParameterList();
  for (  IContextParameter para : paraList) {
    contextList.add(ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + para.getName());
  }
  return contextList;
}
Program: 123281
Project: 123281
Buggy source:
private List<String> getConnectionContextList(DbMapComponent component){
  List<String> contextList=new ArrayList<String>();
  List<IConnection> inputConnections=(List<IConnection>)component.getIncomingConnections();
  List<Map<String,String>> itemNameList=null;
  for (  IConnection iconn : inputConnections) {
    String connName=iconn.getName();
    if (!ContextParameterUtils.containContextVariables(connName)) {
      continue;
    }
    MapExpressionParser mapParser1=new MapExpressionParser("String_Node_Str");
    itemNameList=mapParser1.parseInTableEntryLocations(connName);
    if (itemNameList == null) {
      return contextList;
    }
    IMetadataTable metadataTable=iconn.getMetadataTable();
    for (    Map<String,String> itemNamemap : itemNameList) {
      Set<Entry<String,String>> set=itemNamemap.entrySet();
      Iterator<Entry<String,String>> ite=set.iterator();
      while (ite.hasNext()) {
        Entry<String,String> entry=ite.next();
        String tableValue=entry.getKey();
        String schemaValue=entry.getValue();
        if (metadataTable != null && tableValue.equals(metadataTable.getLabel())) {
          if (!contextList.contains(schemaValue)) {
            contextList.add(schemaValue);
          }
        }
      }
    }
  }
  return contextList;
}

Fixed version (ground truth):
protected List<String> getConnectionContextList(DbMapComponent component){
  List<String> contextList=new ArrayList<String>();
  List<IConnection> inputConnections=(List<IConnection>)component.getIncomingConnections();
  List<Map<String,String>> itemNameList=null;
  for (  IConnection iconn : inputConnections) {
    String connName=iconn.getName();
    if (!ContextParameterUtils.containContextVariables(connName)) {
      continue;
    }
    MapExpressionParser mapParser1=new MapExpressionParser("String_Node_Str");
    itemNameList=mapParser1.parseInTableEntryLocations(connName);
    if (itemNameList == null) {
      return contextList;
    }
    IMetadataTable metadataTable=iconn.getMetadataTable();
    for (    Map<String,String> itemNamemap : itemNameList) {
      Set<Entry<String,String>> set=itemNamemap.entrySet();
      Iterator<Entry<String,String>> ite=set.iterator();
      while (ite.hasNext()) {
        Entry<String,String> entry=ite.next();
        String tableValue=entry.getKey();
        String schemaValue=entry.getValue();
        if (metadataTable != null && tableValue.equals(metadataTable.getLabel())) {
          if (!contextList.contains(schemaValue)) {
            contextList.add(schemaValue);
          }
        }
      }
    }
  }
  return contextList;
}
Program: 123288
Project: 123288
Buggy source:
private CellStyle getPreCellStyle(){
  if (isAbsY && keepCellFormat) {
    if (preCell == null) {
      return null;
    }
 else {
      CellStyle preCellStyle=preCell.getCellStyle();
      CellStyle targetCellStyle=wb.createCellStyle();
      targetCellStyle.cloneStyleFrom(preCellStyle);
      return targetCellStyle;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private CellStyle getPreCellStyle(){
  if (isAbsY && keepCellFormat) {
    CellStyle preCellStyle=null;
    if (preCell == null) {
      preCellStyle=preSheet.getColumnStyle(curCell.getColumnIndex());
    }
 else {
      preCellStyle=preCell.getCellStyle();
    }
    CellStyle targetCellStyle=wb.createCellStyle();
    targetCellStyle.cloneStyleFrom(preCellStyle);
    return targetCellStyle;
  }
 else {
    return null;
  }
}
Program: 123289
Project: 123289
Buggy source:
public void prepareXlsxFile(String fileName) throws Exception {
  File xlsxFile=new File(fileName);
  if (xlsxFile.exists()) {
    if (isAbsY && keepCellFormat) {
      initPreXlsx(fileName);
    }
    if (appendWorkbook) {
      InputStream inp=new FileInputStream(fileName);
      wb=WorkbookFactory.create(inp);
      sheet=wb.getSheet(sheetName);
      if (sheet != null) {
        if (appendSheet) {
          curY=sheet.getLastRowNum() + 1;
        }
 else {
          wb.removeSheetAt(wb.getSheetIndex(sheetName));
          sheet=wb.createSheet(sheetName);
        }
      }
 else {
        sheet=wb.createSheet(sheetName);
      }
    }
 else {
      xlsxFile.delete();
      wb=new SXSSFWorkbook(rowAccessWindowSize);
      sheet=wb.createSheet(sheetName);
    }
  }
 else {
    wb=new SXSSFWorkbook(rowAccessWindowSize);
    sheet=wb.createSheet(sheetName);
  }
  if (isAbsY) {
    startX=absX;
    curY=absY;
  }
}

Fixed version (ground truth):
public void prepareXlsxFile(String fileName) throws Exception {
  File xlsxFile=new File(fileName);
  if (xlsxFile.exists()) {
    if (isAbsY && keepCellFormat) {
      initPreXlsx(fileName);
    }
    if (appendWorkbook) {
      InputStream inp=new FileInputStream(fileName);
      wb=WorkbookFactory.create(inp);
      sheet=wb.getSheet(sheetName);
      if (sheet != null) {
        if (appendSheet) {
          if (sheet.getLastRowNum() != 0 || sheet.getRow(0) != null) {
            curY=sheet.getLastRowNum() + 1;
          }
        }
 else {
          wb.removeSheetAt(wb.getSheetIndex(sheetName));
          sheet=wb.createSheet(sheetName);
        }
      }
 else {
        sheet=wb.createSheet(sheetName);
      }
    }
 else {
      xlsxFile.delete();
      wb=new SXSSFWorkbook(rowAccessWindowSize);
      sheet=wb.createSheet(sheetName);
    }
  }
 else {
    wb=new SXSSFWorkbook(rowAccessWindowSize);
    sheet=wb.createSheet(sheetName);
  }
  if (isAbsY) {
    startX=absX;
    curY=absY;
  }
}
Program: 123290
Project: 123290
Buggy source:
@Override public void execute(){
  MapperManager manager=graphicViewer.getMapperManager();
  OutputXmlTreeEditPart currentSelectedOutputXmlTree=graphicViewer.getFiguresManager().getCurrentSelectedOutputXmlTree();
  if (currentSelectedOutputXmlTree != null) {
    OutputXmlTree outputTree=(OutputXmlTree)currentSelectedOutputXmlTree.getModel();
    XmlMapComponent mapperComponent=manager.getMapperComponent();
    mapperComponent.getProcess().removeUniqueConnectionName(outputTree.getName());
    removeMetadataTableByName(outputTree.getName());
    for (    OutputTreeNode treeNode : outputTree.getNodes()) {
      XmlMapUtil.detachConnectionsSouce(treeNode,mapData);
    }
    mapData.getOutputTrees().remove(outputTree);
    XmlMapUtil.detachFilterSource(outputTree,mapData);
  }
  if (mapData.getOutputTrees().isEmpty() && min_size.isEnabled()) {
    min_size.setEnabled(false);
  }
}

Fixed version (ground truth):
@Override public void execute(){
  MapperManager manager=graphicViewer.getMapperManager();
  OutputXmlTreeEditPart currentSelectedOutputXmlTree=graphicViewer.getFiguresManager().getCurrentSelectedOutputXmlTree();
  if (currentSelectedOutputXmlTree != null) {
    OutputXmlTree outputTree=(OutputXmlTree)currentSelectedOutputXmlTree.getModel();
    int indexOf=mapDataPart.getModelChildren().indexOf(outputTree);
    XmlMapComponent mapperComponent=manager.getMapperComponent();
    mapperComponent.getProcess().removeUniqueConnectionName(outputTree.getName());
    removeMetadataTableByName(outputTree.getName());
    for (    OutputTreeNode treeNode : outputTree.getNodes()) {
      XmlMapUtil.detachConnectionsSouce(treeNode,mapData);
    }
    mapData.getOutputTrees().remove(outputTree);
    XmlMapUtil.detachFilterSource(outputTree,mapData);
    indexOf=indexOf - 1;
    if (indexOf > -1 && (EditPart)mapDataPart.getChildren().get(indexOf) instanceof OutputXmlTreeEditPart) {
      mapDataPart.getViewer().select((EditPart)mapDataPart.getChildren().get(indexOf));
    }
 else     if (indexOf > -1 && indexOf + 1 < mapDataPart.getChildren().size() && (EditPart)mapDataPart.getChildren().get(indexOf + 1) instanceof OutputXmlTreeEditPart) {
      mapDataPart.getViewer().select((EditPart)mapDataPart.getChildren().get(indexOf + 1));
    }
 else {
      manager.getMapperUI().getTabFolderEditors().getOutputMetaEditorView().setMetadataTableEditor(null);
    }
  }
  if (mapData.getOutputTrees().isEmpty() && min_size.isEnabled()) {
    min_size.setEnabled(false);
  }
}
Program: 123291
Project: 123291
Buggy source:
public static void createParentFolderIfNotExists(String filePath) throws IOException {
  File file=new File(filePath);
  File parentFile=file.getParentFile();
  if (!parentFile.isDirectory()) {
    boolean createFolder=parentFile.mkdirs();
    if (!createFolder) {
      throw new RuntimeException("String_Node_Str" + parentFile.getAbsolutePath() + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public static synchronized void createParentFolderIfNotExists(String filePath) throws IOException {
  File file=new File(filePath);
  File parentFile=file.getParentFile();
  if (!parentFile.isDirectory()) {
    boolean createFolder=parentFile.mkdirs();
    if (!createFolder) {
      throw new RuntimeException("String_Node_Str" + parentFile.getAbsolutePath() + "String_Node_Str");
    }
  }
}
Program: 123294
Project: 123294
Buggy source:
private void createLeftContent(Composite parent){
  RepositoryCheckBoxView checkboxTreeViewer=new RepositoryCheckBoxView();
  try {
    checkboxTreeViewer.init(repositoryView.getViewSite());
  }
 catch (  PartInitException e) {
    e.printStackTrace();
  }
  checkboxTreeViewer.createPartControl(parent);
  treeViewer=(CheckboxRepositoryTreeViewer)checkboxTreeViewer.getViewer();
  treeViewer.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      return filterRepositoryNode(element);
    }
  }
);
  treeViewer.expandAll();
  RepositoryNode referenceProjectNode=((ProjectRepositoryNode)checkboxTreeViewer.getRoot()).getReferenceProjectNode();
  if (referenceProjectNode != null) {
    treeViewer.collapseToLevel(referenceProjectNode,treeViewer.ALL_LEVELS);
  }
  String[] uncheckedNodesFromFilter=RepositoryManager.getFiltersByPreferenceKey(IRepositoryPrefConstants.FILTER_BY_NODE);
  if (uncheckedNodesFromFilter != null && uncheckedNodesFromFilter.length > 0) {
    uncheckedNode.addAll(Arrays.asList(uncheckedNodesFromFilter));
  }
  restoreTreeStatus(checkboxTreeViewer);
}

Fixed version (ground truth):
private void createLeftContent(Composite parent){
  RepositoryViewerProvider provider=new RepositoryViewerProvider(){
    @Override protected RepositoryNode getInputRoot(    RepositoryContentProvider contentProvider){
      return contentProvider.getRoot();
    }
  }
;
  treeViewer=(CheckboxRepositoryTreeViewer)provider.createViewer(parent);
  treeViewer.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      return filterRepositoryNode(element);
    }
  }
);
  treeViewer.expandAll();
  RepositoryNode referenceProjectNode=((ProjectRepositoryNode)((RepositoryContentProvider)treeViewer.getContentProvider()).getRoot()).getReferenceProjectNode();
  if (referenceProjectNode != null) {
    treeViewer.collapseToLevel(referenceProjectNode,treeViewer.ALL_LEVELS);
  }
  String[] uncheckedNodesFromFilter=RepositoryManager.getFiltersByPreferenceKey(IRepositoryPrefConstants.FILTER_BY_NODE);
  if (uncheckedNodesFromFilter != null && uncheckedNodesFromFilter.length > 0) {
    uncheckedNode.addAll(Arrays.asList(uncheckedNodesFromFilter));
  }
  restoreTreeStatus(treeViewer);
}
Program: 123297
Project: 123297
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  ISelection selection=schemaTreeViewer.getSelection();
  SchemasKeyData selectedData=null;
  if (selection instanceof IStructuredSelection) {
    Object element=((IStructuredSelection)selection).getFirstElement();
    if (element instanceof SchemasKeyData) {
      selectedData=(SchemasKeyData)element;
      IMetadataTable metadataTable=MetadataTool.getMetadataTableFromNode(getMultiSchemasComponent(),selectedData.getUniqueRecord());
      if (metadataTable == null) {
        metadataTable=new org.talend.core.model.metadata.MetadataTable();
      }
      MetadataDialog dialog=new MetadataDialog(MultiSchemasUI.this.getShell(),metadataTable,getMultiSchemasComponent(),new CommandStackForComposite(MultiSchemasUI.this.getShell()));
      dialog.setText("String_Node_Str" + selectedData.getUniqueRecord());
      if (Window.OK == dialog.open()) {
        metadataTable=dialog.getOutputMetaData();
        if (!selectedData.getMetadataColumns().isEmpty()) {
          selectedData.getMetadataColumns().clear();
        }
        multiSchemaManager.createMultiSchemasColumns(selectedData,metadataTable);
        getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  ISelection selection=schemaTreeViewer.getSelection();
  SchemasKeyData selectedData=null;
  if (selection instanceof IStructuredSelection) {
    Object element=((IStructuredSelection)selection).getFirstElement();
    if (element instanceof SchemasKeyData) {
      selectedData=(SchemasKeyData)element;
      IMetadataTable metadataTable=MetadataTool.getMetadataTableFromNode(getMultiSchemasComponent(),selectedData.getUniqueRecord());
      if (metadataTable == null) {
        metadataTable=new org.talend.core.model.metadata.MetadataTable();
      }
      metadataTable.getListColumns().clear();
      SchemasKeyData keydata=(SchemasKeyData)schemaTreeViewer.getInput();
      for (int i=0; i < keydata.getChildren().size(); i++) {
        if (selectedData.getUniqueRecord().equals(keydata.getChildren().get(i).getUniqueRecord())) {
          metadataTable.getListColumns().addAll(keydata.getChildren().get(i).getMetadataColumns());
          break;
        }
      }
      MetadataDialog dialog=new MetadataDialog(MultiSchemasUI.this.getShell(),metadataTable,getMultiSchemasComponent(),new CommandStackForComposite(MultiSchemasUI.this.getShell()));
      dialog.setText("String_Node_Str" + selectedData.getUniqueRecord());
      if (Window.OK == dialog.open()) {
        metadataTable=dialog.getOutputMetaData();
        if (!selectedData.getMetadataColumns().isEmpty()) {
          selectedData.getMetadataColumns().clear();
        }
        multiSchemaManager.createMultiSchemasColumns(selectedData,metadataTable);
        getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
      }
    }
  }
}
Program: 123302
Project: 123302
Buggy source:
protected void restoreWidgetValuesForPetalsESB(){
  IDialogSettings settings=getDialogSettings();
  if (settings != null) {
    String[] directoryNames=settings.getArray(STORE_DESTINATION_NAMES_ID);
    String saName=getPetalsDefaultSaName();
    if (directoryNames != null && directoryNames.length > 0) {
      for (int i=0; i < directoryNames.length; i++) {
        if (directoryNames[i].toLowerCase().endsWith("String_Node_Str")) {
          directoryNames[i]=(directoryNames[i].charAt(0) + "String_Node_Str").toUpperCase() + directoryNames[i].substring(1);
          addDestinationItem(directoryNames[i]);
        }
        setDestinationValue(directoryNames[0].substring(0,(directoryNames[0].lastIndexOf("String_Node_Str") + 1)) + saName);
      }
    }
 else {
      String userDir=System.getProperty("String_Node_Str");
      IPath path=new Path(userDir).append(saName);
      saDestinationFilePath=path.toOSString();
      setDestinationValue(saDestinationFilePath);
    }
    sourceButton.setSelection(settings.getBoolean(STORE_SOURCE_ID));
    userRoutineButton.setSelection(settings.getBoolean(STORE_USER_ROUTINE_ID));
    zipOption="String_Node_Str";
  }
  if (getProcessItem() != null) {
    List<String> contextNames=getJobContexts(getProcessItem());
    contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
    contextCombo.setVisibleItemCount(contextNames.size());
    if (contextNames.size() > 0)     contextCombo.select(0);
  }
}

Fixed version (ground truth):
protected void restoreWidgetValuesForPetalsESB(){
  IDialogSettings settings=getDialogSettings();
  if (settings != null) {
    String[] directoryNames=settings.getArray(STORE_DESTINATION_NAMES_ID);
    String saName=getPetalsDefaultSaName();
    if (directoryNames != null && directoryNames.length > 0) {
      for (int i=0; i < directoryNames.length; i++) {
        if (directoryNames[i].toLowerCase().endsWith("String_Node_Str")) {
          directoryNames[i]=(directoryNames[i].charAt(0) + "String_Node_Str").toUpperCase() + directoryNames[i].substring(1);
          addDestinationItem(directoryNames[i]);
        }
        setDestinationValue(directoryNames[0].substring(0,(directoryNames[0].lastIndexOf("String_Node_Str") + 1)) + saName);
      }
    }
 else {
      String userDir=System.getProperty("String_Node_Str");
      IPath path=new Path(userDir).append(saName);
      setDestinationValue(path.toOSString());
    }
    saDestinationFilePath=getDestinationValue();
    sourceButton.setSelection(settings.getBoolean(STORE_SOURCE_ID));
    userRoutineButton.setSelection(settings.getBoolean(STORE_USER_ROUTINE_ID));
    zipOption="String_Node_Str";
  }
  if (getProcessItem() != null) {
    List<String> contextNames=getJobContexts(getProcessItem());
    contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
    contextCombo.setVisibleItemCount(contextNames.size());
    if (contextNames.size() > 0) {
      contextCombo.select(0);
    }
  }
}
Program: 123304
Project: 123304
Buggy source:
public void widgetSelected(SelectionEvent e){
  exportDependencies.setEnabled(jobItemButton.getSelection());
  if (!jobItemButton.getSelection()) {
    exportDependencies.setSelection(false);
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  exportDependencies.setEnabled(jobItemButton.getSelection());
  if (!jobItemButton.getSelection()) {
    exportDependencies.setSelection(false);
  }
}
Program: 123305
Project: 123305
Buggy source:
protected boolean validateOptionsGroup(){
  boolean isValid=false;
  if (super.validateOptionsGroup()) {
    boolean hasAttachment=false;
    for (int i=0; !hasAttachment && currentCtxTypes != null && i < currentCtxTypes.size(); i++) {
      ContextTypeDefinition def=currentCtxTypes.get(i);
      hasAttachment=def.getExportType() != ContextExportType.NOT_EXPORTED || def.getExportType() != ContextExportType.PARAMETER;
    }
    if (hasAttachment && PetalsTemporaryOptionsKeeper.INSTANCE.isValidateByWsdl()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
      isValid=false;
    }
 else {
      setErrorMessage(null);
      isValid=true;
    }
  }
  setPageComplete(isValid);
  return isValid;
}

Fixed version (ground truth):
@Override protected boolean validateOptionsGroup(){
  boolean isValid=false;
  if (super.validateOptionsGroup()) {
    boolean hasAttachment=false;
    for (int i=0; !hasAttachment && currentCtxTypes != null && i < currentCtxTypes.size(); i++) {
      ContextTypeDefinition def=currentCtxTypes.get(i);
      hasAttachment=def.getExportType() != ContextExportType.NOT_EXPORTED || def.getExportType() != ContextExportType.PARAMETER;
    }
    if (hasAttachment && PetalsTemporaryOptionsKeeper.INSTANCE.isValidateByWsdl()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
      isValid=false;
    }
 else {
      setErrorMessage(null);
      isValid=true;
    }
  }
  if (getCurrentExportType1().equals(JobExportType.PETALSESB)) {
    if (isMultiNodes()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
      isValid=false;
    }
  }
  setPageComplete(isValid);
  return isValid;
}
Program: 123306
Project: 123306
Buggy source:
protected void restoreWidgetValues(){
  IDialogSettings settings=getDialogSettings();
  if (settings != null) {
    String[] directoryNames=settings.getArray(PETALS_EXPORT_DESTINATIONS);
    if (directoryNames == null || directoryNames.length == 0)     return;
    if (directoryNames[0].endsWith(getPetalsDefaultSaName())) {
      setDestinationValue(directoryNames[0]);
      saDestinationFilePath=directoryNames[0];
    }
    for (int i=0; i < directoryNames.length; i++) {
      addDestinationItem(directoryNames[i]);
    }
  }
}

Fixed version (ground truth):
@Override protected void restoreWidgetValues(){
  IDialogSettings settings=getDialogSettings();
  if (settings != null) {
    String[] directoryNames=settings.getArray(PETALS_EXPORT_DESTINATIONS);
    if (directoryNames == null || directoryNames.length == 0) {
      return;
    }
    if (directoryNames[0].endsWith(getPetalsDefaultSaName())) {
      setDestinationValue(directoryNames[0]);
      saDestinationFilePath=directoryNames[0];
    }
    for (    String directoryName : directoryNames) {
      addDestinationItem(directoryName);
    }
  }
}
Program: 123307
Project: 123307
Buggy source:
public JobExportType getCurrentExportType1(){
  if (exportTypeCombo != null && !exportTypeCombo.getText().equals("String_Node_Str")) {
    return JobExportType.getTypeFromLabel(exportTypeCombo.getText());
  }
 else {
    IDialogSettings settings=getDialogSettings();
    if (settings != null && settings.get(STORE_EXPORTTYPE_ID) != null) {
      return JobExportType.getTypeFromString(settings.get(STORE_EXPORTTYPE_ID));
    }
  }
  return JobExportType.POJO;
}

Fixed version (ground truth):
@Override public JobExportType getCurrentExportType1(){
  if (exportTypeCombo != null && !exportTypeCombo.getText().equals("String_Node_Str")) {
    return JobExportType.getTypeFromLabel(exportTypeCombo.getText());
  }
 else {
    IDialogSettings settings=getDialogSettings();
    if (settings != null && settings.get(STORE_EXPORTTYPE_ID) != null) {
      return JobExportType.getTypeFromString(settings.get(STORE_EXPORTTYPE_ID));
    }
  }
  return JobExportType.POJO;
}
Program: 123308
Project: 123308
Buggy source:
@Override public boolean checkExport(){
  setErrorMessage(null);
  if (!super.checkExport()) {
    return false;
  }
  if (getCurrentExportType1().equals(JobExportType.PETALSESB)) {
    chkButton.setVisible(false);
    zipOption=null;
    if (isMultiNodes()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
    }
    validateOptionsGroup();
  }
  if (getCurrentExportType1().equals(JobExportType.JBOSSESB)) {
    if (isMultiNodes()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
    }
    String requiredJar="String_Node_Str";
    List<ModuleNeeded> toCheck=ModulesNeededProvider.getModulesNeeded();
    for (    ModuleNeeded current : toCheck) {
      if (requiredJar.equals(current.getModuleName())) {
        if (current.getStatus() == ELibraryInstallStatus.NOT_INSTALLED) {
          StringBuilder buff=new StringBuilder();
          buff.append(Messages.getString("String_Node_Str"));
          buff.append(Messages.getString("String_Node_Str"));
          setErrorMessage(buff.toString());
          break;
        }
      }
    }
  }
  if (getCurrentExportType1().equals(JobExportType.OSGI)) {
    if (isMultiNodes()) {
      setErrorMessage("String_Node_Str");
    }
  }
  if (getCheckNodes().length == 0) {
    setErrorMessage(Messages.getString("String_Node_Str"));
  }
  boolean noError=getErrorMessage() == null;
  setPageComplete(noError);
  return noError;
}

Fixed version (ground truth):
@Override public boolean checkExport(){
  setErrorMessage(null);
  if (!super.checkExport()) {
    return false;
  }
  if (getCurrentExportType1().equals(JobExportType.PETALSESB)) {
    chkButton.setVisible(false);
    zipOption=null;
    if (isMultiNodes()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
    }
    validateOptionsGroup();
  }
  if (getCurrentExportType1().equals(JobExportType.JBOSSESB)) {
    if (isMultiNodes()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
    }
    String requiredJar="String_Node_Str";
    List<ModuleNeeded> toCheck=ModulesNeededProvider.getModulesNeeded();
    for (    ModuleNeeded current : toCheck) {
      if (requiredJar.equals(current.getModuleName())) {
        if (current.getStatus() == ELibraryInstallStatus.NOT_INSTALLED) {
          StringBuilder buff=new StringBuilder();
          buff.append(Messages.getString("String_Node_Str"));
          buff.append(Messages.getString("String_Node_Str"));
          setErrorMessage(buff.toString());
          break;
        }
      }
    }
  }
  if (getCurrentExportType1().equals(JobExportType.PETALSESB)) {
    if (isMultiNodes()) {
      setErrorMessage(Messages.getString("String_Node_Str"));
    }
  }
  if (getCurrentExportType1().equals(JobExportType.OSGI)) {
    if (isMultiNodes()) {
      setErrorMessage("String_Node_Str");
    }
  }
  if (getCheckNodes().length == 0) {
    setErrorMessage(Messages.getString("String_Node_Str"));
  }
  boolean noError=getErrorMessage() == null;
  setPageComplete(noError);
  return noError;
}
Program: 123311
Project: 123311
Buggy source:
private CellStyle getPreCellStyle(){
  if (isAbsY && keepCellFormat) {
    if (preCell == null) {
      return null;
    }
 else {
      CellStyle preCellStyle=preCell.getCellStyle();
      CellStyle targetCellStyle=wb.createCellStyle();
      targetCellStyle.cloneStyleFrom(preCellStyle);
      return targetCellStyle;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private CellStyle getPreCellStyle(){
  if (isAbsY && keepCellFormat) {
    CellStyle preCellStyle=null;
    if (preCell == null) {
      preCellStyle=preSheet.getColumnStyle(curCell.getColumnIndex());
    }
 else {
      preCellStyle=preCell.getCellStyle();
    }
    CellStyle targetCellStyle=wb.createCellStyle();
    targetCellStyle.cloneStyleFrom(preCellStyle);
    return targetCellStyle;
  }
 else {
    return null;
  }
}
Program: 123312
Project: 123312
Buggy source:
public void prepareXlsxFile(String fileName) throws Exception {
  File xlsxFile=new File(fileName);
  if (xlsxFile.exists()) {
    if (isAbsY && keepCellFormat) {
      initPreXlsx(fileName);
    }
    if (appendWorkbook) {
      InputStream inp=new FileInputStream(fileName);
      wb=WorkbookFactory.create(inp);
      sheet=wb.getSheet(sheetName);
      if (sheet != null) {
        if (appendSheet) {
          curY=sheet.getLastRowNum() + 1;
        }
 else {
          wb.removeSheetAt(wb.getSheetIndex(sheetName));
          sheet=wb.createSheet(sheetName);
        }
      }
 else {
        sheet=wb.createSheet(sheetName);
      }
    }
 else {
      xlsxFile.delete();
      wb=new XSSFWorkbook();
      sheet=wb.createSheet(sheetName);
    }
  }
 else {
    wb=new XSSFWorkbook();
    sheet=wb.createSheet(sheetName);
  }
  if (isAbsY) {
    startX=absX;
    curY=absY;
  }
}

Fixed version (ground truth):
public void prepareXlsxFile(String fileName) throws Exception {
  File xlsxFile=new File(fileName);
  if (xlsxFile.exists()) {
    if (isAbsY && keepCellFormat) {
      initPreXlsx(fileName);
    }
    if (appendWorkbook) {
      InputStream inp=new FileInputStream(fileName);
      wb=WorkbookFactory.create(inp);
      sheet=wb.getSheet(sheetName);
      if (sheet != null) {
        if (appendSheet) {
          if (sheet.getLastRowNum() != 0 || sheet.getRow(0) != null) {
            curY=sheet.getLastRowNum() + 1;
          }
        }
 else {
          wb.removeSheetAt(wb.getSheetIndex(sheetName));
          sheet=wb.createSheet(sheetName);
        }
      }
 else {
        sheet=wb.createSheet(sheetName);
      }
    }
 else {
      xlsxFile.delete();
      wb=new XSSFWorkbook();
      sheet=wb.createSheet(sheetName);
    }
  }
 else {
    wb=new XSSFWorkbook();
    sheet=wb.createSheet(sheetName);
  }
  if (isAbsY) {
    startX=absX;
    curY=absY;
  }
}
Program: 123313
Project: 123313
Buggy source:
public static void createParentFolderIfNotExists(String filePath) throws IOException {
  File file=new File(filePath);
  File parentFile=file.getParentFile();
  if (!parentFile.isDirectory()) {
    boolean createFolder=parentFile.mkdirs();
    if (!createFolder) {
      throw new RuntimeException("String_Node_Str" + parentFile.getAbsolutePath() + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public static synchronized void createParentFolderIfNotExists(String filePath) throws IOException {
  File file=new File(filePath);
  File parentFile=file.getParentFile();
  if (!parentFile.isDirectory()) {
    boolean createFolder=parentFile.mkdirs();
    if (!createFolder) {
      throw new RuntimeException("String_Node_Str" + parentFile.getAbsolutePath() + "String_Node_Str");
    }
  }
}
Program: 123317
Project: 123317
Buggy source:
@Override protected boolean calculateEnabled(){
  if (getSelectedObjects().isEmpty()) {
    return false;
  }
 else {
    Object s=getSelectedObjects().get(0);
    if (s instanceof List && !((List)s).isEmpty()) {
      List selectedarts=(List)s;
      Object object=selectedarts.get(selectedarts.size() - 1);
      if (object instanceof TreeNodeEditPart) {
        TreeNodeEditPart parentPart=(TreeNodeEditPart)object;
        parentNode=(TreeNode)parentPart.getModel();
        if (parentNode.eContainer() instanceof AbstractInOutTree && XmlMapUtil.DOCUMENT.equals(parentNode.getType())) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean calculateEnabled(){
  if (getSelectedObjects().isEmpty()) {
    return false;
  }
 else {
    Object s=getSelectedObjects().get(0);
    if (s instanceof List && !((List)s).isEmpty()) {
      List selectedarts=(List)s;
      Object object=selectedarts.get(selectedarts.size() - 1);
      if (object instanceof TreeNodeEditPart) {
        TreeNodeEditPart parentPart=(TreeNodeEditPart)object;
        schemaNode=(TreeNode)parentPart.getModel();
        if (schemaNode.eContainer() instanceof AbstractInOutTree && XmlMapUtil.DOCUMENT.equals(schemaNode.getType())) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 123319
Project: 123319
Buggy source:
private void prepareEmfTreeFromXml(XmlFileConnection connection){
  if (!connection.isInputModel()) {
    prepareModelFromOutput(connection.getRoot(),connection.getLoop(),connection.getGroup());
  }
 else {
    String absoluteXPathQuery="String_Node_Str";
    List<SchemaTarget> schemaTargets=null;
    if (!connection.getSchema().isEmpty() && connection.getSchema().get(0) instanceof XmlXPathLoopDescriptorImpl) {
      absoluteXPathQuery=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getAbsoluteXPathQuery();
      schemaTargets=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getSchemaTargets();
    }
    if (schemaTargets == null || schemaTargets.isEmpty()) {
      return;
    }
    this.schemaTargets=schemaTargets;
    String file=connection.getXmlFilePath();
    List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
    File xmlFile=new File(file);
    if (xmlFile.exists()) {
      list=TreeUtil.getFoxTreeNodesForXmlMap(xmlFile.getAbsolutePath(),absoluteXPathQuery);
    }
 else     if (connection.getFileContent() != null && connection.getFileContent().length > 0) {
      String xsdFile=initFileContent(connection);
      if (xsdFile != null && new File(xsdFile).exists()) {
        list=TreeUtil.getFoxTreeNodesForXmlMap(xsdFile,absoluteXPathQuery);
      }
    }
    prepareEmfTree(list,parentNode,null,absoluteXPathQuery);
  }
}

Fixed version (ground truth):
private void prepareEmfTreeFromXml(XmlFileConnection connection){
  if (!connection.isInputModel()) {
    prepareModelFromOutput(connection.getRoot(),connection.getLoop(),connection.getGroup());
  }
 else {
    String absoluteXPathQuery="String_Node_Str";
    List<SchemaTarget> schemaTargets=null;
    if (!connection.getSchema().isEmpty() && connection.getSchema().get(0) instanceof XmlXPathLoopDescriptorImpl) {
      absoluteXPathQuery=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getAbsoluteXPathQuery();
      schemaTargets=((XmlXPathLoopDescriptorImpl)connection.getSchema().get(0)).getSchemaTargets();
    }
    if (schemaTargets == null || schemaTargets.isEmpty()) {
      return;
    }
    this.schemaTargets=schemaTargets;
    String file=connection.getXmlFilePath();
    List<FOXTreeNode> list=new ArrayList<FOXTreeNode>();
    File xmlFile=new File(file);
    if (xmlFile.exists()) {
      list=TreeUtil.getFoxTreeNodesForXmlMap(xmlFile.getAbsolutePath(),absoluteXPathQuery);
    }
 else     if (connection.getFileContent() != null && connection.getFileContent().length > 0) {
      String xsdFile=initFileContent(connection);
      if (xsdFile != null && new File(xsdFile).exists()) {
        list=TreeUtil.getFoxTreeNodesForXmlMap(xsdFile,absoluteXPathQuery);
      }
    }
    prepareEmfTree(list,schemaNode,null,absoluteXPathQuery);
  }
}
Program: 123321
Project: 123321
Buggy source:
@Override public void execute(){
  MapperManager manager=graphicViewer.getMapperManager();
  OutputXmlTreeEditPart currentSelectedOutputXmlTree=graphicViewer.getFiguresManager().getCurrentSelectedOutputXmlTree();
  if (currentSelectedOutputXmlTree != null) {
    OutputXmlTree outputTree=(OutputXmlTree)currentSelectedOutputXmlTree.getModel();
    XmlMapComponent mapperComponent=manager.getMapperComponent();
    mapperComponent.getProcess().removeUniqueConnectionName(outputTree.getName());
    removeMetadataTableByName(outputTree.getName());
    for (    OutputTreeNode treeNode : outputTree.getNodes()) {
      XmlMapUtil.detachConnectionsSouce(treeNode,mapData);
    }
    mapData.getOutputTrees().remove(outputTree);
    XmlMapUtil.detachFilterSource(outputTree,mapData);
  }
  if (mapData.getOutputTrees().isEmpty() && min_size.isEnabled()) {
    min_size.setEnabled(false);
  }
}

Fixed version (ground truth):
@Override public void execute(){
  MapperManager manager=graphicViewer.getMapperManager();
  OutputXmlTreeEditPart currentSelectedOutputXmlTree=graphicViewer.getFiguresManager().getCurrentSelectedOutputXmlTree();
  if (currentSelectedOutputXmlTree != null) {
    OutputXmlTree outputTree=(OutputXmlTree)currentSelectedOutputXmlTree.getModel();
    int indexOf=mapDataPart.getModelChildren().indexOf(outputTree);
    XmlMapComponent mapperComponent=manager.getMapperComponent();
    mapperComponent.getProcess().removeUniqueConnectionName(outputTree.getName());
    removeMetadataTableByName(outputTree.getName());
    for (    OutputTreeNode treeNode : outputTree.getNodes()) {
      XmlMapUtil.detachConnectionsSouce(treeNode,mapData);
    }
    mapData.getOutputTrees().remove(outputTree);
    XmlMapUtil.detachFilterSource(outputTree,mapData);
    indexOf=indexOf - 1;
    if (indexOf > -1 && (EditPart)mapDataPart.getChildren().get(indexOf) instanceof OutputXmlTreeEditPart) {
      mapDataPart.getViewer().select((EditPart)mapDataPart.getChildren().get(indexOf));
    }
 else     if (indexOf > -1 && indexOf + 1 < mapDataPart.getChildren().size() && (EditPart)mapDataPart.getChildren().get(indexOf + 1) instanceof OutputXmlTreeEditPart) {
      mapDataPart.getViewer().select((EditPart)mapDataPart.getChildren().get(indexOf + 1));
    }
 else {
      manager.getMapperUI().getTabFolderEditors().getOutputMetaEditorView().setMetadataTableEditor(null);
    }
  }
  if (mapData.getOutputTrees().isEmpty() && min_size.isEnabled()) {
    min_size.setEnabled(false);
  }
}
Program: 123322
Project: 123322
Buggy source:
/** 
 * cLi Comment method "createSchemasTree".
 * @param csvArray
 * @return tree of data.
 */
public SchemasKeyData createSchemasTree(CSVArrayAndSeparator csvArrayBean,int selectColumnIndex){
  if (csvArrayBean == null) {
    return null;
  }
  final SchemasKeyData rootSchemasKeyData=new SchemasKeyData("String_Node_Str");
  List<String[]> rows=csvArrayBean.getCsvArray().getRows();
  for (int i=0; i < rows.size(); i++) {
    String[] line=rows.get(i);
    final String key=precessString(line[selectColumnIndex]);
    if (key == null) {
      continue;
    }
    String newKey=key + csvArrayBean.getSeparators().get(i);
    SchemasKeyData schemaData=findSchemasKeyData(rootSchemasKeyData,newKey);
    if (schemaData == null) {
      schemaData=new SchemasKeyData(key);
      schemaData.setSeparator(csvArrayBean.getSeparators().get(i));
      schemaData.setUniqueRecord(generateUniqueRecordName(null,rootSchemasKeyData));
      rootSchemasKeyData.addChild(schemaData);
    }
    MultiSchemaRowData rowData=createRowData(line,selectColumnIndex);
    if (rowData != null) {
      schemaData.addRowsData(rowData);
    }
  }
  for (  SchemasKeyData schemaData : rootSchemasKeyData.getChildren()) {
    createPropertiesColumns(schemaData);
  }
  return rootSchemasKeyData;
}

Fixed version (ground truth):
/** 
 * cLi Comment method "createSchemasTree".
 * @param csvArray
 * @return tree of data.
 */
public SchemasKeyData createSchemasTree(CSVArrayAndSeparator csvArrayBean,int selectColumnIndex){
  if (csvArrayBean == null) {
    return null;
  }
  final SchemasKeyData rootSchemasKeyData=new SchemasKeyData("String_Node_Str");
  List<String[]> rows=csvArrayBean.getCsvArray().getRows();
  for (int i=0; i < rows.size(); i++) {
    String[] line=rows.get(i);
    final String key=precessString(line[selectColumnIndex]);
    if (key == null) {
      continue;
    }
    String newKey=key + csvArrayBean.getSeparators().get(i);
    SchemasKeyData schemaData=findSchemasKeyData(rootSchemasKeyData,newKey);
    if (schemaData == null) {
      schemaData=new SchemasKeyData(key);
      String separator=csvArrayBean.getSeparators().get(i);
      if (separator != null && separator.equals("String_Node_Str")) {
        schemaData.setSeparator("String_Node_Str");
      }
 else {
        schemaData.setSeparator(separator);
      }
      schemaData.setUniqueRecord(generateUniqueRecordName(null,rootSchemasKeyData));
      rootSchemasKeyData.addChild(schemaData);
    }
    MultiSchemaRowData rowData=createRowData(line,selectColumnIndex);
    if (rowData != null) {
      schemaData.addRowsData(rowData);
    }
  }
  for (  SchemasKeyData schemaData : rootSchemasKeyData.getChildren()) {
    createPropertiesColumns(schemaData);
  }
  return rootSchemasKeyData;
}
Program: 123323
Project: 123323
Buggy source:
/** 
 * cLi Comment method "createSchemasTree".
 * @param csvArray
 * @return tree of data.
 */
public SchemasKeyData createSchemasTree(CSVArrayAndSeparator csvArrayBean,int selectColumnIndex){
  if (csvArrayBean == null) {
    return null;
  }
  final SchemasKeyData rootSchemasKeyData=new SchemasKeyData("String_Node_Str");
  List<String[]> rows=csvArrayBean.getCsvArray().getRows();
  for (int i=0; i < rows.size(); i++) {
    String[] line=rows.get(i);
    final String key=precessString(line[selectColumnIndex]);
    if (key == null) {
      continue;
    }
    String newKey=key + csvArrayBean.getSeparators().get(i);
    SchemasKeyData schemaData=findSchemasKeyData(rootSchemasKeyData,newKey);
    if (schemaData == null) {
      schemaData=new SchemasKeyData(key);
      schemaData.setSeparator(csvArrayBean.getSeparators().get(i));
      schemaData.setUniqueRecord(generateUniqueRecordName(null,rootSchemasKeyData));
      rootSchemasKeyData.addChild(schemaData);
    }
    MultiSchemaRowData rowData=createRowData(line,selectColumnIndex);
    if (rowData != null) {
      schemaData.addRowsData(rowData);
    }
  }
  for (  SchemasKeyData schemaData : rootSchemasKeyData.getChildren()) {
    createPropertiesColumns(schemaData);
  }
  return rootSchemasKeyData;
}

Fixed version (ground truth):
/** 
 * cLi Comment method "createSchemasTree".
 * @param csvArray
 * @return tree of data.
 */
public SchemasKeyData createSchemasTree(CSVArrayAndSeparator csvArrayBean,int selectColumnIndex){
  if (csvArrayBean == null) {
    return null;
  }
  final SchemasKeyData rootSchemasKeyData=new SchemasKeyData("String_Node_Str");
  List<String[]> rows=csvArrayBean.getCsvArray().getRows();
  for (int i=0; i < rows.size(); i++) {
    String[] line=rows.get(i);
    final String key=precessString(line[selectColumnIndex]);
    if (key == null) {
      continue;
    }
    String newKey=key + csvArrayBean.getSeparators().get(i);
    SchemasKeyData schemaData=findSchemasKeyData(rootSchemasKeyData,newKey);
    if (schemaData == null) {
      schemaData=new SchemasKeyData(key);
      String separator=csvArrayBean.getSeparators().get(i);
      if (separator != null && separator.equals("String_Node_Str")) {
        schemaData.setSeparator("String_Node_Str");
      }
 else {
        schemaData.setSeparator(separator);
      }
      schemaData.setUniqueRecord(generateUniqueRecordName(null,rootSchemasKeyData));
      rootSchemasKeyData.addChild(schemaData);
    }
    MultiSchemaRowData rowData=createRowData(line,selectColumnIndex);
    if (rowData != null) {
      schemaData.addRowsData(rowData);
    }
  }
  for (  SchemasKeyData schemaData : rootSchemasKeyData.getChildren()) {
    createPropertiesColumns(schemaData);
  }
  return rootSchemasKeyData;
}
Program: 123324
Project: 123324
Buggy source:
public static void createParentFolderIfNotExists(String filePath) throws IOException {
  File file=new File(filePath);
  File parentFile=file.getParentFile();
  if (!parentFile.isDirectory()) {
    boolean createFolder=parentFile.mkdirs();
    if (!createFolder) {
      throw new RuntimeException("String_Node_Str" + parentFile.getAbsolutePath() + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public static synchronized void createParentFolderIfNotExists(String filePath) throws IOException {
  File file=new File(filePath);
  File parentFile=file.getParentFile();
  if (!parentFile.isDirectory()) {
    boolean createFolder=parentFile.mkdirs();
    if (!createFolder) {
      throw new RuntimeException("String_Node_Str" + parentFile.getAbsolutePath() + "String_Node_Str");
    }
  }
}
Program: 123327
Project: 123327
Buggy source:
private String addQuoteForSpecialChar(String expression,DbMapComponent component){
  List<String> specialList=new ArrayList<String>();
  Map<String,List<String>> map=new HashMap<String,List<String>>();
  List<IConnection> inputConnections=(List<IConnection>)component.getIncomingConnections();
  if (inputConnections == null) {
    return expression;
  }
  for (  IConnection iconn : inputConnections) {
    IMetadataTable metadataTable=iconn.getMetadataTable();
    List<IMetadataColumn> lColumn=metadataTable.getListColumns();
    for (    IMetadataColumn co : lColumn) {
      String columnLabel=co.getLabel();
      String exp=MetadataToolHelper.validateValueNoLengthLimit(columnLabel);
      if (!exp.equals(columnLabel)) {
        specialList.add(columnLabel);
      }
    }
  }
  for (  String specialColumn : specialList) {
    if (expression.contains(specialColumn)) {
      if (map.get(expression) == null) {
        List<String> list=new ArrayList<String>();
        list.add(specialColumn);
        map.put(expression,list);
      }
 else {
        List<String> list=map.get(expression);
        list.add(specialColumn);
      }
    }
  }
  if (map.size() > 0) {
    List<String> list=map.get(expression);
    for (int i=0; i < list.size() - 1; i++) {
      String first=list.get(i);
      String second=list.get(i + 1);
      String temp;
      if (first.length() > second.length()) {
        temp=first;
        first=second;
        second=temp;
      }
    }
    String specialColumn=list.get(list.size() - 1);
    if (expression.contains(specialColumn)) {
      int begin=expression.indexOf(specialColumn);
      int length=specialColumn.length();
      int allLength=expression.length();
      expression=expression.substring(0,begin) + "String_Node_Str" + expression.substring(begin,begin + length)+ "String_Node_Str"+ expression.substring(begin + length,allLength);
      return expression;
    }
  }
  return expression;
}

Fixed version (ground truth):
protected String addQuoteForSpecialChar(String expression,DbMapComponent component){
  return expression;
}