nus-yam/ex-repair huggingface dataset:
Program: 102109
Project: 102109
Buggy source:
/** 
 * Method to return the File objects associated with each model in this VDB. The intention is to allow the Data Policy wizard to display contents of these models in EMF form so users can  pick/chose and set-up their data entitlements.
 * @return the immutable list of model files within this VDB
 */
public final Collection<File> getModelFiles(){
  final Collection<File> modelFiles=new ArrayList<File>();
  for (  VdbModelEntry modelEntry : getModelEntries()) {
    IPath modelPath=new Path(folder.getAbsolutePath() + modelEntry.getName());
    modelFiles.add(modelPath.toFile());
  }
  return Collections.unmodifiableCollection(modelFiles);
}

Fixed version (ground truth):
/** 
 * Method to return the File objects associated with each model in this VDB. The intention is to allow the Data Policy wizard to display contents of these models in EMF form so users can  pick/chose and set-up their data entitlements. Note: This will no longer return the schema files since they have their own collection and convert getter method.
 * @return the immutable list of model files within this VDB
 */
public final Collection<File> getModelFiles(){
  return convertEntries(getModelEntries());
}
Program: 102110
Project: 102110
Buggy source:
protected TabFolder createTabFolder(Composite parent){
  TabFolder tabFolder=new TabFolder(parent,SWT.TOP | SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(tabFolder);
  return tabFolder;
}

Fixed version (ground truth):
protected TabFolder createTabFolder(Composite parent){
  TabFolder tabFolder=new TabFolder(parent,SWT.TOP | SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(tabFolder);
  return tabFolder;
}
Program: 102111
Project: 102111
Buggy source:
protected Composite createDescriptionPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(thePanel);
  final Group descGroup=WidgetFactory.createGroup(thePanel,UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DESCRIPTION),GridData.FILL_BOTH,3);
  descriptionTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,false).hint(SWT.DEFAULT,120).minSize(SWT.DEFAULT,30).applyTo(descriptionTextEditor.getTextWidget());
  descriptionTextEditor.setText("String_Node_Str");
  descriptionTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setDescription(descriptionTextEditor.getText());
    }
  }
);
  return thePanel;
}

Fixed version (ground truth):
protected Composite createDescriptionPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  final Group descGroup=WidgetFactory.createGroup(thePanel,UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DESCRIPTION),GridData.FILL_BOTH,3);
  descriptionTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,120).minSize(SWT.DEFAULT,30).applyTo(descriptionTextEditor.getTextWidget());
  descriptionTextEditor.setText("String_Node_Str");
  descriptionTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setDescription(descriptionTextEditor.getText());
    }
  }
);
  return thePanel;
}
Program: 102112
Project: 102112
Buggy source:
private Composite createNativeQueryPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,1);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  nativeQueryHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
  nativeQueryHelpText.setBackground(parent.getBackground());
  nativeQueryHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,100).applyTo(nativeQueryHelpText);
  nativeQueryHelpText.setText(Messages.nativeQueryHelpText);
  final Group descGroup=WidgetFactory.createGroup(thePanel,Messages.sqlLabel,GridData.FILL_BOTH,3);
  nativeQueryTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,200).minSize(SWT.DEFAULT,30).applyTo(nativeQueryTextEditor.getTextWidget());
  nativeQueryTextEditor.setText("String_Node_Str");
  nativeQueryTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setNativeQuery(nativeQueryTextEditor.getText());
      handleInfoChanged();
    }
  }
);
  return thePanel;
}

Fixed version (ground truth):
private Composite createNativeQueryPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(thePanel);
  nativeQueryHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
  nativeQueryHelpText.setBackground(parent.getBackground());
  nativeQueryHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,40).applyTo(nativeQueryHelpText);
  nativeQueryHelpText.setText(Messages.nativeQueryHelpText);
  final Group descGroup=WidgetFactory.createGroup(thePanel,Messages.sqlLabel,GridData.FILL_BOTH,3);
  nativeQueryTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,200).minSize(SWT.DEFAULT,30).applyTo(nativeQueryTextEditor.getTextWidget());
  nativeQueryTextEditor.setText("String_Node_Str");
  nativeQueryTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setNativeQuery(nativeQueryTextEditor.getText());
      handleInfoChanged();
    }
  }
);
  return thePanel;
}
Program: 102115
Project: 102115
Buggy source:
private Composite createNativeQueryPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  nativeQueryHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
  nativeQueryHelpText.setBackground(parent.getBackground());
  nativeQueryHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,40).applyTo(nativeQueryHelpText);
  nativeQueryHelpText.setText(Messages.nativeQueryHelpText);
  final Group descGroup=WidgetFactory.createGroup(thePanel,Messages.sqlLabel,GridData.FILL_BOTH,3);
  nativeQueryTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,200).minSize(SWT.DEFAULT,30).applyTo(nativeQueryTextEditor.getTextWidget());
  nativeQueryTextEditor.setText("String_Node_Str");
  nativeQueryTextEditor.getTextWidget().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
  nativeQueryTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setNativeQuery(nativeQueryTextEditor.getText());
      handleInfoChanged();
    }
  }
);
  return thePanel;
}

