nus-yam/ex-repair huggingface dataset:
Program: 148417
Project: 148417
Buggy source:
public void doSearch(){
  DataClusterBrowserMainPage.this.resultsViewer.setInput(getResults(true));
  pageToolBar.getComposite().setVisible(true);
  pageToolBar.getComposite().layout(true);
  pageToolBar.getComposite().getParent().layout(true);
  readjustViewerHeight();
}

Fixed version (ground truth):
public void doSearch(){
  if (showTaskIdCB.getSelection()) {
    if (DataClusterBrowserMainPage.this.resultsViewer.getTable().getColumnCount() != 4) {
      final TableColumn column3=new TableColumn(DataClusterBrowserMainPage.this.resultsViewer.getTable(),SWT.LEFT,3);
      column3.setText("String_Node_Str");
      column3.setWidth(150);
    }
  }
 else {
    if (DataClusterBrowserMainPage.this.resultsViewer.getTable().getColumnCount() == 4) {
      DataClusterBrowserMainPage.this.resultsViewer.getTable().getColumn(3).dispose();
    }
  }
  DataClusterBrowserMainPage.this.resultsViewer.setInput(getResults(true));
  pageToolBar.getComposite().setVisible(true);
  pageToolBar.getComposite().layout(true);
  pageToolBar.getComposite().getParent().layout(true);
  readjustViewerHeight();
}
Program: 148418
Project: 148418
Buggy source:
public void menuAboutToShow(IMenuManager manager){
  manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new EditItemAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new PhysicalDeleteItemsAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new LogicalDeleteItemsAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new NewItemAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new SubmitItemsAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new CompareItemWithEachOtherAction(getSite().getShell(),getResultsViewer()));
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
  for (  IAvailableModel model : availablemodels) {
    model.menuAboutToShow(manager,DataClusterBrowserMainPage.this);
  }
}

Fixed version (ground truth):
public void menuAboutToShow(IMenuManager manager){
  manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new EditItemAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new EditTaskIdAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new PhysicalDeleteItemsAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new LogicalDeleteItemsAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new NewItemAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new SubmitItemsAction(DataClusterBrowserMainPage.this.getSite().getShell(),DataClusterBrowserMainPage.this.resultsViewer));
  manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS,new CompareItemWithEachOtherAction(getSite().getShell(),getResultsViewer()));
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
  for (  IAvailableModel model : availablemodels) {
    model.menuAboutToShow(manager,DataClusterBrowserMainPage.this);
  }
}
Program: 148419
Project: 148419
Buggy source:
public WSItem(com.amalto.workbench.webservices.WSDataClusterPK wsDataClusterPK,java.lang.String dataModelName,java.lang.String dataModelRevision,java.lang.String conceptName,java.lang.String[] ids,long insertionTime,java.lang.String content){
  this.wsDataClusterPK=wsDataClusterPK;
  this.dataModelName=dataModelName;
  this.dataModelRevision=dataModelRevision;
  this.conceptName=conceptName;
  this.ids=ids;
  this.insertionTime=insertionTime;
  this.content=content;
}

Fixed version (ground truth):
public WSItem(com.amalto.workbench.webservices.WSDataClusterPK wsDataClusterPK,java.lang.String dataModelName,java.lang.String dataModelRevision,java.lang.String conceptName,java.lang.String[] ids,long insertionTime,java.lang.String taskId,java.lang.String content){
  this.wsDataClusterPK=wsDataClusterPK;
  this.dataModelName=dataModelName;
  this.dataModelRevision=dataModelRevision;
  this.conceptName=conceptName;
  this.ids=ids;
  this.insertionTime=insertionTime;
  this.taskId=taskId;
  this.content=content;
}
Program: 148422
Project: 148422
Buggy source:
private void hookContextMenu(){
  menuMgr=new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      DataModelMainPage.this.fillContextMenu(manager,false);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
  getSite().registerContextMenu(menuMgr,viewer);
}

Fixed version (ground truth):
private void hookContextMenu(){
  menuMgr=new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      DataModelMainPage.this.fillContextMenu(manager,false);
    }
  }
);
  Menu menu=menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
}
Program: 148423
Project: 148423
Buggy source:
private void hookTypesContextMenu(){
  typesMenuMgr=new MenuManager();
  typesMenuMgr.setRemoveAllWhenShown(true);
  typesMenuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      DataModelMainPage.this.fillContextMenu(manager,true);
    }
  }
);
  Menu menu=typesMenuMgr.createContextMenu(typesViewer.getControl());
  typesViewer.getControl().setMenu(menu);
  getSite().registerContextMenu(typesMenuMgr,typesViewer);
}

