nus-yam/ex-repair huggingface dataset:
Program: 127775
Project: 127775
Buggy source:
public static void saveResource(Resource resource) throws PersistenceException {
  if (resource == null) {
    return;
  }
  if (resource.getURI() == null) {
    return;
  }
  try {
    HashMap options=new HashMap(2);
    options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
    resource.save(options);
  }
 catch (  IOException e) {
    throw new PersistenceException(e);
  }
catch (  RuntimeException e) {
    log.warn("String_Node_Str" + resource.getURI() + "String_Node_Str",e);
    HashMap options=new HashMap(2);
    options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
    options.put(XMLResource.OPTION_XML_VERSION,"String_Node_Str");
    try {
      resource.save(options);
    }
 catch (    IOException e1) {
      throw new PersistenceException(e);
    }
  }
}

Fixed version (ground truth):
public static void saveResource(Resource resource) throws PersistenceException {
  if (resource == null) {
    return;
  }
  if (resource.getURI() == null) {
    return;
  }
  HashMap options=new HashMap(2);
  options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
  options.put(XMLResource.OPTION_ESCAPE_USING_CDATA,Boolean.TRUE);
  try {
    resource.save(options);
  }
 catch (  IOException e) {
    throw new PersistenceException(e);
  }
catch (  RuntimeException e) {
    log.warn("String_Node_Str" + resource.getURI() + "String_Node_Str",e);
    options.put(XMLResource.OPTION_XML_VERSION,"String_Node_Str");
    try {
      resource.save(options);
    }
 catch (    IOException e1) {
      throw new PersistenceException(e);
    }
  }
}
Program: 127776
Project: 127776
Buggy source:
@Override public Resource createResource(URI uri){
  String business="String_Node_Str";
  String context="String_Node_Str";
  String process="String_Node_Str";
  String joblet="String_Node_Str";
  if (uri.toString().contains("String_Node_Str" + business + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(business)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + context + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(context)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + process + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(process)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + joblet + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(joblet)) {
    return super.createResource(uri);
  }
 else {
    return new CwmResource(uri);
  }
}

Fixed version (ground truth):
@Override public Resource createResource(URI uri){
  String business="String_Node_Str";
  String context="String_Node_Str";
  String process="String_Node_Str";
  String joblet="String_Node_Str";
  if (validUrl(uri,business) || validUrl(uri,context) || validUrl(uri,process)|| validUrl(uri,joblet)) {
    return new TalendXMIResource(uri);
  }
 else {
    return new CwmResource(uri);
  }
}
Program: 127781
Project: 127781
Buggy source:
public static IRepositoryViewObject getRoutineFromName(Project tempProject,String name,boolean includeSystem){
  if (name == null) {
    return null;
  }
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  try {
    List<IRepositoryViewObject> all=factory.getAll(tempProject,ERepositoryObjectType.ROUTINES);
    for (    IRepositoryViewObject obj : all) {
      if (obj != null && obj.getProperty() != null) {
        Item item=obj.getProperty().getItem();
        String label=obj.getProperty().getLabel();
        if (item != null && item instanceof RoutineItem) {
          RoutineItem routineItem=(RoutineItem)item;
          if (name.equals(label)) {
            if (!includeSystem && routineItem.isBuiltIn()) {
              continue;
            }
 else {
              return obj;
            }
          }
        }
      }
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
  return null;
}

Fixed version (ground truth):
public static IRepositoryViewObject getRoutineFromName(Project tempProject,String name,boolean includeSystem){
  if (name == null) {
    return null;
  }
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  try {
    List<IRepositoryViewObject> all=factory.getAll(tempProject,ERepositoryObjectType.ROUTINES);
    if (PluginChecker.isPigudfPluginLoaded()) {
      all.addAll(factory.getAll(tempProject,ERepositoryObjectType.PIG_UDF));
    }
    for (    IRepositoryViewObject obj : all) {
      if (obj != null && obj.getProperty() != null) {
        Item item=obj.getProperty().getItem();
        String label=obj.getProperty().getLabel();
        if (item != null && item instanceof RoutineItem) {
          RoutineItem routineItem=(RoutineItem)item;
          if (name.equals(label)) {
            if (!includeSystem && routineItem.isBuiltIn()) {
              continue;
            }
 else {
              return obj;
            }
          }
        }
      }
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
  return null;
}
Program: 127784
Project: 127784
Buggy source:
/** 
 * DOC ocarbone Comment method "setupForm".
 */
protected void setupForm(boolean hasContextBtn){
  this.hasContextBtn=hasContextBtn;
  setDisposeListener();
  addComponents();
  if (!isInWizard) {
    statusLabel=new Label(this,SWT.LEFT);
    statusLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    statusLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_RED));
  }
  addFields();
  addExportContextButton();
  initialize();
  addUtilsButtonListeners();
  addFieldsListeners();
  if (this instanceof IRefreshable) {
    addAllKeyListener(getShell(),(IRefreshable)this);
  }
}

Fixed version (ground truth):
/** 
 * DOC ocarbone Comment method "setupForm".
 */
protected void setupForm(boolean hasContextBtn){
  this.hasContextBtn=hasContextBtn;
  setDisposeListener();
  addComponents();
  if (!isInWizard) {
    statusLabel=new Label(this,SWT.LEFT);
    statusLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    statusLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_RED));
  }
  addFields();
  addExportContextButton();
  addHelpInfoFields();
  initialize();
  addUtilsButtonListeners();
  addFieldsListeners();
  if (this instanceof IRefreshable) {
    addAllKeyListener(getShell(),(IRefreshable)this);
  }
}
Program: 127787
Project: 127787
Buggy source:
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,400,100);
  addGroupRowsToSkip(mainComposite,300,100);
  addGroupEscapeChar(mainComposite,400,105);
  addGroupLimit(mainComposite,300,105);
  addGroupFileViewer(this,700,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}