Fixed version (ground truth):
private Composite createNativeQueryPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(thePanel);
  nativeQueryHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
  nativeQueryHelpText.setBackground(parent.getBackground());
  nativeQueryHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,40).applyTo(nativeQueryHelpText);
  nativeQueryHelpText.setText(Messages.nativeQueryHelpText);
  final Group descGroup=WidgetFactory.createGroup(thePanel,Messages.sqlLabel,GridData.FILL_BOTH,3);
  nativeQueryTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,200).minSize(SWT.DEFAULT,30).applyTo(nativeQueryTextEditor.getTextWidget());
  nativeQueryTextEditor.setText("String_Node_Str");
  nativeQueryTextEditor.getTextWidget().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
  nativeQueryTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setNativeQuery(nativeQueryTextEditor.getText());
      handleInfoChanged();
    }
  }
);
  return thePanel;
}
Program: 102126
Project: 102126
Buggy source:
private void validateNamespaceUri(){
  if (getMed().isBuiltIn()) {
    this.namespaceUriError.setStatus(ValidationStatus.OK_STATUS);
  }
 else {
    this.namespaceUriError.setStatus(ModelExtensionDefinitionValidator.validateNamespaceUri(getMed().getNamespaceUri(),getRegistry().getAllNamespaceUris()));
  }
  updateMessage(this.namespaceUriError);
}

Fixed version (ground truth):
private void validateNamespaceUri(){
  if (getMed().isBuiltIn() || getMed().isImported()) {
    this.namespaceUriError.setStatus(ValidationStatus.OK_STATUS);
  }
 else {
    this.namespaceUriError.setStatus(ModelExtensionDefinitionValidator.validateNamespaceUri(getMed().getNamespaceUri(),getRegistry().getAllNamespaceUris()));
  }
  updateMessage(this.namespaceUriError);
}
Program: 102127
Project: 102127
Buggy source:
private void validateNamespacePrefix(){
  if (getMed().isBuiltIn()) {
    this.namespacePrefixError.setStatus(ValidationStatus.OK_STATUS);
  }
 else {
    this.namespacePrefixError.setStatus(ModelExtensionDefinitionValidator.validateNamespacePrefix(getMed().getNamespacePrefix(),getRegistry().getAllNamespacePrefixes()));
  }
  updateMessage(this.namespacePrefixError);
}

Fixed version (ground truth):
private void validateNamespacePrefix(){
  if (getMed().isBuiltIn() || getMed().isImported()) {
    this.namespacePrefixError.setStatus(ValidationStatus.OK_STATUS);
  }
 else {
    this.namespacePrefixError.setStatus(ModelExtensionDefinitionValidator.validateNamespacePrefix(getMed().getNamespacePrefix(),getRegistry().getAllNamespacePrefixes()));
  }
  updateMessage(this.namespacePrefixError);
}
Program: 102128
Project: 102128
Buggy source:
/** 
 * @param med the MED being validated (cannot be <code>null</code>)
 * @param existingNamespacePrefixes the namespace prefixes defined in the MED (can be <code>null</code>)
 * @param existingNamespaceUris the namespace URIs defined in the MED (can be <code>null</code>) 
 * @param extendableMetamodelUris the valid metamodel URIs that can be extended (can be <code>null</code>)
 * @param validModelTypes the valid model types (can be <code>null</code>)
 * @return the validation status (never <code>null</code>)
 */
public static MedStatus validateMed(final ModelExtensionDefinition med,final Collection<String> existingNamespacePrefixes,final Collection<String> existingNamespaceUris,final Collection<String> extendableMetamodelUris,final Set<String> validModelTypes){
  boolean builtIn=med.isBuiltIn();
  if (!builtIn) {
    MedStatus status=validateMedHeader(med.getHeader(),existingNamespacePrefixes,existingNamespaceUris,extendableMetamodelUris,validModelTypes);
    status=addStatus(status,validateMetaclassNames(med.getExtendedMetaclasses(),true));
    return addStatus(status,validatePropertyDefinitions(med.getPropertyDefinitions()));
  }
 else {
    return ValidationStatus.OK_STATUS;
  }
}

Fixed version (ground truth):
/** 
 * @param med the MED being validated (cannot be <code>null</code>)
 * @param existingNamespacePrefixes the namespace prefixes defined in the MED (can be <code>null</code>)
 * @param existingNamespaceUris the namespace URIs defined in the MED (can be <code>null</code>) 
 * @param extendableMetamodelUris the valid metamodel URIs that can be extended (can be <code>null</code>)
 * @param validModelTypes the valid model types (can be <code>null</code>)
 * @return the validation status (never <code>null</code>)
 */
public static MedStatus validateMed(final ModelExtensionDefinition med,final Collection<String> existingNamespacePrefixes,final Collection<String> existingNamespaceUris,final Collection<String> extendableMetamodelUris,final Set<String> validModelTypes){
  boolean builtIn=med.isBuiltIn();
  boolean imported=med.isImported();
  if (!builtIn && !imported) {
    MedStatus status=validateMedHeader(med.getHeader(),existingNamespacePrefixes,existingNamespaceUris,extendableMetamodelUris,validModelTypes);
    status=addStatus(status,validateMetaclassNames(med.getExtendedMetaclasses(),true));
    return addStatus(status,validatePropertyDefinitions(med.getPropertyDefinitions()));
  }
 else {
    return ValidationStatus.OK_STATUS;
  }
}
Program: 102129
Project: 102129
Buggy source:
protected Composite createDescriptionPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(thePanel);
  final Group descGroup=WidgetFactory.createGroup(thePanel,UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DESCRIPTION),GridData.FILL_BOTH,3);
  descriptionTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,200).minSize(SWT.DEFAULT,30).applyTo(descriptionTextEditor.getTextWidget());
  descriptionTextEditor.setText("String_Node_Str");
  descriptionTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setDescription(descriptionTextEditor.getText());
    }
  }
);
  return thePanel;
}