Fixed version (ground truth):
private void hookTypesContextMenu(){
  typesMenuMgr=new MenuManager();
  typesMenuMgr.setRemoveAllWhenShown(true);
  typesMenuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      DataModelMainPage.this.fillContextMenu(manager,true);
    }
  }
);
  Menu menu=typesMenuMgr.createContextMenu(typesViewer.getControl());
  typesViewer.getControl().setMenu(menu);
}
Program: 148427
Project: 148427
Buggy source:
@Override public void doSave(IProgressMonitor monitor){
  super.doSave(monitor);
  try {
    if (getSelectedPage() instanceof DataModelMainPage) {
      DataModelMainPage mainPage=(DataModelMainPage)getSelectedPage();
      String xsd=mainPage.getXSDSchemaString();
      WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
      wsDataModel.setXsdSchema(xsd);
      IFile file=XSDEditorUtil.createFile(xobject);
      file.setContents(new ByteArrayInputStream(xsd.getBytes()),IFile.FORCE,null);
    }
    IDocument doc=getTextEditor().getTextViewer().getDocument();
    String xsd=doc.get();
    IEditorPart[] editors=findEditors(xsdInput);
    if (editors.length == 1 && editors[0] instanceof DataModelMainPage) {
      DataModelMainPage mainPage=(DataModelMainPage)editors[0];
      mainPage.save(xsd);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void doSave(IProgressMonitor monitor){
  super.doSave(monitor);
  try {
    if (getSelectedPage() instanceof DataModelMainPage) {
      DataModelMainPage mainPage=(DataModelMainPage)getSelectedPage();
      String xsd=mainPage.getXSDSchemaString();
      WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
      wsDataModel.setXsdSchema(xsd);
      IFile file=XSDEditorUtil.createFile(xobject);
      file.setCharset("String_Node_Str",null);
      file.setContents(new ByteArrayInputStream(xsd.getBytes("String_Node_Str")),IFile.FORCE,null);
    }
    IDocument doc=getTextEditor().getTextViewer().getDocument();
    String xsd=doc.get();
    IEditorPart[] editors=findEditors(xsdInput);
    if (editors.length == 1 && editors[0] instanceof DataModelMainPage) {
      DataModelMainPage mainPage=(DataModelMainPage)editors[0];
      mainPage.save(xsd);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 148430
Project: 148430
Buggy source:
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  try {
    deleteTreeObject(toDelList);
    return Status.OK_STATUS;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return Status.CANCEL_STATUS;
  }
}

Fixed version (ground truth):
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  try {
    deleteTreeObject(toDelList);
    return Status.OK_STATUS;
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    return Status.CANCEL_STATUS;
  }
}
Program: 148432
Project: 148432
Buggy source:
public void run(){
  try {
    super.run();
    boolean confirm=MessageDialog.openConfirm(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
    if (!confirm)     return;
    boolean zap=MessageDialog.openQuestion(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
    if (zap)     zap=MessageDialog.openConfirm(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
    FileDialog fd=new FileDialog(view.getSite().getShell(),SWT.OPEN);
    fd.setText("String_Node_Str");
    String filename=fd.open();
    if (filename == null)     return;
    BufferedReader in=null;
    in=new BufferedReader(new InputStreamReader(new FileInputStream(filename),"String_Node_Str"));
    String xml="String_Node_Str";
    String line;
    while ((line=in.readLine()) != null)     xml+=line + "String_Node_Str";
    ISelection selection=view.getViewer().getSelection();
    TreeObject xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    XtentisPort port=Util.getPort(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
    port.initMDM(new WSInitData(zap,xml));
    xobject.getServerRoot().fireEvent(IXObjectModelListener.NEED_REFRESH,null,xobject.getServerRoot());
    MessageDialog.openInformation(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void run(){
  try {
    super.run();
    boolean confirm=MessageDialog.openConfirm(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
    if (!confirm)     return;
    boolean zap=MessageDialog.openQuestion(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
    if (zap)     zap=MessageDialog.openConfirm(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
    FileDialog fd=new FileDialog(view.getSite().getShell(),SWT.OPEN);
    fd.setText("String_Node_Str");
    String filename=fd.open();
    if (filename == null)     return;
    BufferedReader in=null;
    in=new BufferedReader(new InputStreamReader(new FileInputStream(filename),"String_Node_Str"));
    String xml="String_Node_Str";
    String line;
    while ((line=in.readLine()) != null)     xml+=line + "String_Node_Str";
    ISelection selection=view.getViewer().getSelection();
    TreeObject xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    XtentisPort port=Util.getPort(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
    port.initMDM(new WSInitData(zap,xml));
    xobject.getServerRoot().fireEvent(IXObjectModelListener.NEED_REFRESH,null,xobject.getServerRoot());
    MessageDialog.openInformation(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 148437
Project: 148437
Buggy source:
public static List<IAvailableModel> getAvailableModels(){
  try {
    IExtensionRegistry registry=Platform.getExtensionRegistry();
    IConfigurationElement[] configurationElements=registry.getConfigurationElementsFor("String_Node_Str");
    List<IAvailableModel> models=new ArrayList<IAvailableModel>();
    for (int i=0; i < configurationElements.length; i++) {
      IConfigurationElement element=configurationElements[i];
      IAvailableModel modelcalss=(IAvailableModel)element.createExecutableExtension("String_Node_Str");
      models.add(modelcalss);
    }
    return models;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return new ArrayList<IAvailableModel>();
}

Fixed version (ground truth):
public static List<IAvailableModel> getAvailableModels(){
  try {
    IExtensionRegistry registry=Platform.getExtensionRegistry();
    IConfigurationElement[] configurationElements=registry.getConfigurationElementsFor("String_Node_Str");
    List<IAvailableModel> models=new ArrayList<IAvailableModel>();
    for (int i=0; i < configurationElements.length; i++) {
      IConfigurationElement element=configurationElements[i];
      IAvailableModel modelcalss=(IAvailableModel)element.createExecutableExtension("String_Node_Str");
      models.add(modelcalss);
    }
    return models;
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
  return new ArrayList<IAvailableModel>();
}
Program: 148438
Project: 148438
Buggy source:
public IProject createProject(String label){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  IProject prj=root.getProject(label);
  if (prj.exists())   return prj;
  final IWorkspace workspace=ResourcesPlugin.getWorkspace();
  final IProjectDescription desc=workspace.newProjectDescription(label);
  desc.setNatureIds(new String[]{MdmNature.ID});
  desc.setComment("String_Node_Str");
  try {
    prj.create(desc,null);
    prj.open(IResource.BACKGROUND_REFRESH,null);
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
  return prj;
}

Fixed version (ground truth):
public IProject createProject(String label){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  IProject prj=root.getProject(label);
  if (prj.exists())   return prj;
  final IWorkspace workspace=ResourcesPlugin.getWorkspace();
  final IProjectDescription desc=workspace.newProjectDescription(label);
  desc.setNatureIds(new String[]{MdmNature.ID});
  desc.setComment("String_Node_Str");
  try {
    prj.create(desc,null);
    prj.open(IResource.BACKGROUND_REFRESH,null);
  }
 catch (  CoreException e) {
    log.error(e.getMessage(),e);
  }
  return prj;
}
Program: 148439
Project: 148439
Buggy source:
private void initComboSelectorContents(){
  if (entityWrapper != null) {
    try {
      comboSelector.setItems(Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()).toArray(new String[0]));
    }
 catch (    Exception e) {
      e.printStackTrace();
      comboSelector.setItems(new String[0]);
    }
  }
}

Fixed version (ground truth):
private void initComboSelectorContents(){
  if (entityWrapper != null) {
    try {
      comboSelector.setItems(Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()).toArray(new String[0]));
    }
 catch (    Exception e) {
      log.error(e.getMessage(),e);
      comboSelector.setItems(new String[0]);
    }
  }
}
Program: 148440
Project: 148440
Buggy source:
private void initUIContentForCompFacet(XSDSimpleTypeDefinition baseTypeDef){
  if (baseTypeDef == null) {
    compProperty.setPropertySources(new IPropertySource<?>[0]);
    return;
  }
  List<IPropertySource<?>> propertySources=new ArrayList<IPropertySource<?>>();
  for (  String eachFacetName : baseTypeDef.getValidFacets()) {
    IPropertySource<?> propSource=SimpleTypeFacetPropSourceBuilder.createFacetPropSource(xsdSimpleType,eachFacetName,compProperty.getPropertyViewer().getTree());
    if (propSource == null)     continue;
    propertySources.add(propSource);
  }
  compProperty.setPropertySources(propertySources.toArray(new IPropertySource<?>[0]));
}

Fixed version (ground truth):
private void initUIContentForCompFacet(XSDSimpleTypeDefinition baseTypeDef){
  if (baseTypeDef == null) {
    compProperty.setPropertySources(new IPropertySource<?>[0]);
    return;
  }
  List<IPropertySource<?>> propertySources=new ArrayList<IPropertySource<?>>();
  for (  String eachFacetName : baseTypeDef.getValidFacets()) {
    IPropertySource<?> propSource=SimpleTypeFacetPropSourceBuilder.createFacetPropSource(xsdSimpleType,baseTypeDef,eachFacetName,compProperty.getPropertyViewer().getTree());
    if (propSource == null)     continue;
    propertySources.add(propSource);
  }
  compProperty.setPropertySources(propertySources.toArray(new IPropertySource<?>[0]));
}
Program: 148441
Project: 148441
Buggy source:
@Override protected SimpleTypeFacetCommitHandlerHelper getCommitHelper(){
  if (Util.isDouble(getCommitedObj().getXSDSimpleType()) || Util.isFloat(getCommitedObj().getXSDSimpleType()) || Util.isDecimal(getCommitedObj().getXSDSimpleType()))   return SimpleTypeFacetCommitHandlerHelper.createHelperForDoubleFacet(this);
  return SimpleTypeFacetCommitHandlerHelper.createHelperForIntFacet(this);
}

Fixed version (ground truth):
@Override protected SimpleTypeFacetCommitHandlerHelper getCommitHelper(){
  if (Util.isDouble(getCommitedObj().getNewBaseType()) || Util.isFloat(getCommitedObj().getNewBaseType()) || Util.isDecimal(getCommitedObj().getNewBaseType()))   return SimpleTypeFacetCommitHandlerHelper.createHelperForDoubleFacet(this);
  return SimpleTypeFacetCommitHandlerHelper.createHelperForIntFacet(this);
}
Program: 148442
Project: 148442
Buggy source:
protected abstract IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue);

Fixed version (ground truth):
protected abstract IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition targetSimpleType,Composite cellEditorParent,Object sourceFacetValue);
Program: 148443
Project: 148443
Buggy source:
public static IPropertySource<?> createFacetPropSource(XSDSimpleTypeDefinition simpleType,String facetPropName,Composite cellEditorParent){
  SimpleTypeFacetPropSourceBuilder builder=getPropSourceBuilder(facetPropName);
  if (builder == null)   return null;
  return builder.doCreatePropSource(simpleType,cellEditorParent,builder.getSourceFacetValue(simpleType));
}

Fixed version (ground truth):
public static IPropertySource<?> createFacetPropSource(XSDSimpleTypeDefinition oldSimpleType,XSDSimpleTypeDefinition targetSimpleType,String facetPropName,Composite cellEditorParent){
  SimpleTypeFacetPropSourceBuilder builder=getPropSourceBuilder(facetPropName);
  if (builder == null)   return null;
  return builder.doCreatePropSource(targetSimpleType,cellEditorParent,builder.getSourceFacetValue(oldSimpleType));
}
Program: 148444
Project: 148444
Buggy source:
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXEXCLUSIVE,(Double)sourceFacetValue);
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXEXCLUSIVE,(Integer)sourceFacetValue);
}

Fixed version (ground truth):
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXEXCLUSIVE,toDoubleQuietly(sourceFacetValue));
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXEXCLUSIVE,toIntegerQuielty(sourceFacetValue));
}
Program: 148445
Project: 148445
Buggy source:
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXINCLUSIVE,(Double)sourceFacetValue);
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXINCLUSIVE,(Integer)sourceFacetValue);
}

Fixed version (ground truth):
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXINCLUSIVE,toDoubleQuietly(sourceFacetValue));
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MAXINCLUSIVE,toIntegerQuielty(sourceFacetValue));
}
Program: 148446
Project: 148446
Buggy source:
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MINEXCLUSIVE,(Double)sourceFacetValue);
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MINEXCLUSIVE,(Integer)sourceFacetValue);
}

Fixed version (ground truth):
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MINEXCLUSIVE,toDoubleQuietly(sourceFacetValue));
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MINEXCLUSIVE,toIntegerQuielty(sourceFacetValue));
}
Program: 148447
Project: 148447
Buggy source:
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MININCLUSIVE,(Double)sourceFacetValue);
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MININCLUSIVE,(Integer)sourceFacetValue);
}