Fixed version (ground truth):
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,400,105);
  addGroupRowsToSkip(mainComposite,300,105);
  addGroupEscapeChar(mainComposite,400,110);
  addGroupLimit(mainComposite,300,110);
  addGroupFileViewer(this,700,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}
Program: 127788
Project: 127788
Buggy source:
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,280,80);
  addGroupRowsToSkip(mainComposite,300,80);
  addGroupDieOnErrorSettings(mainComposite,280,60);
  addGroupLimit(mainComposite,300,60);
  Composite mainComposite2=Form.startNewGridLayout(this,1);
  addGroupFileViewer(mainComposite2,600,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}

Fixed version (ground truth):
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,280,120);
  addGroupRowsToSkip(mainComposite,300,120);
  addGroupDieOnErrorSettings(mainComposite,280,67);
  addGroupLimit(mainComposite,300,67);
  Composite mainComposite2=Form.startNewGridLayout(this,1);
  addGroupFileViewer(mainComposite2,600,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}
Program: 127791
Project: 127791
Buggy source:
/** 
 * fieldSeparator : Adapt Custom Label and set the field Text.
 */
protected void fieldSeparatorManager(){
  if (isContextMode()) {
    return;
  }
  FieldSeparator seperator=FieldSeparator.getByName(fieldSeparatorCombo.getText());
  getConnection().setFieldSeparatorType(seperator);
  if (fieldSeparatorCombo.getSelectionIndex() >= 5) {
    fieldSeparatorText.setLabelText(fieldSeparatorCombo.getText());
    fieldSeparatorText.setEditable(true);
    fieldSeparatorText.setText(getConnection().getFieldSeparatorValue());
    fieldSeparatorText.forceFocus();
  }
 else {
switch (fieldSeparatorCombo.getSelectionIndex()) {
case 0:
      fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
    break;
case 1:
  fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
case 2:
fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
case 3:
fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
case 4:
fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
default :
break;
}
getConnection().setFieldSeparatorValue(fieldSeparatorText.getText());
fieldSeparatorText.setLabelText(Messages.getString("String_Node_Str"));
fieldSeparatorText.setEditable(true);
}
}

Fixed version (ground truth):
/** 
 * fieldSeparator : Adapt Custom Label and set the field Text.
 */
protected void fieldSeparatorManager(){
  if (isContextMode()) {
    return;
  }
  FieldSeparator seperator=FieldSeparator.getByName(fieldSeparatorCombo.getText());
  getConnection().setFieldSeparatorType(seperator);
  if (fieldSeparatorCombo.getSelectionIndex() >= 5) {
    fieldSeparatorText.setLabelText(fieldSeparatorCombo.getText());
    fieldSeparatorText.setEditable(true);
    fieldSeparatorText.setText(getConnection().getFieldSeparatorValue());
    fieldSeparatorText.forceFocus();
    fieldSeparatorText.setReadOnly(false);
  }
 else {
switch (fieldSeparatorCombo.getSelectionIndex()) {
case 0:
      fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
    break;
case 1:
  fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
case 2:
fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
case 3:
fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
case 4:
fieldSeparatorText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
break;
default :
break;
}
getConnection().setFieldSeparatorValue(fieldSeparatorText.getText());
fieldSeparatorText.setLabelText(Messages.getString("String_Node_Str"));
fieldSeparatorText.setReadOnly(true);
}
}
Program: 127792
Project: 127792
Buggy source:
/** 
 * rowSeparator : Adapt Custom Label and set the field Text.
 */