Fixed version (ground truth):
protected Composite createDescriptionPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(thePanel);
  final Group descGroup=WidgetFactory.createGroup(thePanel,UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DESCRIPTION),GridData.FILL_BOTH,3);
  descriptionTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,false).hint(SWT.DEFAULT,120).minSize(SWT.DEFAULT,30).applyTo(descriptionTextEditor.getTextWidget());
  descriptionTextEditor.setText("String_Node_Str");
  descriptionTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setDescription(descriptionTextEditor.getText());
    }
  }
);
  return thePanel;
}
Program: 102131
Project: 102131
Buggy source:
private Composite createNativeQueryPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  nativeQueryHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
  nativeQueryHelpText.setBackground(parent.getBackground());
  nativeQueryHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,100).applyTo(nativeQueryHelpText);
  nativeQueryHelpText.setText(Messages.nativeQueryHelpText);
  final Group descGroup=WidgetFactory.createGroup(thePanel,Messages.sqlLabel,GridData.FILL_BOTH,3);
  nativeQueryTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,200).minSize(SWT.DEFAULT,30).applyTo(nativeQueryTextEditor.getTextWidget());
  nativeQueryTextEditor.setText("String_Node_Str");
  nativeQueryTextEditor.getTextWidget().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
  nativeQueryTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setNativeQuery(nativeQueryTextEditor.getText());
      handleInfoChanged();
    }
  }
);
  return thePanel;
}

Fixed version (ground truth):
private Composite createNativeQueryPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,3);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  nativeQueryHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
  nativeQueryHelpText.setBackground(parent.getBackground());
  nativeQueryHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,40).applyTo(nativeQueryHelpText);
  nativeQueryHelpText.setText(Messages.nativeQueryHelpText);
  final Group descGroup=WidgetFactory.createGroup(thePanel,Messages.sqlLabel,GridData.FILL_BOTH,3);
  nativeQueryTextEditor=new StyledTextEditor(descGroup,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.WRAP| SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,200).minSize(SWT.DEFAULT,30).applyTo(nativeQueryTextEditor.getTextWidget());
  nativeQueryTextEditor.setText("String_Node_Str");
  nativeQueryTextEditor.getTextWidget().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
  nativeQueryTextEditor.getTextWidget().addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getRelationalReference().setNativeQuery(nativeQueryTextEditor.getText());
      handleInfoChanged();
    }
  }
);
  return thePanel;
}
Program: 102132
Project: 102132
Buggy source:
/** 
 * {@inheritDoc}
 * @see java.lang.Runnable#run()
 */