Fixed version (ground truth):
@Override protected IPropertySource<?> doCreatePropSource(XSDSimpleTypeDefinition simpleType,Composite cellEditorParent,Object sourceFacetValue){
  if (Util.isDouble(simpleType) || Util.isDecimal(simpleType) || Util.isFloat(simpleType)) {
    return new SimpleTypeFacetDoublePropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MININCLUSIVE,toDoubleQuietly(sourceFacetValue));
  }
  return new SimpleTypeFacetIntegerPropertySource(cellEditorParent,IConstants.SIMPLETYPE_FACETNAME_MININCLUSIVE,toIntegerQuielty(sourceFacetValue));
}
Program: 148448
Project: 148448
Buggy source:
public static boolean isDecimal(XSDSimpleTypeDefinition simpleType){
  return isSpecifiedBuildInType(simpleType,"String_Node_Str");
}

Fixed version (ground truth):
public static boolean isDecimal(XSDSimpleTypeDefinition simpleType){
  if (isSpecifiedBuildInType(simpleType,"String_Node_Str"))   return false;
  return isSpecifiedBuildInType(simpleType,"String_Node_Str");
}
Program: 148449
Project: 148449
Buggy source:
public static boolean isSpecifiedBuildInType(XSDSimpleTypeDefinition simpleType,String buildInTypeName){
  if (simpleType == null || simpleType.getSchema() == null)   return false;
  XSDSimpleTypeDefinition systemDoubleType=simpleType.getSchema().resolveSimpleTypeDefinition(simpleType.getSchema().getSchemaForSchemaNamespace(),buildInTypeName);
  if (systemDoubleType == null)   return false;
  return systemDoubleType.equals(simpleType.getBaseType());
}