protected void rowSeparatorManager(){
  if (isContextMode()) {
    return;
  }
  RowSeparator separator=RowSeparator.getByName(rowSeparatorCombo.getText());
  getConnection().setRowSeparatorType(separator);
  if (rowSeparatorCombo.getSelectionIndex() == 1) {
    rowSeparatorText.setLabelText(rowSeparatorCombo.getText());
    rowSeparatorText.setEditable(true);
    rowSeparatorText.forceFocus();
  }
 else {
    if (rowSeparatorCombo.getSelectionIndex() == 0) {
      if (getConnection().getFormat().toString().equals(FileFormat.MAC_LITERAL.getName())) {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
 else {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
    }
    rowSeparatorText.setLabelText(Messages.getString("String_Node_Str"));
    getConnection().setRowSeparatorValue(rowSeparatorText.getText());
    rowSeparatorText.setEditable(true);
  }
}

Fixed version (ground truth):
/** 
 * rowSeparator : Adapt Custom Label and set the field Text.
 */
protected void rowSeparatorManager(){
  if (isContextMode()) {
    return;
  }
  RowSeparator separator=RowSeparator.getByName(rowSeparatorCombo.getText());
  getConnection().setRowSeparatorType(separator);
  if (rowSeparatorCombo.getSelectionIndex() == 1) {
    rowSeparatorText.setLabelText(rowSeparatorCombo.getText());
    rowSeparatorText.setEditable(true);
    rowSeparatorText.forceFocus();
    rowSeparatorText.setReadOnly(false);
  }
 else {
    if (rowSeparatorCombo.getSelectionIndex() == 0) {
      if (getConnection().getFormat().toString().equals(FileFormat.MAC_LITERAL.getName())) {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
 else {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
    }
    rowSeparatorText.setLabelText(Messages.getString("String_Node_Str"));
    getConnection().setRowSeparatorValue(rowSeparatorText.getText());
    rowSeparatorText.setEditable(true);
    rowSeparatorText.setReadOnly(true);
  }
}
Program: 127793
Project: 127793
Buggy source:
/** 
 * rowSeparator : Adapt Custom Label and set the field Text.
 */
protected void rowSeparatorManager(){
  if (isContextMode()) {
    return;
  }
  RowSeparator separator=RowSeparator.getByName(rowSeparatorCombo.getText());
  getConnection().setRowSeparatorType(separator);
  if (rowSeparatorCombo.getSelectionIndex() == 1) {
    rowSeparatorText.setLabelText(rowSeparatorCombo.getText());
    rowSeparatorText.setEditable(true);
    rowSeparatorText.forceFocus();
  }
 else {
    if (rowSeparatorCombo.getSelectionIndex() == 0) {
      if (getConnection().getFormat().toString().equals(FileFormat.MAC_LITERAL.getName())) {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
 else {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
    }
    rowSeparatorText.setLabelText(Messages.getString("String_Node_Str"));
    getConnection().setRowSeparatorValue(rowSeparatorText.getText());
    rowSeparatorText.setEditable(true);
  }
}

Fixed version (ground truth):
/** 
 * rowSeparator : Adapt Custom Label and set the field Text.
 */
protected void rowSeparatorManager(){
  if (isContextMode()) {
    return;
  }
  RowSeparator separator=RowSeparator.getByName(rowSeparatorCombo.getText());
  getConnection().setRowSeparatorType(separator);
  if (rowSeparatorCombo.getSelectionIndex() == 1) {
    rowSeparatorText.setLabelText(rowSeparatorCombo.getText());
    rowSeparatorText.setEditable(true);
    rowSeparatorText.forceFocus();
    rowSeparatorText.setReadOnly(false);
  }
 else {
    if (rowSeparatorCombo.getSelectionIndex() == 0) {
      if (getConnection().getFormat().toString().equals(FileFormat.MAC_LITERAL.getName())) {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
 else {
        rowSeparatorText.setText(TalendQuoteUtils.QUOTATION_MARK + "String_Node_Str" + TalendQuoteUtils.QUOTATION_MARK);
      }
    }
    rowSeparatorText.setLabelText(Messages.getString("String_Node_Str"));
    getConnection().setRowSeparatorValue(rowSeparatorText.getText());
    rowSeparatorText.setEditable(true);
    rowSeparatorText.setReadOnly(true);
  }
}
Program: 127795
Project: 127795
Buggy source:
@Override public int compare(Viewer viewer,TreePath parentPath,Object e1,Object e2){
  if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
    final RepositoryNode node1=(RepositoryNode)e1;
    final RepositoryNode node2=(RepositoryNode)e2;
    if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return 1;
    }
    if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return -1;
    }
    if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
      return e1.toString().compareTo(e2.toString());
    }
 else     if (viewerSorter != null) {
      if (viewerSorter instanceof TreePathViewerSorter) {
        return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
      }
 else {
        return viewerSorter.compare(viewer,e1,e2);
      }
    }
  }
  return super.compare(viewer,parentPath,e1,e2);
}

Fixed version (ground truth):
@Override public int compare(Viewer viewer,TreePath parentPath,Object e1,Object e2){
  if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
    final RepositoryNode node1=(RepositoryNode)e1;
    final RepositoryNode node2=(RepositoryNode)e2;
    if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return 1;
    }
    if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return -1;
    }
    if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
      return e1.toString().compareTo(e2.toString());
    }
 else     if (viewerSorter != null) {
      if (viewerSorter instanceof TreePathViewerSorter) {
        if (!node1.isInitialized() && !node2.isInitialized()) {
          return viewerSorter.compare(viewer,e1,e2);
        }
        return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
      }
 else {
        return viewerSorter.compare(viewer,e1,e2);
      }
    }
  }
  return super.compare(viewer,parentPath,e1,e2);
}
Program: 127796
Project: 127796
Buggy source:
@Override protected void checkSorter(TreeViewer treeViewer){
  ViewerSorter sorter=null;
  if (getRepView() != null) {
    final StructuredViewer viewer=getRepView().getViewer();
    sorter=viewer.getSorter();
  }
  final ViewerSorter viewerSorter=sorter;
  treeViewer.setSorter(new TreePathViewerSorter(){
    @Override public int compare(    Viewer viewer,    TreePath parentPath,    Object e1,    Object e2){
      if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
        final RepositoryNode node1=(RepositoryNode)e1;
        final RepositoryNode node2=(RepositoryNode)e2;
        if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
          return 1;
        }
        if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
          return -1;
        }
        if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
          return e1.toString().compareTo(e2.toString());
        }
 else         if (viewerSorter != null) {
          if (viewerSorter instanceof TreePathViewerSorter) {
            return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
          }
 else {
            return viewerSorter.compare(viewer,e1,e2);
          }
        }
      }
      return super.compare(viewer,parentPath,e1,e2);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void checkSorter(TreeViewer treeViewer){
  ViewerSorter sorter=null;
  if (getRepView() != null) {
    final StructuredViewer viewer=getRepView().getViewer();
    sorter=viewer.getSorter();
  }
  final ViewerSorter viewerSorter=sorter;
  treeViewer.setSorter(new TreePathViewerSorter(){
    @Override public int compare(    Viewer viewer,    TreePath parentPath,    Object e1,    Object e2){
      if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
        final RepositoryNode node1=(RepositoryNode)e1;
        final RepositoryNode node2=(RepositoryNode)e2;
        if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
          return 1;
        }
        if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
          return -1;
        }
        if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
          return e1.toString().compareTo(e2.toString());
        }
 else         if (viewerSorter != null) {
          if (viewerSorter instanceof TreePathViewerSorter) {
            if (!node1.isInitialized() && !node2.isInitialized()) {
              return viewerSorter.compare(viewer,e1,e2);
            }
            return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
          }
 else {
            return viewerSorter.compare(viewer,e1,e2);
          }
        }
      }
      return super.compare(viewer,parentPath,e1,e2);
    }
  }
);
}
Program: 127798
Project: 127798
Buggy source:
/** 
 * zshen Method "createConnection".
 * @param url the database url
 * @param driver Driver of database and can't be null
 * @param props properties passed to the driver manager for getting the connection (normally at least a "user" and"password" property should be included)
 * @return the connection,it is can be null when the driver is null
 * @throws SQLException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws ClassNotFoundException
 */