@Override public void run(){
  refreshMed();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see java.lang.Runnable#run()
 */
@Override public void run(){
  if (!getShell().isDisposed()) {
    for (    MedEditorPage medEditorPage : accessMedEditorPages().keySet()) {
      medEditorPage.updateAllMessages();
    }
  }
}
Program: 102134
Project: 102134
Buggy source:
/** 
 * Checks the *.mxd file permissions and notifies the editor's pages if the permissions have changed.
 */
private void refreshReadOnlyState(){
  ResourceAttributes attributes=getFile().getResourceAttributes();
  boolean newValue=((attributes == null) ? true : attributes.isReadOnly());
  if (isReadOnly() != newValue) {
    this.readOnly=newValue;
    for (    MedEditorPage page : this.medEditorPages.keySet()) {
      page.setResourceReadOnly(this.readOnly);
      IManagedForm mf=page.getManagedForm();
      if (mf != null)       mf.refresh();
    }
  }
}

Fixed version (ground truth):
/** 
 * Checks the *.mxd file permissions and notifies the editor's pages if the permissions have changed.
 */
private void refreshReadOnlyState(){
  ResourceAttributes attributes=getFile().getResourceAttributes();
  if (isImported(getFile()))   attributes.setReadOnly(true);
  boolean newValue=((attributes == null) ? true : attributes.isReadOnly());
  if (isReadOnly() != newValue) {
    this.readOnly=newValue;
    for (    MedEditorPage page : this.medEditorPages.keySet()) {
      page.setResourceReadOnly(this.readOnly);
      IManagedForm mf=page.getManagedForm();
      if (mf != null)       mf.refresh();
    }
  }
}
Program: 102135
Project: 102135
Buggy source:
void refreshMed(){
  if (!isSynchronized()) {
    unhookRefreshListener();
    if (MessageFormDialog.openQuestion(getShell(),Messages.medChangedOnFileSystemDialogTitle,Activator.getDefault().getImage(MED_EDITOR),NLS.bind(Messages.medChangedOnFileSystemDialogMsg,getFile().getName()))) {
      try {
        getFile().refreshLocal(IResource.DEPTH_ONE,null);
        this.modificationStamp=this.documentProvider.getModificationStamp(getEditorInput());
        createMed();
        for (        MedEditorPage page : this.medEditorPages.keySet()) {
          page.handleMedReloaded();
        }
      }
 catch (      Exception e) {
        UTIL.log(e);
        MessageFormDialog.openError(getShell(),Messages.medEditorRefreshErrorTitle,Activator.getDefault().getImage(MED_EDITOR),Messages.medEditorRefreshErrorMsg);
      }
    }
    hookRefreshListener();
  }
}

Fixed version (ground truth):
void refreshMed(){
  if (getContainer() == null || getContainer().isDisposed())   return;
  if (!isSynchronized()) {
    unhookRefreshListener();
    if (MessageFormDialog.openQuestion(getShell(),Messages.medChangedOnFileSystemDialogTitle,Activator.getDefault().getImage(MED_EDITOR),NLS.bind(Messages.medChangedOnFileSystemDialogMsg,getFile().getName()))) {
      try {
        getFile().refreshLocal(IResource.DEPTH_ONE,null);
        this.modificationStamp=this.documentProvider.getModificationStamp(getEditorInput());
        createMed();
        for (        MedEditorPage page : this.medEditorPages.keySet()) {
          page.handleMedReloaded();
        }
      }
 catch (      Exception e) {
        UTIL.log(e);
        MessageFormDialog.openError(getShell(),Messages.medEditorRefreshErrorTitle,Activator.getDefault().getImage(MED_EDITOR),Messages.medEditorRefreshErrorMsg);
      }
    }
    hookRefreshListener();
  }
}
Program: 102136
Project: 102136
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
 */
@Override public void resourceChanged(final IResourceChangeEvent event){
  int type=event.getType();
  if (type == IResourceChangeEvent.POST_CHANGE) {
    IResourceDelta delta=event.getDelta();
    if (delta == null) {
      return;
    }
    try {
      delta.accept(new IResourceDeltaVisitor(){
        /** 
 * {@inheritDoc}
 * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
 */
        @Override public boolean visit(        IResourceDelta delta){
          if (delta.getResource().equals(getFile())) {
            if ((delta.getKind() & IResourceDelta.REMOVED) != 0) {
              if (!getShell().isDisposed()) {
                getShell().getDisplay().asyncExec(new Runnable(){
                  /** 
 * {@inheritDoc}
 * @see java.lang.Runnable#run()
 */
                  @Override public void run(){
                    getEditorSite().getPage().closeEditor(accessThis(),false);
                  }
                }
);
              }
            }
 else             if (ResourceChangeUtilities.isContentChanged(delta)) {
              if (!getShell().isDisposed()) {
                getShell().getDisplay().asyncExec(new Runnable(){
                  /** 
 * {@inheritDoc}
 * @see java.lang.Runnable#run()
 */
                  @Override public void run(){
                    refreshMed();
                  }
                }
);
              }
            }
            return false;
          }
          return true;
        }
      }
);
    }
 catch (    Exception e) {
      UTIL.log(IStatus.ERROR,e,e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
 */
@Override public void resourceChanged(final IResourceChangeEvent event){
  int type=event.getType();
  if (type != IResourceChangeEvent.POST_CHANGE)   return;
  IResourceDelta delta=event.getDelta();
  if (delta == null)   return;
  try {
    delta.accept(this);
  }
 catch (  Exception e) {
    UTIL.log(IStatus.ERROR,e,e.getMessage());
  }
}
Program: 102137
Project: 102137
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.ui.forms.editor.SharedHeaderFormEditor#dispose()
 */
@Override public void dispose(){
  getRegistry().removeListener(this);
  super.dispose();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.ui.forms.editor.SharedHeaderFormEditor#dispose()
 */
@Override public void dispose(){
  if (medEditorPages != null)   medEditorPages.clear();
  getRegistry().removeListener(this);
  if (medResourceListener != null)   ModelerCore.getWorkspace().removeResourceChangeListener(medResourceListener);
  super.dispose();
}
Program: 102138
Project: 102138
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
 */
@Override public boolean visit(IResourceDelta delta){
  if (delta.getResource().equals(getFile())) {
    if ((delta.getKind() & IResourceDelta.REMOVED) != 0) {
      if (!getShell().isDisposed()) {
        getShell().getDisplay().asyncExec(new Runnable(){
          /** 
 * {@inheritDoc}
 * @see java.lang.Runnable#run()
 */
          @Override public void run(){
            getEditorSite().getPage().closeEditor(accessThis(),false);
          }
        }
);
      }
    }
 else     if (ResourceChangeUtilities.isContentChanged(delta)) {
      if (!getShell().isDisposed()) {
        getShell().getDisplay().asyncExec(new Runnable(){
          /** 
 * {@inheritDoc}
 * @see java.lang.Runnable#run()
 */
          @Override public void run(){
            refreshMed();
          }
        }
);
      }
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
 */
@Override public boolean visit(IResourceDelta delta){
  final Collection<IEditorPart> openEditors=UiUtil.getEditorsForFile(file);
  if (openEditors.isEmpty())   return false;
  if (!delta.getResource().equals(file))   return true;
  Runnable runnable=null;
  if ((delta.getKind() & IResourceDelta.REMOVED) != 0) {
    runnable=new Runnable(){
      @Override public void run(){
        for (        IEditorPart editor : openEditors)         editor.getSite().getPage().closeEditor(editor,false);
      }
    }
;
  }
 else   if (ResourceChangeUtilities.isContentChanged(delta)) {
    runnable=new Runnable(){
      @Override public void run(){
        for (        IEditorPart editor : openEditors) {
          if (editor instanceof ModelExtensionDefinitionEditor)           ((ModelExtensionDefinitionEditor)editor).refreshMed();
        }
      }
    }
;
  }
  if (runnable != null)   UiUtil.runInSwtThread(runnable,true);
  return false;
}
Program: 102139
Project: 102139
Buggy source:
/** 
 * @param translator the translator whose properties are being changed (never <code>null</code>)
 * @param changedProperties a collection of properties that have changed (never <code>null</code> or empty)
 * @throws Exception if there is a problem changing the properties
 * @since 7.0
 */
public void setProperties(ITeiidTranslator translator,Properties changedProperties,TranslatorPropertyType type) throws Exception {
  ArgCheck.isNotNull(translator,"String_Node_Str");
  ArgCheck.isNotNull(changedProperties,"String_Node_Str");
  ArgCheck.isNotEmpty(changedProperties.entrySet(),"String_Node_Str");
  if (changedProperties.size() == 1) {
    String name=changedProperties.stringPropertyNames().iterator().next();
    setPropertyValue(translator,name,changedProperties.getProperty(name),type);
  }
 else {
    for (    String name : changedProperties.stringPropertyNames()) {
      internalSetPropertyValue(translator,name,changedProperties.getProperty(name),type,false);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param translator the translator whose properties are being changed (never <code>null</code>)
 * @param changedProperties a collection of properties that have changed (never <code>null</code> or empty)
 * @param type the translator property type
 * @throws Exception if there is a problem changing the properties
 * @since 7.0
 */
public void setProperties(ITeiidTranslator translator,Properties changedProperties,TranslatorPropertyType type) throws Exception {
  ArgCheck.isNotNull(translator,"String_Node_Str");
  ArgCheck.isNotNull(changedProperties,"String_Node_Str");
  ArgCheck.isNotEmpty(changedProperties.entrySet(),"String_Node_Str");
  if (changedProperties.size() == 1) {
    String name=changedProperties.stringPropertyNames().iterator().next();
    setPropertyValue(translator,name,changedProperties.getProperty(name),type);
  }
 else {
    for (    String name : changedProperties.stringPropertyNames()) {
      internalSetPropertyValue(translator,name,changedProperties.getProperty(name),type,false);
    }
  }
}
Program: 102140
Project: 102140
Buggy source:
private void waitForVDBLoad(String vdbName) throws Exception {
  long waitUntil=System.currentTimeMillis() + VDB_LOADING_TIMEOUT_SEC * 1000;
  boolean first=true;
  do {
    if (!first) {
      try {
        Thread.sleep(5000);
      }
 catch (      InterruptedException e) {
        break;
      }
    }
 else {
      first=false;
    }
    refresh();
    ITeiidVdb vdb=getVdb(vdbName);
    if (vdb != null) {
      boolean hasValidityErrors=!vdb.getValidityErrors().isEmpty();
      if (!vdb.hasModels() || vdb.hasFailed() || !vdb.isLoading()|| vdb.isActive()|| vdb.wasRemoved()|| hasValidityErrors) {
        return;
      }
    }
 else {
      return;
    }
  }
 while (System.currentTimeMillis() < waitUntil);
  refresh();
  return;
}

Fixed version (ground truth):
private void waitForVDBLoad(String vdbName) throws Exception {
  long waitUntil=System.currentTimeMillis() + VDB_LOADING_TIMEOUT_SEC * 1000;
  boolean first=true;
  do {
    if (!first) {
      try {
        Thread.sleep(5000);
      }
 catch (      InterruptedException e) {
        break;
      }
    }
 else {
      first=false;
    }
    refreshVDBs();
    ITeiidVdb vdb=getVdb(vdbName);
    if (vdb != null) {
      boolean hasValidityErrors=!vdb.getValidityErrors().isEmpty();
      if (!vdb.hasModels() || vdb.hasFailed() || !vdb.isLoading()|| vdb.isActive()|| vdb.wasRemoved()|| hasValidityErrors) {
        return;
      }
    }
 else {
      return;
    }
  }
 while (System.currentTimeMillis() < waitUntil);
  refreshVDBs();
  return;
}
Program: 102142
Project: 102142
Buggy source:
/** 
 * @param translator the translator whose property is being changed (never <code>null</code>)
 * @param propName the name of the property being changed (never <code>null</code> or empty)
 * @param value the new value
 * @throws Exception if there is a problem setting the property
 * @since 7.0
 */
public void setPropertyValue(ITeiidTranslator translator,String propName,String value,TranslatorPropertyType type) throws Exception {
  ArgCheck.isNotNull(translator,"String_Node_Str");
  ArgCheck.isNotEmpty(propName,"String_Node_Str");
  ArgCheck.isNotEmpty(value,"String_Node_Str");
  internalSetPropertyValue(translator,propName,value,type,true);
}

Fixed version (ground truth):
/** 
 * @param translator the translator whose property is being changed (never <code>null</code>)
 * @param propName the name of the property being changed (never <code>null</code> or empty)
 * @param value the new value
 * @param type the translator property type
 * @throws Exception if there is a problem setting the property
 * @since 7.0
 */
public void setPropertyValue(ITeiidTranslator translator,String propName,String value,TranslatorPropertyType type) throws Exception {
  ArgCheck.isNotNull(translator,"String_Node_Str");
  ArgCheck.isNotEmpty(propName,"String_Node_Str");
  ArgCheck.isNotEmpty(value,"String_Node_Str");
  internalSetPropertyValue(translator,propName,value,type,true);
}
Program: 102143
Project: 102143
Buggy source:
/** 
 * Set the Target Model Location
 * @param targetPath the location path for the target
 */
public void setTargetModelLocation(IPath targetPath){
  this.targetModelLocation=targetPath;
  if (this.ddlImporter != null) {
    this.ddlImporter.setModelFolder(targetPath.toOSString());
  }
}

Fixed version (ground truth):
/** 
 * Set the Target Model Location
 * @param targetPath the location path for the target
 */
public void setTargetModelLocation(IPath targetPath){
  this.targetModelLocation=targetPath;
  if (this.ddlImporter != null) {
    this.ddlImporter.setModelFolder(targetPath.toString());
  }
}
Program: 102144
Project: 102144
Buggy source:
private void addMessage(ErrorMessage errorMsg){
  errorMsg.update(this.scrolledForm.getMessageManager());
}

Fixed version (ground truth):
private void addMessage(ErrorMessage errorMsg){
  errorMsg.update(this.scrolledForm.getMessageManager());
  if (errorMsg.isOk()) {
    this.scrolledForm.setMessage(errorMsg.getMessage(),IMessageProvider.NONE);
  }
}
Program: 102146
Project: 102146
Buggy source:
void chooseDdlFileFromWorkspace(){
  final ChooseFileDialog dlg=new ChooseFileDialog(DdlImporterUiI18n.CHOOSE_DDL_FILE_DIALOG_TITLE,DdlImporterUiI18n.CHOOSE_DDL_FILE_DIALOG_MSG,new ChooseFileDialogContentProvider(){
    @Override boolean validFile(    final IFile file){
      String ext=file.getFileExtension();
      if (ext == null)       return false;
      ext=ext.toLowerCase();
      return "String_Node_Str".equals(ext) || "String_Node_Str".equals(ext);
    }
  }
);
  final IPath choice=showChooseDialog(dlg);
  if (choice == null)   return;
  ddlFileCombo.setText(choice.toString());
  tabFromDdlFileCombo();
}

Fixed version (ground truth):
void chooseDdlFileFromWorkspace(){
  final ChooseFileDialog dlg=new ChooseFileDialog(DdlImporterUiI18n.CHOOSE_DDL_FILE_DIALOG_TITLE,DdlImporterUiI18n.CHOOSE_DDL_FILE_DIALOG_MSG,new ChooseFileDialogContentProvider(){
    @Override boolean validFile(    final IFile file){
      String ext=file.getFileExtension();
      if (ext == null)       return false;
      ext=ext.toLowerCase();
      return "String_Node_Str".equals(ext) || "String_Node_Str".equals(ext);
    }
  }
);
  final IResource choice=showChooseDialog(dlg);
  if (choice == null)   return;
  ddlFileCombo.setText(choice.getFullPath().removeFileExtension().toString());
  tabFromDdlFileCombo();
}
Program: 102147
Project: 102147
Buggy source:
void chooseModel(){
  final ChooseFileDialog dlg=new ChooseFileDialog(DdlImporterUiI18n.CHOOSE_MODEL_FILE_DIALOG_TITLE,DdlImporterUiI18n.CHOOSE_MODEL_FILE_DIALOG_MSG,new ChooseFileDialogContentProvider(){
    @Override boolean validFile(    final IFile file){
      return relationalModel(file);
    }
  }
);
  if (importer.modelFile() != null)   dlg.setInitialSelection(importer.modelFile());
  final IPath choice=showChooseDialog(dlg);
  if (choice == null)   return;
  ddlFileCombo.setText(choice.removeFileExtension().lastSegment());
}

Fixed version (ground truth):
void chooseModel(){
  final ChooseFileDialog dlg=new ChooseFileDialog(DdlImporterUiI18n.CHOOSE_MODEL_FILE_DIALOG_TITLE,DdlImporterUiI18n.CHOOSE_MODEL_FILE_DIALOG_MSG,new ChooseFileDialogContentProvider(){
    @Override boolean validFile(    final IFile file){
      return relationalModel(file);
    }
  }
);
  if (importer.modelFile() != null)   dlg.setInitialSelection(importer.modelFile());
  final IResource choice=showChooseDialog(dlg);
  if (choice == null)   return;
  this.modelNameFld.setText(choice.getFullPath().removeFileExtension().lastSegment().toString());
  IPath folder=choice.getFullPath().removeLastSegments(1);
  this.modelFolderFld.setText(folder.toString());
}
Program: 102148
Project: 102148
Buggy source:
void chooseModelFolder(){
  final ChooseDialog dlg=new ChooseDialog(DdlImporterUiI18n.CHOOSE_MODEL_FOLDER_DIALOG_TITLE,DdlImporterUiI18n.CHOOSE_MODEL_FOLDER_DIALOG_MSG,new ChooseDialogContentProvider(){
    @Override public final IResource[] getChildren(    final IContainer container){
      final List<IResource> children=new ArrayList<IResource>();
      try {
        for (        final IResource resource : container.members())         if (resource instanceof IContainer)         children.add(resource);
      }
 catch (      final CoreException error) {
        throw CoreModelerPlugin.toRuntimeException(error);
      }
      return children.toArray(new IResource[children.size()]);
    }
    @Override public final boolean hasChildren(    final IContainer container){
      try {
        for (        final IResource resource : container.members())         if (resource instanceof IContainer)         return true;
      }
 catch (      final CoreException error) {
        throw CoreModelerPlugin.toRuntimeException(error);
      }
      return false;
    }
  }
);
  if (importer.modelFolder() != null)   dlg.setInitialSelection(importer.modelFolder());
  final IPath choice=showChooseDialog(dlg);
  if (choice == null)   return;
  modelFolderFld.setText(choice.toString());
  modelNameFld.setFocus();
}

Fixed version (ground truth):
void chooseModelFolder(){
  final ChooseDialog dlg=new ChooseDialog(DdlImporterUiI18n.CHOOSE_MODEL_FOLDER_DIALOG_TITLE,DdlImporterUiI18n.CHOOSE_MODEL_FOLDER_DIALOG_MSG,new ChooseDialogContentProvider(){
    @Override public final IResource[] getChildren(    final IContainer container){
      final List<IResource> children=new ArrayList<IResource>();
      try {
        for (        final IResource resource : container.members())         if (resource instanceof IContainer)         children.add(resource);
      }
 catch (      final CoreException error) {
        throw CoreModelerPlugin.toRuntimeException(error);
      }
      return children.toArray(new IResource[children.size()]);
    }
    @Override public final boolean hasChildren(    final IContainer container){
      try {
        for (        final IResource resource : container.members())         if (resource instanceof IContainer)         return true;
      }
 catch (      final CoreException error) {
        throw CoreModelerPlugin.toRuntimeException(error);
      }
      return false;
    }
  }
);
  if (importer.modelFolder() != null)   dlg.setInitialSelection(importer.modelFolder());
  final IResource choice=showChooseDialog(dlg);
  if (choice == null)   return;
  modelFolderFld.setText(choice.getFullPath().toString());
  modelNameFld.setFocus();
}
Program: 102149
Project: 102149
Buggy source:
private IPath showChooseDialog(final ElementTreeSelectionDialog dialog){
  return dialog.open() == Window.OK ? ((IResource)dialog.getFirstResult()).getLocation() : null;
}

Fixed version (ground truth):
private IResource showChooseDialog(final ElementTreeSelectionDialog dialog){
  return dialog.open() == Window.OK ? ((IResource)dialog.getFirstResult()) : null;
}
Program: 102152
Project: 102152
Buggy source:
/** 
 * Get string representation of the value for the modelObject for the indexed property.
 * @param index the column index
 * @return the value object
 */
public final Object getValue(int index){
  if (modelObject.eIsProxy()) {
    return null;
  }
  Object result=null;
  Object propertyId=tableModel.getPropertyIdAtIndex(index);
  if (tableModel.isLocationColumn(propertyId)) {
    EObject container=modelObject.eContainer();
    if (container != null) {
      result=ModelUtilities.getEMFLabelProvider().getText(modelObject.eContainer());
    }
 else {
      result=ModelUtilities.getModelName(modelObject);
    }
  }
 else   if (tableModel.isDescriptionColumn(propertyId)) {
    result=ModelObjectUtilities.getDescription(modelObject);
  }
 else {
    IPropertyDescriptor descriptor=getPropertyDescriptor(propertyId);
    if (descriptor != null) {
      if (propertyId instanceof ModelExtensionPropertyDescriptor) {
        propertyId=descriptor.getId();
      }
      result=descriptor.getLabelProvider().getText(propertySource.getPropertyValue(propertyId));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Get string representation of the value for the modelObject for the indexed property.
 * @param index the column index
 * @return the value object
 */
public final Object getValue(int index){
  if (modelObject.eIsProxy()) {
    return null;
  }
  Object result=null;
  Object propertyId=tableModel.getPropertyIdAtIndex(index);
  if (tableModel.isLocationColumn(propertyId)) {
    EObject container=modelObject.eContainer();
    if (container != null) {
      result=ModelUtilities.getEMFLabelProvider().getText(modelObject.eContainer());
    }
 else {
      try {
        ModelResource mr=ModelUtilities.getModelResource(modelObject);
        if (mr != null && mr.getCorrespondingResource() != null) {
          result=ModelUtilities.getModelName(modelObject);
        }
      }
 catch (      ModelWorkspaceException ex) {
        String message="String_Node_Str";
        UiConstants.Util.log(IStatus.ERROR,ex,message);
      }
    }
  }
 else   if (tableModel.isDescriptionColumn(propertyId)) {
    result=ModelObjectUtilities.getDescription(modelObject);
  }
 else {
    IPropertyDescriptor descriptor=getPropertyDescriptor(propertyId);
    if (descriptor != null) {
      if (propertyId instanceof ModelExtensionPropertyDescriptor) {
        propertyId=descriptor.getId();
      }
      result=descriptor.getLabelProvider().getText(propertySource.getPropertyValue(propertyId));
    }
  }
  return result;
}
Program: 102155
Project: 102155
Buggy source:
/** 
 * Get string representation of the value for the modelObject for the indexed property.
 * @param index the column index
 * @return the value object
 */
public final Object getValue(int index){
  if (modelObject.eIsProxy()) {
    return null;
  }
  Object result=null;
  Object propertyId=tableModel.getPropertyIdAtIndex(index);
  if (tableModel.isLocationColumn(propertyId)) {
    EObject container=modelObject.eContainer();
    if (container != null) {
      result=ModelUtilities.getEMFLabelProvider().getText(modelObject.eContainer());
    }
 else {
      result=ModelUtilities.getModelName(modelObject);
    }
  }
 else   if (tableModel.isDescriptionColumn(propertyId)) {
    result=ModelObjectUtilities.getDescription(modelObject);
  }
 else {
    IPropertyDescriptor descriptor=getPropertyDescriptor(propertyId);
    if (descriptor != null) {
      if (propertyId instanceof ModelExtensionPropertyDescriptor) {
        propertyId=descriptor.getId();
      }
      result=descriptor.getLabelProvider().getText(propertySource.getPropertyValue(propertyId));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Get string representation of the value for the modelObject for the indexed property.
 * @param index the column index
 * @return the value object
 */
public final Object getValue(int index){
  if (modelObject.eIsProxy()) {
    return null;
  }
  Object result=null;
  Object propertyId=tableModel.getPropertyIdAtIndex(index);
  if (tableModel.isLocationColumn(propertyId)) {
    EObject container=modelObject.eContainer();
    if (container != null) {
      result=ModelUtilities.getEMFLabelProvider().getText(modelObject.eContainer());
    }
 else {
      try {
        ModelResource mr=ModelUtilities.getModelResource(modelObject);
        if (mr != null && mr.getCorrespondingResource() != null) {
          result=ModelUtilities.getModelName(modelObject);
        }
      }
 catch (      ModelWorkspaceException ex) {
        String message="String_Node_Str";
        UiConstants.Util.log(IStatus.ERROR,ex,message);
      }
    }
  }
 else   if (tableModel.isDescriptionColumn(propertyId)) {
    result=ModelObjectUtilities.getDescription(modelObject);
  }
 else {
    IPropertyDescriptor descriptor=getPropertyDescriptor(propertyId);
    if (descriptor != null) {
      if (propertyId instanceof ModelExtensionPropertyDescriptor) {
        propertyId=descriptor.getId();
      }
      result=descriptor.getLabelProvider().getText(propertySource.getPropertyValue(propertyId));
    }
  }
  return result;
}
Program: 102157
Project: 102157
Buggy source:
private File getXmlFileFromRestUrl(IConnectionProfile profile){
  Properties props=profile.getBaseProperties();
  String endpoint=ConnectionInfoHelper.readEndPointProperty(props);
  String username=(String)props.get(ICredentialsCommon.USERNAME_PROP_ID);
  String password=(String)props.get(ICredentialsCommon.PASSWORD_PROP_ID);
  File xmlFile=null;
  FileOutputStream fos=null;
  try {
    final URL url=new URL(endpoint);
    final HttpURLConnection httpConn=(HttpURLConnection)url.openConnection();
    String filePath=formatPath(url);
    if (username != null && !username.isEmpty()) {
      httpConn.setRequestProperty("String_Node_Str","String_Node_Str" + Base64.encodeBytes((username + ':' + password).getBytes()));
    }
    httpConn.setDoOutput(true);
    httpConn.setRequestProperty("String_Node_Str","String_Node_Str");
    InputStream is=httpConn.getInputStream();
    xmlFile=File.createTempFile(CoreStringUtil.createFileName(filePath),DOT_XML_LOWER);
    FileOutputStream os=new FileOutputStream(xmlFile);
    write(os,is);
  }
 catch (  MalformedURLException ex) {
    throw new RuntimeException(ex);
  }
catch (  ProtocolException ex) {
    throw new RuntimeException(ex);
  }
catch (  IOException ex) {
    throw new RuntimeException(ex);
  }
 finally {
    try {
      if (fos != null) {
        fos.close();
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return xmlFile;
}

Fixed version (ground truth):
private File getXmlFileFromRestUrl(IConnectionProfile profile){
  Properties props=profile.getBaseProperties();
  String endpoint=ConnectionInfoHelper.readEndPointProperty(props);
  String username=(String)props.get(ICredentialsCommon.USERNAME_PROP_ID);
  String password=(String)props.get(ICredentialsCommon.PASSWORD_PROP_ID);
  File xmlFile=null;
  FileOutputStream fos=null;
  try {
    final URL url=new URL(endpoint);
    final HttpURLConnection httpConn=(HttpURLConnection)url.openConnection();
    String filePath=formatPath(url);
    if (username != null && !username.isEmpty()) {
      httpConn.setRequestProperty("String_Node_Str","String_Node_Str" + Base64.encodeBytes((username + ':' + password).getBytes()));
    }
    httpConn.setDoOutput(true);
    httpConn.setRequestProperty("String_Node_Str","String_Node_Str");
    httpConn.setRequestProperty("String_Node_Str","String_Node_Str");
    InputStream is=httpConn.getInputStream();
    xmlFile=File.createTempFile(CoreStringUtil.createFileName(filePath),DOT_XML_LOWER);
    FileOutputStream os=new FileOutputStream(xmlFile);
    write(os,is);
  }
 catch (  MalformedURLException ex) {
    throw new RuntimeException(ex);
  }
catch (  ProtocolException ex) {
    throw new RuntimeException(ex);
  }
catch (  IOException ex) {
    throw new RuntimeException(ex);
  }
 finally {
    try {
      if (fos != null) {
        fos.close();
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return xmlFile;
}
Program: 102160
Project: 102160
Buggy source:
@Override protected void setValue(Object element,Object value){
  if (element instanceof VdbSource) {
    String oldValue=((VdbSource)element).getName();
    String newValue=(String)value;
    if (newValue != null && newValue.length() > 0 && !newValue.equalsIgnoreCase(oldValue)) {
      ((VdbSource)element).setName(newValue);
      refreshModelDetails();
    }
  }
}

Fixed version (ground truth):
@Override protected void setValue(Object element,Object value){
  if (element instanceof VdbSource) {
    String oldValue=((VdbSource)element).getName();
    String newValue=(String)value;
    if (newValue != null && newValue.length() > 0 && !newValue.equalsIgnoreCase(oldValue)) {
      String newName=ensureUniqueName(newValue,(VdbSource)element);
      ((VdbSource)element).setName(newName);
      refreshModelDetails();
      bindingsViewer.setSelection(new StructuredSelection(element));
    }
  }
}