Fixed version (ground truth):
public static boolean isSpecifiedBuildInType(XSDSimpleTypeDefinition simpleType,String buildInTypeName){
  if (simpleType == null || simpleType.getSchema() == null)   return false;
  XSDSimpleTypeDefinition systemDoubleType=simpleType.getSchema().resolveSimpleTypeDefinition(simpleType.getSchema().getSchemaForSchemaNamespace(),buildInTypeName);
  if (systemDoubleType == null)   return false;
  return simpleType.equals(systemDoubleType) || systemDoubleType.equals(simpleType.getBaseType());
}
Program: 148450
Project: 148450
Buggy source:
private static ArrayList internalGetResources(ISelection selection,Class type){
  ArrayList tmp=new ArrayList();
  if (selection instanceof IStructuredSelection) {
    Object[] s=((IStructuredSelection)selection).toArray();
    for (int i=0; i < s.length; i++) {
      IResource resource=null;
      Object o=s[i];
      if (type.isInstance(o)) {
        resource=(IResource)o;
      }
 else       if (o instanceof ResourceMapping) {
        try {
          ResourceTraversal[] travs=((ResourceMapping)o).getTraversals(ResourceMappingContext.LOCAL_CONTEXT,null);
          if (travs != null) {
            for (int k=0; k < travs.length; k++) {
              IResource[] resources=travs[k].getResources();
              for (int j=0; j < resources.length; j++) {
                if (type.isInstance(resources[j]) && resources[j].isAccessible())                 tmp.add(resources[j]);
              }
            }
          }
        }
 catch (        CoreException ex) {
          ex.printStackTrace();
        }
      }
 else       if (o instanceof IAdaptable) {
        IAdaptable a=(IAdaptable)o;
        Object adapter=a.getAdapter(IResource.class);
        if (type.isInstance(adapter))         resource=(IResource)adapter;
      }
      if (resource != null && resource.isAccessible())       tmp.add(resource);
    }
  }
  return tmp;
}