public static Connection createConnection(String url,Driver driver,Properties props) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
  Connection connection=null;
  if (driver != null) {
    try {
      DriverManager.registerDriver(driver);
      Class.forName(driver.getClass().getName());
      if (isMsSqlServer(url) || isSybase(url) || isHiveServer(url)) {
        connection=driver.connect(url,props);
      }
 else {
        connection=DriverManager.getConnection(url,props);
      }
    }
 catch (    ClassNotFoundException e) {
      try {
        connection=driver.connect(url,props);
      }
 catch (      Exception exception) {
        log.info(exception);
      }
    }
  }
  return connection;
}

Fixed version (ground truth):
/** 
 * zshen Method "createConnection".
 * @param url the database url
 * @param driver Driver of database and can't be null
 * @param props properties passed to the driver manager for getting the connection (normally at least a "user" and"password" property should be included)
 * @return the connection,it is can be null when the driver is null
 * @throws SQLException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws ClassNotFoundException
 */
public static Connection createConnection(String url,Driver driver,Properties props) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
  Connection connection=null;
  if (driver != null) {
    try {
      DriverManager.registerDriver(driver);
      Class.forName(driver.getClass().getName());
      if (isMsSqlServer(url) || isSybase(url) || isHiveServer(url)) {
        connection=driver.connect(url,props);
      }
 else {
        connection=DriverManager.getConnection(url,props);
      }
    }
 catch (    ClassNotFoundException e) {
      try {
        connection=driver.connect(url,props);
      }
 catch (      Exception exception) {
        log.info(exception);
      }
    }
  }
 else {
    if (isODBCServer(url)) {
      connection=DriverManager.getConnection(url,props);
    }
  }
  return connection;
}
Program: 127800
Project: 127800
Buggy source:
private Set<String> getLibrariesForPig(){
  Set<String> neededLibraries=new HashSet<String>();
  IComponentsService service=(IComponentsService)GlobalServiceRegister.getDefault().getService(IComponentsService.class);
  INode node=CoreRuntimePlugin.getInstance().getDesignerCoreService().getRefrenceNode("String_Node_Str");
  IElementParameter elementParameter=node.getElementParameter("String_Node_Str");
  if (elementParameter != null) {
    elementParameter.setValue(true);
  }
  elementParameter=node.getElementParameter("String_Node_Str");
  if (elementParameter != null) {
    elementParameter.setValue(distribution);
  }
  elementParameter=node.getElementParameter("String_Node_Str");
  if (elementParameter != null) {
    elementParameter.setValue(version);
  }
  List<ModuleNeeded> modulesNeeded=node.getModulesNeeded();
  for (  ModuleNeeded module : modulesNeeded) {
    if (module.isRequired(node.getElementParameters())) {
      neededLibraries.add(module.getModuleName());
    }
  }
  return neededLibraries;
}

