nus-yam/ex-repair huggingface dataset:
Program: 120334
Project: 120334
Buggy source:
public void commit() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new PostMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode);
  }
}

Fixed version (ground truth):
public void commit() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new PostMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode + "String_Node_Str");
  }
}
Program: 120337
Project: 120337
Buggy source:
protected Control createDialogArea(Composite parent){
  Composite container=(Composite)super.createDialogArea(parent);
  TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(),"String_Node_Str");
  GridData data=(GridData)container.getLayoutData();
  data.minimumHeight=400;
  data.heightHint=400;
  data.minimumWidth=500;
  data.widthHint=500;
  container.setLayoutData(data);
  textFilter=new ViewerTextFilter();
  createFilterField(container);
  RepoCommonViewerProvider provider=new RepoCommonViewerProvider();
  treeViewer=provider.createViewer(container);
  treeViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      getButton(IDialogConstants.OK_ID).setEnabled(isValidSelection(event));
    }
  }
);
  treeViewer.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      if (getButton(IDialogConstants.OK_ID).isEnabled()) {
        okPressed();
      }
    }
  }
);
  treeViewer.addFilter(textFilter);
  treeViewer.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      return filterByType(viewer,parentElement,element);
    }
  }
);
  return container;
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  Composite container=(Composite)super.createDialogArea(parent);
  TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(),"String_Node_Str");
  GridData data=(GridData)container.getLayoutData();
  data.minimumHeight=400;
  data.heightHint=400;
  data.minimumWidth=500;
  data.widthHint=500;
  container.setLayoutData(data);
  textFilter=new ViewerTextFilter();
  createFilterField(container);
  treeViewer=provider.createViewer(container);
  treeViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      getButton(IDialogConstants.OK_ID).setEnabled(isValidSelection(event));
    }
  }
);
  treeViewer.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      if (getButton(IDialogConstants.OK_ID).isEnabled()) {
        okPressed();
      }
    }
  }
);
  treeViewer.addFilter(textFilter);
  treeViewer.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      return filterByType(viewer,parentElement,element);
    }
  }
);
  return container;
}
Program: 120338
Project: 120338
Buggy source:
public boolean rollback() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new DeleteMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public void rollback() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new DeleteMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode);
  }
}
Program: 120339
Project: 120339
Buggy source:
public boolean commit() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new PostMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public void commit() throws IOException {
  HttpClient client=new HttpClient();
  client.getState().setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username,password));
  HttpMethod method=new PostMethod(url + "String_Node_Str" + id);
  method.setDoAuthentication(true);
  try {
    client.executeMethod(method);
  }
 catch (  HttpException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
 finally {
    method.releaseConnection();
  }
  int statuscode=method.getStatusCode();
  if (statuscode >= 400) {
    throw new MDMTransactionException("String_Node_Str" + statuscode);
  }
}
Program: 120340
Project: 120340
Buggy source:
public static void main(String[] args) throws IOException {
  MDMTransaction mt=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  boolean commitresult=mt.commit();
  MDMTransaction mt1=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  boolean rollbackcommit=mt1.rollback();
  System.out.println(commitresult);
  System.out.println(rollbackcommit);
  String url="String_Node_Str";
  String mdmurl=MDMTransactionClient.getMDMTransactionURL(url);
  System.out.println(mdmurl);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  MDMTransaction mt=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  mt.commit();
  MDMTransaction mt1=MDMTransactionClient.newTransaction("String_Node_Str","String_Node_Str","String_Node_Str");
  mt1.rollback();
  String url="String_Node_Str";
  String mdmurl=MDMTransactionClient.getMDMTransactionURL(url);
  System.out.println(mdmurl);
}
Program: 120341
Project: 120341
Buggy source:
public static boolean hasErrors(Shell shell){
  try {
    ITalendSynchronizer synchronizer=CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
    Set<String> jobIds=new HashSet<String>();
    for (    JobInfo jobInfo : LastGenerationInfo.getInstance().getLastGeneratedjobs()) {
      IFile sourceFile=synchronizer.getProcessFile(jobInfo);
      jobIds.add(jobInfo.getJobId());
      Problems.addRoutineFile(sourceFile,ProblemType.JOB,jobInfo.getJobName(),jobInfo.getJobVersion(),true);
    }
    Problems.refreshProblemTreeView();
    List<Problem> errors=Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
    ErrorDetailTreeBuilder builder=new ErrorDetailTreeBuilder();
    List<JobErrorEntry> input=builder.createTreeInput(errors,jobIds);
    if (input.size() > 0) {
      ErrorDetailDialog dialog=new ErrorDetailDialog(shell,input);
      if (dialog.open() != IDialogConstants.OK_ID) {
        return true;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return false;
}

Fixed version (ground truth):
public static boolean hasErrors(Shell shell){
  try {
    Item item=null;
    IProxyRepositoryFactory proxyRepositoryFactory=CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
    ITalendSynchronizer synchronizer=CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
    Set<String> jobIds=new HashSet<String>();
    for (    JobInfo jobInfo : LastGenerationInfo.getInstance().getLastGeneratedjobs()) {
      List<IRepositoryViewObject> allVersions=proxyRepositoryFactory.getAllVersion(jobInfo.getJobId());
      for (      IRepositoryViewObject repositoryObject2 : allVersions) {
        Property property2=repositoryObject2.getProperty();
        if (jobInfo.getJobVersion().equals(property2.getVersion())) {
          item=property2.getItem();
          break;
        }
      }
      if (item == null) {
        continue;
      }
      IFile sourceFile=synchronizer.getFile(item);
      jobIds.add(item.getProperty().getId());
      Problems.addJobRoutineFile(sourceFile,ProblemType.JOB,item,true);
    }
    Problems.refreshProblemTreeView();
    List<Problem> errors=Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
    ErrorDetailTreeBuilder builder=new ErrorDetailTreeBuilder();
    List<JobErrorEntry> input=builder.createTreeInput(errors,jobIds);
    if (input.size() > 0) {
      ErrorDetailDialog dialog=new ErrorDetailDialog(shell,input);
      if (dialog.open() != IDialogConstants.OK_ID) {
        return true;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return false;
}
Program: 120344
Project: 120344
Buggy source:
public static boolean hasErrors(Shell shell){
  try {
    ITalendSynchronizer synchronizer=CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
    Set<String> jobIds=new HashSet<String>();
    for (    JobInfo jobInfo : LastGenerationInfo.getInstance().getLastGeneratedjobs()) {
      IFile sourceFile=synchronizer.getProcessFile(jobInfo);
      jobIds.add(jobInfo.getJobId());
      Problems.addRoutineFile(sourceFile,ProblemType.JOB,jobInfo.getJobName(),jobInfo.getJobVersion(),true);
    }
    Problems.refreshProblemTreeView();
    List<Problem> errors=Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
    ErrorDetailTreeBuilder builder=new ErrorDetailTreeBuilder();
    List<JobErrorEntry> input=builder.createTreeInput(errors,jobIds);
    if (input.size() > 0) {
      ErrorDetailDialog dialog=new ErrorDetailDialog(shell,input);
      if (dialog.open() != IDialogConstants.OK_ID) {
        return true;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return false;
}

Fixed version (ground truth):
public static boolean hasErrors(Shell shell){
  try {
    Item item=null;
    IProxyRepositoryFactory proxyRepositoryFactory=CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
    ITalendSynchronizer synchronizer=CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
    Set<String> jobIds=new HashSet<String>();
    for (    JobInfo jobInfo : LastGenerationInfo.getInstance().getLastGeneratedjobs()) {
      List<IRepositoryViewObject> allVersions=proxyRepositoryFactory.getAllVersion(jobInfo.getJobId());
      for (      IRepositoryViewObject repositoryObject2 : allVersions) {
        Property property2=repositoryObject2.getProperty();
        if (jobInfo.getJobVersion().equals(property2.getVersion())) {
          item=property2.getItem();
          break;
        }
      }
      if (item == null) {
        continue;
      }
      IFile sourceFile=synchronizer.getFile(item);
      jobIds.add(item.getProperty().getId());
      Problems.addJobRoutineFile(sourceFile,ProblemType.JOB,item,true);
    }
    Problems.refreshProblemTreeView();
    List<Problem> errors=Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
    ErrorDetailTreeBuilder builder=new ErrorDetailTreeBuilder();
    List<JobErrorEntry> input=builder.createTreeInput(errors,jobIds);
    if (input.size() > 0) {
      ErrorDetailDialog dialog=new ErrorDetailDialog(shell,input);
      if (dialog.open() != IDialogConstants.OK_ID) {
        return true;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return false;
}
Program: 120346
Project: 120346
Buggy source:
public static boolean hasErrors(Shell shell){
  try {
    ITalendSynchronizer synchronizer=CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
    Set<String> jobIds=new HashSet<String>();
    for (    JobInfo jobInfo : LastGenerationInfo.getInstance().getLastGeneratedjobs()) {
      IFile sourceFile=synchronizer.getProcessFile(jobInfo);
      jobIds.add(jobInfo.getJobId());
      Problems.addRoutineFile(sourceFile,ProblemType.JOB,jobInfo.getJobName(),jobInfo.getJobVersion(),true);
    }
    Problems.refreshProblemTreeView();
    List<Problem> errors=Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
    ErrorDetailTreeBuilder builder=new ErrorDetailTreeBuilder();
    List<JobErrorEntry> input=builder.createTreeInput(errors,jobIds);
    if (input.size() > 0) {
      ErrorDetailDialog dialog=new ErrorDetailDialog(shell,input);
      if (dialog.open() != IDialogConstants.OK_ID) {
        return true;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return false;
}

Fixed version (ground truth):
public static boolean hasErrors(Shell shell){
  try {
    Item item=null;
    IProxyRepositoryFactory proxyRepositoryFactory=CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
    ITalendSynchronizer synchronizer=CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
    Set<String> jobIds=new HashSet<String>();
    for (    JobInfo jobInfo : LastGenerationInfo.getInstance().getLastGeneratedjobs()) {
      List<IRepositoryViewObject> allVersions=proxyRepositoryFactory.getAllVersion(jobInfo.getJobId());
      for (      IRepositoryViewObject repositoryObject2 : allVersions) {
        Property property2=repositoryObject2.getProperty();
        if (jobInfo.getJobVersion().equals(property2.getVersion())) {
          item=property2.getItem();
          break;
        }
      }
      if (item == null) {
        continue;
      }
      IFile sourceFile=synchronizer.getFile(item);
      jobIds.add(item.getProperty().getId());
      Problems.addJobRoutineFile(sourceFile,ProblemType.JOB,item,true);
    }
    Problems.refreshProblemTreeView();
    List<Problem> errors=Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
    ErrorDetailTreeBuilder builder=new ErrorDetailTreeBuilder();
    List<JobErrorEntry> input=builder.createTreeInput(errors,jobIds);
    if (input.size() > 0) {
      ErrorDetailDialog dialog=new ErrorDetailDialog(shell,input);
      if (dialog.open() != IDialogConstants.OK_ID) {
        return true;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return false;
}
Program: 120347
Project: 120347
Buggy source:
/** 
 * DOC hcw Comment method "createItemList".
 * @param workArea
 */
private void createItemList(Composite workArea){
  Composite itemComposite=new Composite(workArea,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).applyTo(itemComposite);
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).hint(500,300).applyTo(itemComposite);
  Label label=new Label(itemComposite,SWT.NONE);
  label.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.swtDefaults().span(2,1).applyTo(label);
  createTreeViewer(itemComposite);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  createSelectionButton(itemComposite);
  CheckboxTreeViewer exportItemsTreeViewer=getItemsTreeViewer();
  exportItemsTreeViewer.getTree().setRedraw(false);
  exportItemsTreeViewer.expandToLevel(3);
  if (exportItemsTreeViewer.getInput() instanceof ProjectRepositoryNode) {
    RepositoryNode rootRepositoryNode=((ProjectRepositoryNode)exportItemsTreeViewer.getInput()).getRootRepositoryNode(ERepositoryObjectType.REFERENCED_PROJECTS,false);
    exportReferencedItem(rootRepositoryNode);
  }
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  exportItemsTreeViewer.getTree().setRedraw(true);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  addTreeCheckedSelection();
  checkSelectedElements(exportItemsTreeViewer);
}

Fixed version (ground truth):
/** 
 * DOC hcw Comment method "createItemList".
 * @param workArea
 */
private void createItemList(Composite workArea){
  Composite itemComposite=new Composite(workArea,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).applyTo(itemComposite);
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).hint(500,300).applyTo(itemComposite);
  Label label=new Label(itemComposite,SWT.NONE);
  label.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.swtDefaults().span(2,1).applyTo(label);
  createTreeViewer(itemComposite);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  createSelectionButton(itemComposite);
  CheckboxTreeViewer exportItemsTreeViewer=getItemsTreeViewer();
  exportItemsTreeViewer.getTree().setRedraw(false);
  exportItemsTreeViewer.expandToLevel(3);
  if (exportItemsTreeViewer.getInput() instanceof ProjectRepositoryNode) {
    RepositoryNode rootRepositoryNode=((ProjectRepositoryNode)exportItemsTreeViewer.getInput()).getRootRepositoryNode(ERepositoryObjectType.REFERENCED_PROJECTS,false);
    expandReferencedItem(rootRepositoryNode);
  }
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  exportItemsTreeViewer.getTree().setRedraw(true);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  addTreeCheckedSelection();
  checkSelectedElements(exportItemsTreeViewer);
}
Program: 120348
Project: 120348
Buggy source:
public CreationFactory getCreationFactory(Object template);

Fixed version (ground truth):
public CreationFactory getCreationFactory(Object template,String editorID);
Program: 120349
Project: 120349
Buggy source:
public static void setupTMap(Node node){
  if (!GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMapperService.class)) {
    return;
  }
  IConnection inputConnection=node.getIncomingConnections().get(0);
  IConnection outputConnection=node.getOutgoingConnections().get(0);
  outputConnection.getMetadataTable().setListColumns(inputConnection.getMetadataTable().clone(false).getListColumns());
  ((Process)node.getProcess()).checkProcess();
  if ("String_Node_Str".equals(node.getComponent().getName())) {
    IDesignerMapperService service=(IDesignerMapperService)GlobalServiceRegister.getDefault().getService(IDesignerMapperService.class);
    service.createAutoMappedNode(node,inputConnection,outputConnection);
  }
}

Fixed version (ground truth):
public static void setupTMap(Node node){
  if (!GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMapperService.class)) {
    return;
  }
  IConnection inputConnection=node.getIncomingConnections().get(0);
  IConnection outputConnection=node.getOutgoingConnections().get(0);
  if (outputConnection.getMetadataTable() != null && inputConnection.getMetadataTable() != null) {
    outputConnection.getMetadataTable().setListColumns(inputConnection.getMetadataTable().clone(false).getListColumns());
    ((Process)node.getProcess()).checkProcess();
  }
  if ("String_Node_Str".equals(node.getComponent().getName())) {
    IDesignerMapperService service=(IDesignerMapperService)GlobalServiceRegister.getDefault().getService(IDesignerMapperService.class);
    service.createAutoMappedNode(node,inputConnection,outputConnection);
  }
}
Program: 120350
Project: 120350
Buggy source:
@Override protected CreationFactory getFactory(Object template){
  CreationFactory factory=super.getFactory(template);
  if (factory == null) {
    if (template != null && template instanceof IStructuredSelection) {
      Object element=((IStructuredSelection)template).getFirstElement();
      if (element != null && element instanceof PaletteEditPart) {
        Object model=((PaletteEditPart)element).getModel();
        if (model != null && model instanceof ToolEntry) {
          return (CreationFactory)((ToolEntry)model).getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY);
        }
      }
 else       if (!(getTargetEditPart() instanceof NodeContainerPart)) {
        for (        IExtendedNodeHandler hander : ExtendedNodeManager.getExtendedNodeHandler()) {
          factory=hander.getCreationFactory(element);
          if (factory != null) {
            return factory;
          }
        }
      }
    }
  }
  return factory;
}

Fixed version (ground truth):
@Override protected CreationFactory getFactory(Object template){
  CreationFactory factory=super.getFactory(template);
  if (factory == null) {
    if (template != null && template instanceof IStructuredSelection) {
      Object element=((IStructuredSelection)template).getFirstElement();
      if (element != null && element instanceof PaletteEditPart) {
        Object model=((PaletteEditPart)element).getModel();
        if (model != null && model instanceof ToolEntry) {
          return (CreationFactory)((ToolEntry)model).getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY);
        }
      }
 else       if (!(getTargetEditPart() instanceof NodeContainerPart) && editor.getParent() != null) {
        for (        IExtendedNodeHandler hander : ExtendedNodeManager.getExtendedNodeHandler()) {
          factory=hander.getCreationFactory(element,editor.getParent().getEditorId());
          if (factory != null) {
            return factory;
          }
        }
      }
    }
  }
  return factory;
}
Program: 120352
Project: 120352
Buggy source:
@Override protected void close(boolean closing){
  if (!closed) {
    if (closing && mode == 1) {
      streamBuffer.buffer=null;
      rowBuffer.buffer=null;
    }
    try {
      if (initialized && mode == 0) {
        scanner.close();
      }
 else       if (initialized) {
        inputStream.close();
      }
    }
 catch (    Exception e) {
    }
    inputStream=null;
    closed=true;
  }
}

Fixed version (ground truth):
@Override protected void close(boolean closing){
  if (!closed) {
    if (closing && mode == 1) {
      streamBuffer.buffer=null;
      rowBuffer.buffer=null;
    }
    try {
      if (initialized && scanner != null) {
        scanner.close();
      }
 else       if (initialized) {
        inputStream.close();
      }
    }
 catch (    Exception e) {
    }
    inputStream=null;
    closed=true;
  }
}
Program: 120354
Project: 120354
Buggy source:
public static InputStreamMerger bulkload(String url,String cluster,String concept,String dataModel,boolean validate,boolean smartPK,String username,String password,String transactionId,String universe,AtomicInteger startedBulkloadCount){
  InputStreamMerger merger=new InputStreamMerger();
  Runnable loadRunnable=new AsyncLoadRunnable(url,cluster,concept,dataModel,validate,smartPK,merger,username,password,transactionId,universe,startedBulkloadCount);
  Thread loadThread=new Thread(loadRunnable);
  loadThread.start();
  return merger;
}

Fixed version (ground truth):
public static InputStreamMerger bulkload(String url,String cluster,String concept,String dataModel,boolean validate,boolean smartPK,String username,String password,String transactionId,String universe,AtomicInteger startedBulkloadCount){
  InputStreamMerger merger=new InputStreamMerger();
  Runnable loadRunnable=new AsyncLoadRunnable(url,cluster,concept,dataModel,validate,smartPK,merger,username,password,transactionId,universe,startedBulkloadCount);
  Thread loadThread=new Thread(loadRunnable);
  loadThread.start();
  merger.setConsumerThread(loadThread);
  return merger;
}
Program: 120355
Project: 120355
Buggy source:
/** 
 * Create a input stream merger with custom values.
 * @param capacity Input stream buffer will never exceed <code>capacity</code>. {@link Integer#MAX_VALUE} is equivalentto infinite capacity.
 * @param strategy Allow customization of "warm up" time. Can allow initial buffering before consumers can actuallyconsume data.
 * @see NoWarmUpStrategy
 * @see ThresholdWarmUpStrategy
 */
public InputStreamMerger(int capacity,WarmUpStrategy strategy){
  if (capacity <= 0) {
    throw new IllegalArgumentException("String_Node_Str" + capacity + "String_Node_Str");
  }
  inputStreamBuffer=new LinkedBlockingQueue<InputStream>(capacity);
  warmUpStrategy=strategy;
}

Fixed version (ground truth):
/** 
 * Create a input stream merger with custom values.
 * @param capacity Input stream buffer will never exceed <code>capacity</code>. {@link Integer#MAX_VALUE} is equivalentto infinite capacity.
 * @param warmUpStrategy Allow customization of "warm up" time. Can allow initial buffering before consumers can actuallyconsume data.
 * @see NoWarmUpStrategy
 * @see ThresholdWarmUpStrategy
 */
public InputStreamMerger(int capacity,WarmUpStrategy warmUpStrategy){
  if (capacity <= 0) {
    throw new IllegalArgumentException("String_Node_Str" + capacity + "String_Node_Str");
  }
  inputStreamBuffer=new LinkedBlockingQueue<InputStream>(capacity);
  this.warmUpStrategy=warmUpStrategy;
  this.consumeStrategy=new FinishedRead(hasFinishedRead);
}
Program: 120356
Project: 120356
Buggy source:
private void moveToNextInputStream() throws IOException {
  if (hasFinishedRead.get() && isClosed) {
    return;
  }
  throwLastFailure();
  while (!warmUpStrategy.isReady(this) || (inputStreamBuffer.isEmpty() && !isClosed)) {
synchronized (consumerMonitor) {
      try {
        debug("String_Node_Str" + warmUpStrategy.isReady(this) + "String_Node_Str");
        consumerMonitor.wait(1000);
        debug("String_Node_Str");
      }
 catch (      InterruptedException e) {
        throw new RuntimeException(e);
      }
      if (isClosed) {
        break;
      }
    }
  }
  if (!inputStreamBuffer.isEmpty()) {
    if (currentStream != null) {
      currentStream.close();
    }
    currentStream=inputStreamBuffer.poll();
  }
 else {
    currentStream=null;
    hasFinishedRead.set(true);
  }
synchronized (producerMonitor) {
    producerMonitor.notifyAll();
  }
  debug("String_Node_Str" + inputStreamBuffer.size());
}

Fixed version (ground truth):
private void moveToNextInputStream() throws IOException {
  if (consumeStrategy.isConsumed() && isClosed) {
    return;
  }
  throwLastFailure();
  while (!warmUpStrategy.isReady(this) || (inputStreamBuffer.isEmpty() && !isClosed)) {
synchronized (consumerMonitor) {
      try {
        debug("String_Node_Str" + warmUpStrategy.isReady(this) + "String_Node_Str");
        consumerMonitor.wait(1000);
        debug("String_Node_Str");
      }
 catch (      InterruptedException e) {
        throw new RuntimeException(e);
      }
      if (isClosed) {
        break;
      }
    }
  }
  if (!inputStreamBuffer.isEmpty()) {
    if (currentStream != null) {
      currentStream.close();
    }
    currentStream=inputStreamBuffer.poll();
  }
 else {
    currentStream=null;
    hasFinishedRead.set(true);
  }
synchronized (producerMonitor) {
    producerMonitor.notifyAll();
  }
  debug("String_Node_Str" + inputStreamBuffer.size());
}
Program: 120357
Project: 120357
Buggy source:
/** 
 * <p> Close this stream and perform some checks: <ul> <li>Mark this stream as closed (no more calls to   {@link #push(java.io.InputStream)} are allowed)</li> <li>Closes any remaining stream pushed to this stream</li> </ul></p> <p> Calling this method wakes up any thread blocked on  {@link #read()} </p> <p> Wait till all streams pushedto this stream (and stored in <code>inputStreamBuffer</code>) are processed by a reader. </p> <p> When this method exits, the buffer is empty and the last stream in buffer is fully read (i.e. until read() returns -1). </p>
 * @throws IOException In case at least one stream in buffer hasn't been read.
 * @see java.io.InputStream#close()
 */
@Override public void close() throws IOException {
  super.close();
  isClosed=true;
  warmUpStrategy=NoWarmUpStrategy.INSTANCE;
synchronized (consumerMonitor) {
    consumerMonitor.notifyAll();
  }
  debug("String_Node_Str" + inputStreamBuffer.size());
  debug("String_Node_Str" + hasFinishedRead);
  while (!inputStreamBuffer.isEmpty() && !hasFinishedRead.get()) {
    try {
      debug("String_Node_Str" + inputStreamBuffer.size() + "String_Node_Str");
synchronized (exhaustLock) {
        exhaustLock.wait(1000);
      }
      throwLastFailure();
      debug("String_Node_Str");
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  throwLastFailure();
  debug("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * <p> Close this stream and perform some checks: <ul> <li>Mark this stream as closed (no more calls to   {@link #push(java.io.InputStream)} are allowed)</li> <li>Closes any remaining stream pushed to this stream</li> </ul></p> <p> Calling this method wakes up any thread blocked on  {@link #read()} </p> <p> Wait till all streams pushedto this stream (and stored in <code>inputStreamBuffer</code>) are processed by a reader. </p> <p> When this method exits, the buffer is empty and the last stream in buffer is fully read (i.e. until read() returns -1). </p> <p> <b>Note:</b> if  {@link #setConsumerThread(Thread)} was previously called, this method will wait forthe death of consumer before returning.</p>
 * @throws IOException In case at least one stream in buffer hasn't been read.
 * @see java.io.InputStream#close()
 */
@Override public void close() throws IOException {
  super.close();
  isClosed=true;
  warmUpStrategy=NoWarmUpStrategy.INSTANCE;
synchronized (consumerMonitor) {
    consumerMonitor.notifyAll();
  }
  debug("String_Node_Str" + inputStreamBuffer.size());
  debug("String_Node_Str" + consumeStrategy.isConsumed());
  while (!inputStreamBuffer.isEmpty() || !consumeStrategy.isConsumed()) {
    try {
      debug("String_Node_Str" + inputStreamBuffer.size() + "String_Node_Str"+ consumeStrategy.isConsumed()+ "String_Node_Str");
synchronized (exhaustLock) {
        exhaustLock.wait(200);
      }
      throwLastFailure();
      debug("String_Node_Str");
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  throwLastFailure();
  debug("String_Node_Str");
}
Program: 120359
Project: 120359
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  boolean select=true;
  if (element instanceof RepositoryNode) {
    select=selectRepositoryNode(viewer,(RepositoryNode)element);
  }
  if (select) {
    for (    IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
      boolean exportFilter=nodeHandler.exportFilter(viewer,parentElement,element);
      if (!exportFilter) {
        return exportFilter;
      }
    }
  }
  return select;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  boolean select=true;
  if (element instanceof RepositoryNode) {
    select=selectRepositoryNode(viewer,(RepositoryNode)element);
  }
  if (select) {
    for (    IRepositoryReviewFilter nodeHandler : RepositoryContentManager.getRepositoryReviewFilters()) {
      boolean exportFilter=nodeHandler.filter(viewer,parentElement,element,"String_Node_Str");
      if (!exportFilter) {
        return exportFilter;
      }
    }
  }
  return select;
}
Program: 120363
Project: 120363
Buggy source:
@Override protected void close(boolean closing){
  if (!closed) {
    if (closing && mode == 1) {
      streamBuffer.buffer=null;
      rowBuffer.buffer=null;
    }
    try {
      if (initialized && mode == 0) {
        scanner.close();
      }
 else       if (initialized) {
        inputStream.close();
      }
    }
 catch (    Exception e) {
    }
    inputStream=null;
    closed=true;
  }
}

Fixed version (ground truth):
@Override protected void close(boolean closing){
  if (!closed) {
    if (closing && mode == 1) {
      streamBuffer.buffer=null;
      rowBuffer.buffer=null;
    }
    try {
      if (initialized && scanner != null) {
        scanner.close();
      }
 else       if (initialized) {
        inputStream.close();
      }
    }
 catch (    Exception e) {
    }
    inputStream=null;
    closed=true;
  }
}
Program: 120364
Project: 120364
Buggy source:
public void firePropertyChange(String property,Object oldValue,Object newValue){
  if (pcsDelegate.hasListeners(property)) {
    pcsDelegate.firePropertyChange(property,oldValue,newValue);
  }
}

Fixed version (ground truth):
@Override public void firePropertyChange(String property,Object oldValue,Object newValue){
  if (pcsDelegate.hasListeners(property)) {
    pcsDelegate.firePropertyChange(property,oldValue,newValue);
  }
}
Program: 120365
Project: 120365
Buggy source:
public boolean isLastMessageEndWithCR(){
  int i=messages.size() - 1;
  if (i >= 0) {
    IProcessMessage processMessage=(IProcessMessage)messages.toArray()[i];
    return processMessage.getContent().endsWith("String_Node_Str");
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean isLastMessageEndWithCR(){
  int i=messages.size() - 1;
  if (i >= 0) {
    IProcessMessage processMessage=(IProcessMessage)messages.toArray()[i];
    return processMessage.getContent().endsWith("String_Node_Str");
  }
 else {
    return false;
  }
}
Program: 120366
Project: 120366
Buggy source:
public void addDebugResultToConsole(IProcessMessage debugResultMessage){
synchronized (messages) {
    if (messages.isFull()) {
      messages.remove();
    }
    messages.add(debugResultMessage);
    firePropertyChange(PROP_DEBUG_MESSAGE_ADD,null,debugResultMessage);
  }
}

Fixed version (ground truth):
@Override public void addDebugResultToConsole(IProcessMessage debugResultMessage){
synchronized (messages) {
    if (messages.isFull()) {
      messages.remove();
    }
    messages.add(debugResultMessage);
    firePropertyChange(PROP_DEBUG_MESSAGE_ADD,null,debugResultMessage);
  }
}
Program: 120367
Project: 120367
Buggy source:
public synchronized void addPropertyChangeListener(PropertyChangeListener l){
  if (l == null) {
    throw new IllegalArgumentException();
  }
  pcsDelegate.addPropertyChangeListener(l);
}

Fixed version (ground truth):
@Override public synchronized void addPropertyChangeListener(PropertyChangeListener l){
  if (l == null) {
    throw new IllegalArgumentException();
  }
  pcsDelegate.addPropertyChangeListener(l);
}
Program: 120368
Project: 120368
Buggy source:
public synchronized void removePropertyChangeListener(PropertyChangeListener l){
  if (l != null) {
    pcsDelegate.removePropertyChangeListener(l);
  }
}

Fixed version (ground truth):
@Override public synchronized void removePropertyChangeListener(PropertyChangeListener l){
  if (l != null) {
    pcsDelegate.removePropertyChangeListener(l);
  }
}
Program: 120369
Project: 120369
Buggy source:
public void clearMessages(){
synchronized (messages) {
    messages.clear();
    firePropertyChange(PROP_MESSAGE_CLEAR,messages,null);
  }
}

Fixed version (ground truth):
@Override public void clearMessages(){
synchronized (messages) {
    messages.clear();
    firePropertyChange(PROP_MESSAGE_CLEAR,messages,null);
  }
}
Program: 120370
Project: 120370
Buggy source:
public Collection<IProcessMessage> getMessages(){
  return (Collection<IProcessMessage>)messages;
}

Fixed version (ground truth):
@Override public Collection<IProcessMessage> getMessages(){
  return messages;
}
Program: 120371
Project: 120371
Buggy source:
public void addMessage(IProcessMessage message){
synchronized (messages) {
    if (messages.isFull()) {
      messages.remove();
    }
    messages.add(message);
    firePropertyChange(PROP_MESSAGE_ADD,null,message);
  }
}

Fixed version (ground truth):
@Override public void addMessage(IProcessMessage message){
synchronized (messages) {
    if (messages.isFull()) {
      messages.remove();
    }
    messages.add(message);
    firePropertyChange(PROP_MESSAGE_ADD,null,message);
  }
}
Program: 120373
Project: 120373
Buggy source:
protected void appendToConsole(final IProcessMessage message){
  messagesToDisplay.add(message);
  if (isConsoleReady()) {
    setConsoleReady(false);
    getDisplay().asyncExec(new Runnable(){
      @Override public void run(){
        List<IProcessMessage> messages=new ArrayList<IProcessMessage>();
        IProcessMessage msg=messagesToDisplay.poll();
        if (msg != null) {
          messages.add(msg);
          doAppendToConsole(messages);
          scrollToEnd();
        }
        setConsoleReady(true);
      }
    }
);
  }
}

Fixed version (ground truth):
protected void appendToConsole(final IProcessMessage message){
  newMessages.add(message);
}
Program: 120374
Project: 120374
Buggy source:
@Override public void refreshComponentView(Item item){
  try {
    IWorkbenchWindow activeWorkbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPage activePage=activeWorkbenchWindow.getActivePage();
    IEditorReference[] editors=activePage.getEditorReferences();
    for (    IEditorReference er : editors) {
      IEditorPart part=er.getEditor(false);
      if (part instanceof AbstractMultiPageTalendEditor) {
        AbstractMultiPageTalendEditor editor=(AbstractMultiPageTalendEditor)part;
        CommandStack stack=(CommandStack)editor.getTalendEditor().getAdapter(CommandStack.class);
        if (stack != null) {
          IProcess process=editor.getProcess();
          for (          final INode processNode : process.getGraphicalNodes()) {
            if (processNode instanceof Node) {
              checkRepository((Node)processNode,item,stack);
            }
          }
        }
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
@Override public void refreshComponentView(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(ComponentSettingsView.ID);
  if (view == null) {
    return;
  }
  if (view != null && view instanceof ComponentSettingsView) {
    ComponentSettingsView settingView=(ComponentSettingsView)view;
    Element element=settingView.getElement();
    if (element != null) {
      settingView.cleanDisplay();
      settingView.setElement(element);
    }
  }
  List<ComponentSettingsView> otherViews=JobTemplateViewsAndProcessUtil.getInstance().getAllViews();
  if (otherViews == null || otherViews.isEmpty()) {
    return;
  }
  for (  ComponentSettingsView v : otherViews) {
    if (v.getParent() != null && !v.getParent().isDisposed()) {
      Element elem=v.getElement();
      if (elem != null) {
        v.cleanDisplay();
        v.setElement(elem);
      }
    }
  }
}
Program: 120375
Project: 120375
Buggy source:
/** 
 * dev Comment method "sortColumn".
 * @param columns
 * @return
 */
private static List<MetadataColumn> sortColumn(Collection<MetadataColumn> columns){
  List<MetadataColumn> sortColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> sysColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> grayColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> divColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> norColumns=new ArrayList<MetadataColumn>();
  for (  MetadataColumn column : columns) {
    if (column.isSynchronised()) {
      sysColumns.add(column);
      continue;
    }
    if (column.isDivergency()) {
      divColumns.add(column);
      continue;
    }
    if (column.getLabel() == null || "String_Node_Str".equals(column.getLabel())) {
      grayColumns.add(column);
      continue;
    }
    norColumns.add(column);
  }
  MetadataColumnComparator metadataColumnComparator=new MetadataColumnComparator();
  Collections.sort(norColumns,metadataColumnComparator);
  Collections.sort(sysColumns,metadataColumnComparator);
  Collections.sort(divColumns,metadataColumnComparator);
  Collections.sort(grayColumns,metadataColumnComparator);
  sortColumns.addAll(norColumns);
  sortColumns.addAll(sysColumns);
  sortColumns.addAll(divColumns);
  sortColumns.addAll(grayColumns);
  return sortColumns;
}

Fixed version (ground truth):
/** 
 * dev Comment method "sortColumn".
 * @param columns
 * @return
 */
private static List<MetadataColumn> sortColumn(Collection<MetadataColumn> columns){
  List<MetadataColumn> sortColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> sysColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> grayColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> divColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> norColumns=new ArrayList<MetadataColumn>();
  for (  MetadataColumn column : columns) {
    if (column.isSynchronised()) {
      sysColumns.add(column);
      continue;
    }
    if (column.isDivergency()) {
      divColumns.add(column);
      continue;
    }
    if (column.getLabel() == null || "String_Node_Str".equals(column.getLabel())) {
      grayColumns.add(column);
      continue;
    }
    norColumns.add(column);
  }
  MetadataColumnComparator metadataColumnComparator=new MetadataColumnComparator();
  Collections.sort(sysColumns,metadataColumnComparator);
  Collections.sort(divColumns,metadataColumnComparator);
  Collections.sort(grayColumns,metadataColumnComparator);
  sortColumns.addAll(norColumns);
  sortColumns.addAll(sysColumns);
  sortColumns.addAll(divColumns);
  sortColumns.addAll(grayColumns);
  return sortColumns;
}
Program: 120376
Project: 120376
Buggy source:
/** 
 * dev Comment method "sortColumn".
 * @param columns
 * @return
 */
private static List<MetadataColumn> sortColumn(Collection<MetadataColumn> columns){
  List<MetadataColumn> sortColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> sysColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> grayColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> divColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> norColumns=new ArrayList<MetadataColumn>();
  for (  MetadataColumn column : columns) {
    if (column.isSynchronised()) {
      sysColumns.add(column);
      continue;
    }
    if (column.isDivergency()) {
      divColumns.add(column);
      continue;
    }
    if (column.getLabel() == null || "String_Node_Str".equals(column.getLabel())) {
      grayColumns.add(column);
      continue;
    }
    norColumns.add(column);
  }
  MetadataColumnComparator metadataColumnComparator=new MetadataColumnComparator();
  Collections.sort(norColumns,metadataColumnComparator);
  Collections.sort(sysColumns,metadataColumnComparator);
  Collections.sort(divColumns,metadataColumnComparator);
  Collections.sort(grayColumns,metadataColumnComparator);
  sortColumns.addAll(norColumns);
  sortColumns.addAll(sysColumns);
  sortColumns.addAll(divColumns);
  sortColumns.addAll(grayColumns);
  return sortColumns;
}

Fixed version (ground truth):
/** 
 * dev Comment method "sortColumn".
 * @param columns
 * @return
 */
private static List<MetadataColumn> sortColumn(Collection<MetadataColumn> columns){
  List<MetadataColumn> sortColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> sysColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> grayColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> divColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> norColumns=new ArrayList<MetadataColumn>();
  for (  MetadataColumn column : columns) {
    if (column.isSynchronised()) {
      sysColumns.add(column);
      continue;
    }
    if (column.isDivergency()) {
      divColumns.add(column);
      continue;
    }
    if (column.getLabel() == null || "String_Node_Str".equals(column.getLabel())) {
      grayColumns.add(column);
      continue;
    }
    norColumns.add(column);
  }
  MetadataColumnComparator metadataColumnComparator=new MetadataColumnComparator();
  Collections.sort(sysColumns,metadataColumnComparator);
  Collections.sort(divColumns,metadataColumnComparator);
  Collections.sort(grayColumns,metadataColumnComparator);
  sortColumns.addAll(norColumns);
  sortColumns.addAll(sysColumns);
  sortColumns.addAll(divColumns);
  sortColumns.addAll(grayColumns);
  return sortColumns;
}
Program: 120381
Project: 120381
Buggy source:
@Override public void add(IFigure figure,Object constraint,int index){
  super.add(figure,constraint,index);
  GreenRectangle grc=null;
  for (  Object o : this.getChildren()) {
    if (o instanceof GreenRectangle) {
      grc=(GreenRectangle)o;
    }
  }
  if (grc != null) {
    getChildren().remove(grc);
    getChildren().add(0,grc);
  }
}

Fixed version (ground truth):
@Override public void add(IFigure figure,Object constraint,int index){
  if (figure instanceof GreenRectangle) {
    super.add(figure,constraint,0);
  }
 else {
    super.add(figure,constraint,index);
  }
}
Program: 120382
Project: 120382
Buggy source:
@Override public void paint(Graphics graphics){
  graphics.setAlpha(100);
  if (errorFigure.isVisible()) {
    errorFigure.setLocation(jobletContainer.getErrorLocation());
  }
  if (warningFigure.isVisible()) {
    warningFigure.setLocation(jobletContainer.getWarningLocation());
  }
  super.paint(graphics);
  refreshNodes(false);
}

Fixed version (ground truth):
@Override public void paint(Graphics graphics){
  graphics.setAlpha(255);
  if (errorFigure.isVisible()) {
    errorFigure.setLocation(jobletContainer.getErrorLocation());
  }
  if (warningFigure.isVisible()) {
    warningFigure.setLocation(jobletContainer.getWarningLocation());
  }
  Iterator it=getChildren().iterator();
  if (!jobletContainer.getNode().isJoblet()) {
    while (it.hasNext()) {
      Figure fig=(Figure)it.next();
      if (mrFigures.isEmpty() && (fig instanceof GreenRectangle || fig instanceof RoundedRectangle)) {
        it.remove();
        continue;
      }
    }
  }
  super.paint(graphics);
  refreshNodes(false);
}