Fixed version (ground truth):
private static ArrayList internalGetResources(ISelection selection,Class type){
  ArrayList tmp=new ArrayList();
  if (selection instanceof IStructuredSelection) {
    Object[] s=((IStructuredSelection)selection).toArray();
    for (int i=0; i < s.length; i++) {
      IResource resource=null;
      Object o=s[i];
      if (type.isInstance(o)) {
        resource=(IResource)o;
      }
 else       if (o instanceof ResourceMapping) {
        try {
          ResourceTraversal[] travs=((ResourceMapping)o).getTraversals(ResourceMappingContext.LOCAL_CONTEXT,null);
          if (travs != null) {
            for (int k=0; k < travs.length; k++) {
              IResource[] resources=travs[k].getResources();
              for (int j=0; j < resources.length; j++) {
                if (type.isInstance(resources[j]) && resources[j].isAccessible())                 tmp.add(resources[j]);
              }
            }
          }
        }
 catch (        CoreException ex) {
          log.error(ex.getMessage(),ex);
        }
      }
 else       if (o instanceof IAdaptable) {
        IAdaptable a=(IAdaptable)o;
        Object adapter=a.getAdapter(IResource.class);
        if (type.isInstance(adapter))         resource=(IResource)adapter;
      }
      if (resource != null && resource.isAccessible())       tmp.add(resource);
    }
  }
  return tmp;
}
Program: 148451
Project: 148451
Buggy source:
private void initListener2BtnEditField(){
  lBtnEditFieldListener=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      FieldWrapper[] selectedFields=getSelectedFields();
      if (selectedFields.length == 0)       return;
      try {
        SelectFieldDialog selectFieldDlg=new SelectFieldDialog(getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),selectedFields[0].getXPath());
        if (selectFieldDlg.open() != Window.OK)         return;
        selectedFields[0].setXPath(selectFieldDlg.getField().trim());
        tvFields.refresh();
      }
 catch (      Exception exp) {
        exp.printStackTrace();
      }
    }
  }
;
}

Fixed version (ground truth):
private void initListener2BtnEditField(){
  lBtnEditFieldListener=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      FieldWrapper[] selectedFields=getSelectedFields();
      if (selectedFields.length == 0)       return;
      try {
        SelectFieldDialog selectFieldDlg=new SelectFieldDialog(getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),selectedFields[0].getXPath());
        if (selectFieldDlg.open() != Window.OK)         return;
        selectedFields[0].setXPath(selectFieldDlg.getField().trim());
        tvFields.refresh();
      }
 catch (      Exception exp) {
        log.error(exp.getMessage(),exp);
      }
    }
  }
;
}
Program: 148452
Project: 148452
Buggy source:
private void initListener2BtnAddKey(){
  lBtnAddKeyListener=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      try {
        IdentityConstraintInputDialog dialog=new IdentityConstraintInputDialog(entityWrapper.getSourceEntity(),getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),entityWrapper.getSourceEntityName());
        dialog.setInputValidator(new NewKeyWrapperValidator(entityWrapper));
        if (dialog.open() != Window.OK)         return;
        KeyWrapper newKeyWrapper=new KeyWrapper(dialog.getKeyName(),"String_Node_Str",dialog.getType(),new FieldWrapper[]{new FieldWrapper(dialog.getFieldName())});
        entityWrapper.addKey(newKeyWrapper);
        tvKeys.setInput(Arrays.asList(entityWrapper.getKeys()));
        tvKeys.setSelection(new StructuredSelection(newKeyWrapper));
      }
 catch (      Exception exp) {
        exp.printStackTrace();
      }
    }
  }
;
}

Fixed version (ground truth):
private void initListener2BtnAddKey(){
  lBtnAddKeyListener=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      try {
        IdentityConstraintInputDialog dialog=new IdentityConstraintInputDialog(entityWrapper.getSourceEntity(),getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),entityWrapper.getSourceEntityName());
        dialog.setInputValidator(new NewKeyWrapperValidator(entityWrapper));
        if (dialog.open() != Window.OK)         return;
        KeyWrapper newKeyWrapper=new KeyWrapper(dialog.getKeyName(),"String_Node_Str",dialog.getType(),new FieldWrapper[]{new FieldWrapper(dialog.getFieldName())});
        entityWrapper.addKey(newKeyWrapper);
        tvKeys.setInput(Arrays.asList(entityWrapper.getKeys()));
        tvKeys.setSelection(new StructuredSelection(newKeyWrapper));
      }
 catch (      Exception exp) {
        log.error(exp.getMessage(),exp);
      }
    }
  }
;
}
Program: 148453
Project: 148453
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  try {
    IdentityConstraintInputDialog dialog=new IdentityConstraintInputDialog(entityWrapper.getSourceEntity(),getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),entityWrapper.getSourceEntityName());
    dialog.setInputValidator(new NewKeyWrapperValidator(entityWrapper));
    if (dialog.open() != Window.OK)     return;
    KeyWrapper newKeyWrapper=new KeyWrapper(dialog.getKeyName(),"String_Node_Str",dialog.getType(),new FieldWrapper[]{new FieldWrapper(dialog.getFieldName())});
    entityWrapper.addKey(newKeyWrapper);
    tvKeys.setInput(Arrays.asList(entityWrapper.getKeys()));
    tvKeys.setSelection(new StructuredSelection(newKeyWrapper));
  }
 catch (  Exception exp) {
    exp.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  try {
    IdentityConstraintInputDialog dialog=new IdentityConstraintInputDialog(entityWrapper.getSourceEntity(),getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),entityWrapper.getSourceEntityName());
    dialog.setInputValidator(new NewKeyWrapperValidator(entityWrapper));
    if (dialog.open() != Window.OK)     return;
    KeyWrapper newKeyWrapper=new KeyWrapper(dialog.getKeyName(),"String_Node_Str",dialog.getType(),new FieldWrapper[]{new FieldWrapper(dialog.getFieldName())});
    entityWrapper.addKey(newKeyWrapper);
    tvKeys.setInput(Arrays.asList(entityWrapper.getKeys()));
    tvKeys.setSelection(new StructuredSelection(newKeyWrapper));
  }
 catch (  Exception exp) {
    log.error(exp.getMessage(),exp);
  }
}
Program: 148454
Project: 148454
Buggy source:
private void initListener2BtnAddField(){
  lBtnAddFieldListener=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      try {
        KeyWrapper[] selectedKeys=getSelectedKeys();
        if (selectedKeys.length == 0)         return;
        SelectFieldDialog selectFieldDlg=new SelectFieldDialog(getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),null);
        if (selectFieldDlg.open() != Window.OK)         return;
        if ("String_Node_Str".equals(selectFieldDlg.getField().trim()))         return;
        FieldWrapper newFieldWrapper=new FieldWrapper(selectFieldDlg.getField().trim());
        selectedKeys[0].addField(newFieldWrapper);
        tvFields.setInput(Arrays.asList(selectedKeys[0].getFields()));
        tvFields.setSelection(new StructuredSelection(newFieldWrapper));
      }
 catch (      Exception exp) {
        exp.printStackTrace();
      }
    }
  }