Fixed version (ground truth):
private Set<String> getLibrariesForPig(ECustomVersionType type){
  Set<String> neededLibraries=new HashSet<String>();
  INode node=CoreRuntimePlugin.getInstance().getDesignerCoreService().getRefrenceNode("String_Node_Str");
  IElementParameter elementParameter=node.getElementParameter("String_Node_Str");
  if (elementParameter != null) {
    elementParameter.setValue(true);
  }
  elementParameter=node.getElementParameter("String_Node_Str");
  if (elementParameter != null) {
    elementParameter.setValue(distribution);
  }
  elementParameter=node.getElementParameter("String_Node_Str");
  if (elementParameter != null) {
    elementParameter.setValue(version);
  }
  elementParameter=node.getElementParameter("String_Node_Str");
  if (elementParameter != null) {
    if (ECustomVersionType.PIG_HBASE == type) {
      elementParameter.setValue("String_Node_Str");
    }
 else     if (ECustomVersionType.PIG_HCATALOG == type) {
      elementParameter.setValue("String_Node_Str");
    }
  }
  List<ModuleNeeded> modulesNeeded=node.getModulesNeeded();
  for (  ModuleNeeded module : modulesNeeded) {
    if (module.isRequired(node.getElementParameters())) {
      neededLibraries.add(module.getModuleName());
    }
  }
  return neededLibraries;
}
Program: 127801
Project: 127801
Buggy source:
@Override protected void configureShell(Shell newShell){
  super.configureShell(newShell);
  newShell.setText(Messages.getString("String_Node_Str"));
  newShell.setSize(500,450);
  setHelpAvailable(false);
}

Fixed version (ground truth):
@Override protected void configureShell(Shell newShell){
  super.configureShell(newShell);
  newShell.setText(Messages.getString("String_Node_Str"));
  newShell.setSize(580,450);
  setHelpAvailable(false);
}
Program: 127803
Project: 127803
Buggy source:
public static Object getValue(Connection connection,String value,IMetadataTable table){
  if (connection instanceof HL7Connection) {
    return getHL7Value((HL7Connection)connection,value);
  }
  if (connection instanceof FileConnection) {
    return getFileValue((FileConnection)connection,value);
  }
  if (connection instanceof XmlFileConnection) {
    return getXmlFileValue((XmlFileConnection)connection,value);
  }
  if (connection instanceof DatabaseConnection) {
    return getDatabaseValue((DatabaseConnection)connection,value);
  }
  if (connection instanceof FTPConnection) {
    return getFTPValue((FTPConnection)connection,value);
  }
  if (connection instanceof BRMSConnection) {
    return getBRMSValue((BRMSConnection)connection,value);
  }
  if (connection instanceof LDAPSchemaConnection) {
    return getLDAPValue((LDAPSchemaConnection)connection,value);
  }
  if (connection instanceof WSDLSchemaConnection) {
    return getWSDLValue((WSDLSchemaConnection)connection,value);
  }
  if (connection instanceof LdifFileConnection) {
    return getLdifFileValue((LdifFileConnection)connection,value);
  }
  if (connection instanceof FileExcelConnection) {
    return getExcelFileValue((FileExcelConnection)connection,value);
  }
  if (connection instanceof MDMConnection) {
    return getMDMValue((MDMConnection)connection,value,table);
  }
  if (connection instanceof SAPConnection) {
    return getSAPValue((SAPConnection)connection,value);
  }
  if (connection instanceof SalesforceSchemaConnection) {
    return getSalesforceSchemaValue((SalesforceSchemaConnection)connection,value);
  }
  if (connection instanceof EDIFACTConnection) {
    return getEDIFACTSchemaValue((EDIFACTConnection)connection,value);
  }
  for (  IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
    if (handler.canHandle(connection)) {
      return handler.getComponentValue(connection,value,table);
    }
  }
  return null;
}

Fixed version (ground truth):
public static Object getValue(Connection connection,String value,IMetadataTable table){
  return getValue(connection,value,table,null);
}
Program: 127804
Project: 127804
Buggy source:
/** 
 * DOC hwang Comment method "getComponentValue". get parameter value of the connection
 * @param connection - connection
 * @param value - parameter name
 */
public Object getComponentValue(Connection connection,String value,IMetadataTable table);

Fixed version (ground truth):
public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent);
Program: 127805
Project: 127805
Buggy source:
/** 
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
@Override protected void createFieldEditors(){
  DirectoryFieldEditor filePathTemp=new DirectoryFieldEditor(ITalendCorePrefConstants.FILE_PATH_TEMP,Messages.getString("String_Node_Str"),getFieldEditorParent());
  addField(filePathTemp);
  FileFieldEditor javaInterpreter=new FileFieldEditor(ITalendCorePrefConstants.JAVA_INTERPRETER,Messages.getString("String_Node_Str"),true,getFieldEditorParent()){
    @Override protected boolean checkState(){
      return super.checkState();
    }
  }
;
  addField(javaInterpreter);
  IntegerFieldEditor previewLimit=new IntegerFieldEditor(ITalendCorePrefConstants.PREVIEW_LIMIT,Messages.getString("String_Node_Str"),getFieldEditorParent(),9);
  previewLimit.setEmptyStringAllowed(false);
  previewLimit.setValidRange(1,999999999);
  addField(previewLimit);
  BooleanFieldEditor runInMultiThread=new BooleanFieldEditor(ITalendCorePrefConstants.RUN_IN_MULTI_THREAD,Messages.getString("String_Node_Str"),getFieldEditorParent());
  addField(runInMultiThread);
  DirectoryFieldEditor ireportPath=new DirectoryFieldEditor(ITalendCorePrefConstants.IREPORT_PATH,Messages.getString("String_Node_Str"),getFieldEditorParent());
  addField(ireportPath);
  BooleanFieldEditor alwaysWelcome=new BooleanFieldEditor(ITalendCorePrefConstants.ALWAYS_WELCOME,Messages.getString("String_Node_Str"),getFieldEditorParent());
  addField(alwaysWelcome);
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
@Override protected void createFieldEditors(){
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
    ICoreService service=(ICoreService)GlobalServiceRegister.getDefault().getService(ICoreService.class);
    service.createTalendCorePreference(this,getFieldEditorParent());
  }
}
Program: 127806
Project: 127806
Buggy source:
@Override protected void addField(FieldEditor editor){
  super.addField(editor);
  fields.add(editor);
}

Fixed version (ground truth):
@Override public void addField(FieldEditor editor){
  super.addField(editor);
  fields.add(editor);
}
Program: 127807
Project: 127807
Buggy source:
/** 
 * if the url include "odbc", return true, else return false
 * @param url
 * @return
 */
private static boolean isODBCServer(String url){
  return url.indexOf("String_Node_Str") > -1;
}

Fixed version (ground truth):
/** 
 * if the url include "odbc", return true, else return false
 * @param url
 * @return
 */
private static boolean isODBCServer(String url){
  return url.startsWith("String_Node_Str");
}
Program: 127809
Project: 127809
Buggy source:
protected void evaluateTextField(){
  if (readOnly) {
    return;
  }
  if (nameText == null || nameText.isDisposed()) {
    return;
  }
  if (nameText.getText().length() == 0) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (!Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),nameText.getText()) || nameText.getText().trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (isKeywords(nameText.getText()) || "String_Node_Str".equalsIgnoreCase(nameText.getText())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(nameText.getText())) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (property != null && nameStatus.getSeverity() == IStatus.OK) {
    property.setLabel(getPropertyLabel(StringUtils.trimToNull(nameText.getText())));
    property.setDisplayName(StringUtils.trimToNull(nameText.getText()));
    property.setModificationDate(new Date());
  }
  updatePageStatus();
}

Fixed version (ground truth):
protected void evaluateTextField(){
  if (readOnly) {
    return;
  }
  if (nameText == null || nameText.isDisposed()) {
    return;
  }
  if (nameText.getText().length() == 0) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (!Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),nameText.getText()) || nameText.getText().startsWith("String_Node_Str") || nameText.getText().trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (isKeywords(nameText.getText()) || "String_Node_Str".equalsIgnoreCase(nameText.getText())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(nameText.getText())) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (property != null && nameStatus.getSeverity() == IStatus.OK) {
    property.setLabel(getPropertyLabel(StringUtils.trimToNull(nameText.getText())));
    property.setDisplayName(StringUtils.trimToNull(nameText.getText()));
    property.setModificationDate(new Date());
  }
  updatePageStatus();
}
Program: 127813
Project: 127813
Buggy source:
public TreeItem getTreeItem(String absoluteXPath){
  TreeItem[] items=availableXmlTree.getTree().getItems();
  String path=absoluteXPath;
  TreeItem item=null;
  while (!path.isEmpty()) {
    for (    TreeItem curItem : items) {
      if (path.startsWith("String_Node_Str" + curItem.getText())) {
        item=curItem;
        path=path.replaceFirst("String_Node_Str" + curItem.getText(),"String_Node_Str");
        break;
      }
    }
    if (!path.isEmpty()) {
      items=item.getItems();
    }
  }
  return item;
}

Fixed version (ground truth):
public TreeItem getTreeItem(String absoluteXPath){
  TreeItem[] items=availableXmlTree.getTree().getItems();
  String path=absoluteXPath;
  TreeItem item=null;
  while (!path.isEmpty()) {
    boolean flag=false;
    for (    TreeItem curItem : items) {
      if (path.startsWith("String_Node_Str" + curItem.getText())) {
        flag=true;
        item=curItem;
        path=path.replaceFirst("String_Node_Str" + curItem.getText(),"String_Node_Str");
        break;
      }
    }
    if (!path.isEmpty()) {
      items=item.getItems();
    }
    if (!flag) {
      break;
    }
  }
  return item;
}
Program: 127814
Project: 127814
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public void setLabel(String newLabel){
  String oldLabel=label;
  label=newLabel;
  setLabel(newLabel);
  if (eNotificationRequired()) {
    eNotify(new ENotificationImpl(this,Notification.SET,ConnectionPackage.ABSTRACT_METADATA_OBJECT__LABEL,oldLabel,label));
  }
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public void setLabel(String newLabel){
  String oldLabel=label;
  label=newLabel;
  if (!StringUtils.isEmpty(newLabel)) {
    setName(newLabel);
  }
  if (eNotificationRequired()) {
    eNotify(new ENotificationImpl(this,Notification.SET,ConnectionPackage.ABSTRACT_METADATA_OBJECT__LABEL,oldLabel,label));
  }
}
Program: 127815
Project: 127815
Buggy source:
@Override public int compare(Viewer viewer,TreePath parentPath,Object e1,Object e2){
  if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
    final RepositoryNode node1=(RepositoryNode)e1;
    final RepositoryNode node2=(RepositoryNode)e2;
    if (node1.isBin()) {
      return 1;
    }
    if (node2.isBin()) {
      return -1;
    }
    if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
      return e1.toString().compareTo(e2.toString());
    }
 else     if (viewerSorter != null) {
      if (viewerSorter instanceof TreePathViewerSorter) {
        return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
      }
 else {
        return viewerSorter.compare(viewer,e1,e2);
      }
    }
  }
  return super.compare(viewer,parentPath,e1,e2);
}