;
}

Fixed version (ground truth):
private void initListener2BtnAddField(){
  lBtnAddFieldListener=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      try {
        KeyWrapper[] selectedKeys=getSelectedKeys();
        if (selectedKeys.length == 0)         return;
        SelectFieldDialog selectFieldDlg=new SelectFieldDialog(getShell(),"String_Node_Str",Util.getChildElementNames("String_Node_Str",entityWrapper.getSourceEntity()),null);
        if (selectFieldDlg.open() != Window.OK)         return;
        if ("String_Node_Str".equals(selectFieldDlg.getField().trim()))         return;
        FieldWrapper newFieldWrapper=new FieldWrapper(selectFieldDlg.getField().trim());
        selectedKeys[0].addField(newFieldWrapper);
        tvFields.setInput(Arrays.asList(selectedKeys[0].getFields()));
        tvFields.setSelection(new StructuredSelection(newFieldWrapper));
      }
 catch (      Exception exp) {
        log.error(exp.getMessage(),exp);
      }
    }
  }
;
}
Program: 148455
Project: 148455
Buggy source:
private List<String> getConceptElements(){
  DataModelMainPage page=(DataModelMainPage)parentPage;
  IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
  List<String> childNames=new ArrayList<String>();
  XSDElementDeclaration decl=null;
  if (selection.getFirstElement() instanceof XSDElementDeclaration) {
    decl=(XSDElementDeclaration)selection.getFirstElement();
  }
 else   if (selection.getFirstElement() instanceof Element) {
    TreePath tPath=((TreeSelection)selection).getPaths()[0];
    XSDComponent xSDCom=null;
    for (int i=0; i < tPath.getSegmentCount(); i++) {
      if (tPath.getSegment(i) instanceof XSDAnnotation) {
        xSDCom=(XSDAnnotation)(tPath.getSegment(i));
        break;
      }
    }
    decl=(XSDElementDeclaration)xSDCom.getContainer();
  }
  try {
    childNames=Util.getChildElementNames(decl.getName(),decl);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return childNames;
}

Fixed version (ground truth):
private List<String> getConceptElements(){
  DataModelMainPage page=(DataModelMainPage)parentPage;
  IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
  List<String> childNames=new ArrayList<String>();
  XSDElementDeclaration decl=null;
  if (selection.getFirstElement() instanceof XSDElementDeclaration) {
    decl=(XSDElementDeclaration)selection.getFirstElement();
  }
 else   if (selection.getFirstElement() instanceof Element) {
    TreePath tPath=((TreeSelection)selection).getPaths()[0];
    XSDComponent xSDCom=null;
    for (int i=0; i < tPath.getSegmentCount(); i++) {
      if (tPath.getSegment(i) instanceof XSDAnnotation) {
        xSDCom=(XSDAnnotation)(tPath.getSegment(i));
        break;
      }
    }
    decl=(XSDElementDeclaration)xSDCom.getContainer();
  }
  try {
    childNames=Util.getChildElementNames(decl.getName(),decl);
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
  return childNames;
}
Program: 148456
Project: 148456
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (tabFolder.getSelectionIndex() == 0) {
    if (node == null) {
      try {
        if (sourceViewer == null || sourceViewer.getDocument() == null)         return;
        node=Util.parse(sourceViewer.getDocument().get());
      }
 catch (      Exception ex) {
        ex.printStackTrace();
        tabFolder.setSelection(1);
        MessageDialog.openError(DOMViewDialog.this.getShell(),"String_Node_Str","String_Node_Str" + ex.getLocalizedMessage());
        return;
      }
      domViewer.setInput(node);
      domViewer.expandAll();
    }
  }
 else   if (tabFolder.getSelectionIndex() == 1) {
    try {
      sourceViewer.setDocument(new org.eclipse.jface.text.Document(Util.nodeToString(node)));
      node=null;
    }
 catch (    Exception ex) {
      MessageDialog.openError(DOMViewDialog.this.getShell(),"String_Node_Str","String_Node_Str" + ex.getLocalizedMessage());
      sourceViewer.setDocument(new org.eclipse.jface.text.Document("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  if (tabFolder.getSelectionIndex() == 0) {
    if (node == null) {
      try {
        if (sourceViewer == null || sourceViewer.getDocument() == null)         return;
        node=Util.parse(sourceViewer.getDocument().get());
      }
 catch (      Exception ex) {
        log.error(ex.getMessage(),ex);
        tabFolder.setSelection(1);
        MessageDialog.openError(DOMViewDialog.this.getShell(),"String_Node_Str","String_Node_Str" + ex.getLocalizedMessage());
        return;
      }
      domViewer.setInput(node);
      domViewer.expandAll();
    }
  }
 else   if (tabFolder.getSelectionIndex() == 1) {
    try {
      sourceViewer.setDocument(new org.eclipse.jface.text.Document(Util.nodeToString(node)));
      node=null;
    }
 catch (    Exception ex) {
      MessageDialog.openError(DOMViewDialog.this.getShell(),"String_Node_Str","String_Node_Str" + ex.getLocalizedMessage());
      sourceViewer.setDocument(new org.eclipse.jface.text.Document("String_Node_Str"));
    }
  }
}
Program: 148458
Project: 148458
Buggy source:
public int compare(Object arg0,Object arg1){
  JSONObject jsonA=(JSONObject)arg0;
  JSONObject jsonB=(JSONObject)arg1;
  String valueA=null, valueB=null;
  try {
    if (currentColumn == column1) {
      valueA=jsonA.get(COLUMN_EXTENSION_NAME).toString();
      valueB=jsonB.get(COLUMN_EXTENSION_NAME).toString();
    }
 else     if (currentColumn == column2) {
      valueA=jsonA.get(COLUMN_REVISION_NAME).toString();
      valueB=jsonB.get(COLUMN_REVISION_NAME).toString();
    }
 else {
      valueA=jsonA.get(COLUMN_URL_NAME).toString();
      valueB=jsonB.get(COLUMN_URL_NAME).toString();
    }
    if (valueA.equals(valueB))     return 0;
    if (direction == SWT.UP) {
      return valueA.compareTo(valueB) < 0 ? -1 : 1;
    }
    return valueA.compareTo(valueB) < 0 ? 1 : -1;
  }
 catch (  JSONException je) {
    je.printStackTrace();
    return -1;
  }
}

Fixed version (ground truth):
public int compare(Object arg0,Object arg1){
  JSONObject jsonA=(JSONObject)arg0;
  JSONObject jsonB=(JSONObject)arg1;
  String valueA=null, valueB=null;
  try {
    if (currentColumn == column1) {
      valueA=jsonA.get(COLUMN_EXTENSION_NAME).toString();
      valueB=jsonB.get(COLUMN_EXTENSION_NAME).toString();
    }
 else     if (currentColumn == column2) {
      valueA=jsonA.get(COLUMN_REVISION_NAME).toString();
      valueB=jsonB.get(COLUMN_REVISION_NAME).toString();
    }
 else {
      valueA=jsonA.get(COLUMN_URL_NAME).toString();
      valueB=jsonB.get(COLUMN_URL_NAME).toString();
    }
    if (valueA.equals(valueB))     return 0;
    if (direction == SWT.UP) {
      return valueA.compareTo(valueB) < 0 ? -1 : 1;
    }
    return valueA.compareTo(valueB) < 0 ? 1 : -1;
  }
 catch (  JSONException je) {
    log.error(je.getMessage(),je);
    return -1;
  }
}
Program: 148459
Project: 148459
Buggy source:
private void fillInTable(){
  exchangeDwnTable.removeAll();
  HttpClient client=new HttpClient();
  String url=EXCHANGE_DOWNLOAD_URL + (export ? "String_Node_Str" : "String_Node_Str");
  GetMethod get=new GetMethod(url);
  try {
    client.executeMethod(get);
    String out=get.getResponseBodyAsString();
    JSONArray jsonArray=new JSONArray(out);
    dataContent=new JSONObject[jsonArray.length()];
    for (int i=0; i < jsonArray.length(); i++) {
      JSONObject jsonObject=jsonArray.getJSONObject(i);
      String name=jsonObject.get(COLUMN_EXTENSION_NAME).toString();
      String revision=jsonObject.getString(COLUMN_REVISION_NAME);
      String download_url=jsonObject.getString(COLUMN_URL_NAME).toString();
      TableItem item=new TableItem(exchangeDwnTable,SWT.NONE);
      item.setText(new String[]{name,revision,download_url});
      dataContent[i]=jsonObject;
    }
    exchangeDwnTable.setItemCount(dataContent.length);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void fillInTable(){
  exchangeDwnTable.removeAll();
  HttpClient client=new HttpClient();
  String url=EXCHANGE_DOWNLOAD_URL + (export ? "String_Node_Str" : "String_Node_Str");
  GetMethod get=new GetMethod(url);
  try {
    client.executeMethod(get);
    String out=get.getResponseBodyAsString();
    JSONArray jsonArray=new JSONArray(out);
    dataContent=new JSONObject[jsonArray.length()];
    for (int i=0; i < jsonArray.length(); i++) {
      JSONObject jsonObject=jsonArray.getJSONObject(i);
      String name=jsonObject.get(COLUMN_EXTENSION_NAME).toString();
      String revision=jsonObject.getString(COLUMN_REVISION_NAME);
      String download_url=jsonObject.getString(COLUMN_URL_NAME).toString();
      TableItem item=new TableItem(exchangeDwnTable,SWT.NONE);
      item.setText(new String[]{name,revision,download_url});
      dataContent[i]=jsonObject;
    }
    exchangeDwnTable.setItemCount(dataContent.length);
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
}
Program: 148460
Project: 148460
Buggy source:
@SuppressWarnings("String_Node_Str") public void handleEvent(Event e){
  TableColumn sortColumn=exchangeDwnTable.getSortColumn();
  final TableColumn currentColumn=(TableColumn)e.widget;
  int dir=exchangeDwnTable.getSortDirection();
  if (sortColumn == currentColumn) {
    dir=dir == SWT.UP ? SWT.DOWN : SWT.UP;
  }
 else {
    exchangeDwnTable.setSortColumn(currentColumn);
    dir=SWT.UP;
  }
  final int direction=dir;
  Arrays.sort(dataContent,new Comparator(){
    public int compare(    Object arg0,    Object arg1){
      JSONObject jsonA=(JSONObject)arg0;
      JSONObject jsonB=(JSONObject)arg1;
      String valueA=null, valueB=null;
      try {
        if (currentColumn == column1) {
          valueA=jsonA.get(COLUMN_EXTENSION_NAME).toString();
          valueB=jsonB.get(COLUMN_EXTENSION_NAME).toString();
        }
 else         if (currentColumn == column2) {
          valueA=jsonA.get(COLUMN_REVISION_NAME).toString();
          valueB=jsonB.get(COLUMN_REVISION_NAME).toString();
        }
 else {
          valueA=jsonA.get(COLUMN_URL_NAME).toString();
          valueB=jsonB.get(COLUMN_URL_NAME).toString();
        }
        if (valueA.equals(valueB))         return 0;
        if (direction == SWT.UP) {
          return valueA.compareTo(valueB) < 0 ? -1 : 1;
        }
        return valueA.compareTo(valueB) < 0 ? 1 : -1;
      }
 catch (      JSONException je) {
        je.printStackTrace();
        return -1;
      }
    }
  }
);
  exchangeDwnTable.setSortDirection(dir);
  exchangeDwnTable.clearAll();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void handleEvent(Event e){
  TableColumn sortColumn=exchangeDwnTable.getSortColumn();
  final TableColumn currentColumn=(TableColumn)e.widget;
  int dir=exchangeDwnTable.getSortDirection();
  if (sortColumn == currentColumn) {
    dir=dir == SWT.UP ? SWT.DOWN : SWT.UP;
  }
 else {
    exchangeDwnTable.setSortColumn(currentColumn);
    dir=SWT.UP;
  }
  final int direction=dir;
  Arrays.sort(dataContent,new Comparator(){
    public int compare(    Object arg0,    Object arg1){
      JSONObject jsonA=(JSONObject)arg0;
      JSONObject jsonB=(JSONObject)arg1;
      String valueA=null, valueB=null;
      try {
        if (currentColumn == column1) {
          valueA=jsonA.get(COLUMN_EXTENSION_NAME).toString();
          valueB=jsonB.get(COLUMN_EXTENSION_NAME).toString();
        }
 else         if (currentColumn == column2) {
          valueA=jsonA.get(COLUMN_REVISION_NAME).toString();
          valueB=jsonB.get(COLUMN_REVISION_NAME).toString();
        }
 else {
          valueA=jsonA.get(COLUMN_URL_NAME).toString();
          valueB=jsonB.get(COLUMN_URL_NAME).toString();
        }
        if (valueA.equals(valueB))         return 0;
        if (direction == SWT.UP) {
          return valueA.compareTo(valueB) < 0 ? -1 : 1;
        }
        return valueA.compareTo(valueB) < 0 ? 1 : -1;
      }
 catch (      JSONException je) {
        log.error(je.getMessage(),je);
        return -1;
      }
    }
  }
);
  exchangeDwnTable.setSortDirection(dir);
  exchangeDwnTable.clearAll();
}
Program: 148462
Project: 148462
Buggy source:
protected void okPressed(){
  boolean isExist=false;
  SAXReader reader=new SAXReader();
  Element root=null;
  if (new File(f).exists()) {
    try {
      logininfoDocument=reader.read(new File(f));
    }
 catch (    DocumentException e) {
      e.printStackTrace();
    }
    root=logininfoDocument.getRootElement();
    isExist=checkServer(root);
  }
 else {
    logininfoDocument=DocumentHelper.createDocument();
    root=logininfoDocument.addElement("String_Node_Str");
  }
  if (!isExist)   addServer(root);
  XMLWriter writer;
  try {
    writer=new XMLWriter(new FileWriter(f));
    writer.write(logininfoDocument);
    writer.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  setReturnCode(OK);
}

Fixed version (ground truth):
protected void okPressed(){
  boolean isExist=false;
  SAXReader reader=new SAXReader();
  Element root=null;
  if (new File(f).exists()) {
    try {
      logininfoDocument=reader.read(new File(f));
    }
 catch (    DocumentException e) {
      log.error(e.getMessage(),e);
    }
    root=logininfoDocument.getRootElement();
    isExist=checkServer(root);
  }
 else {
    logininfoDocument=DocumentHelper.createDocument();
    root=logininfoDocument.addElement("String_Node_Str");
  }
  if (!isExist)   addServer(root);
  XMLWriter writer;
  try {
    writer=new XMLWriter(new FileWriter(f));
    writer.write(logininfoDocument);
    writer.close();
  }
 catch (  IOException e) {
    log.error(e.getMessage(),e);
  }
  setReturnCode(OK);
}