Fixed version (ground truth):
@Override public int compare(Viewer viewer,TreePath parentPath,Object e1,Object e2){
  if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
    final RepositoryNode node1=(RepositoryNode)e1;
    final RepositoryNode node2=(RepositoryNode)e2;
    if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return 1;
    }
    if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return -1;
    }
    if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
      return e1.toString().compareTo(e2.toString());
    }
 else     if (viewerSorter != null) {
      if (viewerSorter instanceof TreePathViewerSorter) {
        return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
      }
 else {
        return viewerSorter.compare(viewer,e1,e2);
      }
    }
  }
  return super.compare(viewer,parentPath,e1,e2);
}
Program: 127816
Project: 127816
Buggy source:
@Override protected void checkSorter(TreeViewer treeViewer){
  ViewerSorter sorter=null;
  if (getRepView() != null) {
    final StructuredViewer viewer=getRepView().getViewer();
    sorter=viewer.getSorter();
  }
  final ViewerSorter viewerSorter=sorter;
  treeViewer.setSorter(new TreePathViewerSorter(){
    @Override public int compare(    Viewer viewer,    TreePath parentPath,    Object e1,    Object e2){
      if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
        final RepositoryNode node1=(RepositoryNode)e1;
        final RepositoryNode node2=(RepositoryNode)e2;
        if (node1.isBin()) {
          return 1;
        }
        if (node2.isBin()) {
          return -1;
        }
        if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
          return e1.toString().compareTo(e2.toString());
        }
 else         if (viewerSorter != null) {
          if (viewerSorter instanceof TreePathViewerSorter) {
            return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
          }
 else {
            return viewerSorter.compare(viewer,e1,e2);
          }
        }
      }
      return super.compare(viewer,parentPath,e1,e2);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void checkSorter(TreeViewer treeViewer){
  ViewerSorter sorter=null;
  if (getRepView() != null) {
    final StructuredViewer viewer=getRepView().getViewer();
    sorter=viewer.getSorter();
  }
  final ViewerSorter viewerSorter=sorter;
  treeViewer.setSorter(new TreePathViewerSorter(){
    @Override public int compare(    Viewer viewer,    TreePath parentPath,    Object e1,    Object e2){
      if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
        final RepositoryNode node1=(RepositoryNode)e1;
        final RepositoryNode node2=(RepositoryNode)e2;
        if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
          return 1;
        }
        if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
          return -1;
        }
        if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
          return e1.toString().compareTo(e2.toString());
        }
 else         if (viewerSorter != null) {
          if (viewerSorter instanceof TreePathViewerSorter) {
            return ((TreePathViewerSorter)viewerSorter).compare(viewer,parentPath,e1,e2);
          }
 else {
            return viewerSorter.compare(viewer,e1,e2);
          }
        }
      }
      return super.compare(viewer,parentPath,e1,e2);
    }
  }
);
}
Program: 127817
Project: 127817
Buggy source:
@Override public int compare(Viewer viewer,Object e1,Object e2){
  if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
    final RepositoryNode node1=(RepositoryNode)e1;
    final RepositoryNode node2=(RepositoryNode)e2;
    if (node1.isBin()) {
      return 1;
    }
    if (node2.isBin()) {
      return -1;
    }
    if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
      return e1.toString().compareTo(e2.toString());
    }
 else {
      return viewerSorter.compare(viewer,e1,e2);
    }
  }
  return super.compare(viewer,e1,e2);
}

Fixed version (ground truth):
@Override public int compare(Viewer viewer,Object e1,Object e2){
  if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
    final RepositoryNode node1=(RepositoryNode)e1;
    final RepositoryNode node2=(RepositoryNode)e2;
    if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return 1;
    }
    if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
      return -1;
    }
    if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
      return e1.toString().compareTo(e2.toString());
    }
 else {
      return viewerSorter.compare(viewer,e1,e2);
    }
  }
  return super.compare(viewer,e1,e2);
}
Program: 127818
Project: 127818
Buggy source:
protected void checkSorter(TreeViewer treeViewer){
  ViewerSorter sorter=null;
  if (getRepView() != null) {
    final StructuredViewer viewer=getRepView().getViewer();
    sorter=viewer.getSorter();
  }
  if (sorter == null) {
    sorter=new RepositoryNameSorter();
  }
  if (sorter != null) {
    final ViewerSorter viewerSorter=sorter;
    treeViewer.setSorter(new ViewerSorter(){
      @Override public int compare(      Viewer viewer,      Object e1,      Object e2){
        if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
          final RepositoryNode node1=(RepositoryNode)e1;
          final RepositoryNode node2=(RepositoryNode)e2;
          if (node1.isBin()) {
            return 1;
          }
          if (node2.isBin()) {
            return -1;
          }
          if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
            return e1.toString().compareTo(e2.toString());
          }
 else {
            return viewerSorter.compare(viewer,e1,e2);
          }
        }
        return super.compare(viewer,e1,e2);
      }
    }
);
  }
}

Fixed version (ground truth):
protected void checkSorter(TreeViewer treeViewer){
  ViewerSorter sorter=null;
  if (getRepView() != null) {
    final StructuredViewer viewer=getRepView().getViewer();
    sorter=viewer.getSorter();
  }
  if (sorter == null) {
    sorter=new RepositoryNameSorter();
  }
  if (sorter != null) {
    final ViewerSorter viewerSorter=sorter;
    treeViewer.setSorter(new ViewerSorter(){
      @Override public int compare(      Viewer viewer,      Object e1,      Object e2){
        if (e1 instanceof RepositoryNode && e2 instanceof RepositoryNode) {
          final RepositoryNode node1=(RepositoryNode)e1;
          final RepositoryNode node2=(RepositoryNode)e2;
          if (node1.isBin() || node1.getType().equals(ENodeType.REFERENCED_PROJECT)) {
            return 1;
          }
          if (node2.isBin() || node2.getType().equals(ENodeType.REFERENCED_PROJECT)) {
            return -1;
          }
          if (node1.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER || node2.getType() == IRepositoryNode.ENodeType.SIMPLE_FOLDER) {
            return e1.toString().compareTo(e2.toString());
          }
 else {
            return viewerSorter.compare(viewer,e1,e2);
          }
        }
        return super.compare(viewer,e1,e2);
      }
    }
);
  }
}
Program: 127819
Project: 127819
Buggy source:
private void createValidationRules(RepositoryNode recBinNode,RepositoryNode node,final IRepositoryViewObject repObj,org.talend.core.model.metadata.builder.connection.MetadataTable metadataTable,ERepositoryObjectType repositoryObjectType){
  IRepositoryViewObject vo=node.getObject();
  if (vo != null && vo.getProperty() != null) {
    String schema=vo.getProperty().getId();
    schema=schema + "String_Node_Str" + metadataTable.getLabel();
    List<IRepositoryViewObject> objs=getValidationRuleObjsFromSchema(schema);
    if (objs.size() > 0) {
      int num=objs.size();
      StringBuffer floderName=new StringBuffer();
      floderName.append(Messages.getString("String_Node_Str"));
      floderName.append("String_Node_Str");
      floderName.append(num);
      floderName.append("String_Node_Str");
      RepositoryNode validationRulesNode=new StableRepositoryNode(node,floderName.toString(),ECoreImage.FOLDER_CLOSE_ICON);
      validationRulesNode.setProperties(EProperties.CONTENT_TYPE,ERepositoryObjectType.METADATA_VALIDATIONS_RULES_FOLDER);
      node.getChildren().add(validationRulesNode);
      for (      IRepositoryViewObject obj : objs) {
        addNode(validationRulesNode,ERepositoryObjectType.METADATA_VALIDATION_RULES,recBinNode,obj);
      }
    }
  }
}

Fixed version (ground truth):
private void createValidationRules(RepositoryNode recBinNode,RepositoryNode node,final IRepositoryViewObject repObj,org.talend.core.model.metadata.builder.connection.MetadataTable metadataTable,ERepositoryObjectType repositoryObjectType){
  IRepositoryViewObject vo=node.getObject();
  if (vo instanceof MetadataTableRepositoryObject) {
    vo=((MetadataTableRepositoryObject)vo).getViewObject();
  }
  if (vo != null && vo.getProperty() != null) {
    String schema=vo.getProperty().getId();
    schema=schema + "String_Node_Str" + metadataTable.getLabel();
    List<IRepositoryViewObject> objs=getValidationRuleObjsFromSchema(schema);
    if (objs.size() > 0) {
      int num=objs.size();
      StringBuffer floderName=new StringBuffer();
      floderName.append(Messages.getString("String_Node_Str"));
      floderName.append("String_Node_Str");
      floderName.append(num);
      floderName.append("String_Node_Str");
      RepositoryNode validationRulesNode=new StableRepositoryNode(node,floderName.toString(),ECoreImage.FOLDER_CLOSE_ICON);
      validationRulesNode.setProperties(EProperties.CONTENT_TYPE,ERepositoryObjectType.METADATA_VALIDATIONS_RULES_FOLDER);
      node.getChildren().add(validationRulesNode);
      for (      IRepositoryViewObject obj : objs) {
        addNode(validationRulesNode,ERepositoryObjectType.METADATA_VALIDATION_RULES,recBinNode,obj);
      }
    }
  }
}