nus-yam/ex-repair huggingface dataset:
Program: 102368
Project: 102368
Buggy source:
/** 
 * Retrieves the tagged resource <code>Annotation</code> object referenced to a <code>ModelResource</code>'s <code>ModelAnnotation</code>
 * @param modelResource the <code>ModelResource</code>. may not be null
 * @param forceCreate forces creation of the annotation if it does not exist.
 * @return the <code>Annotation</code>
 * @throws ModelWorkspaceException
 */
public Annotation getResourceAnnotation(final ModelResource modelResource,final boolean forceCreate) throws ModelWorkspaceException {
  CoreArgCheck.isNotNull(modelResource,"String_Node_Str");
  Annotation annotation=modelResource.getAnnotations().getAnnotation(modelResource.getModelAnnotation());
  if (annotation == null && forceCreate) {
    annotation=ModelResourceContainerFactory.createNewAnnotation(modelResource.getModelAnnotation());
    ModelContents contents=ModelerCore.getModelEditor().getModelContents(modelResource);
    AnnotationContainer ac=contents.getAnnotationContainer(false);
    if (ac != null)     annotation.setAnnotationContainer(ac);
  }
  return annotation;
}

Fixed version (ground truth):
/** 
 * Retrieves the tagged resource <code>Annotation</code> object referenced to a <code>ModelResource</code>'s <code>ModelAnnotation</code>
 * @param modelResource the <code>ModelResource</code>. may not be null
 * @param forceCreate forces creation of the annotation if it does not exist.
 * @return the <code>Annotation</code>
 * @throws ModelWorkspaceException
 */
public Annotation getResourceAnnotation(final ModelResource modelResource,final boolean forceCreate) throws ModelWorkspaceException {
  CoreArgCheck.isNotNull(modelResource,"String_Node_Str");
  Annotation annotation=modelResource.getAnnotations().getAnnotation(modelResource.getModelAnnotation());
  if (annotation == null && forceCreate) {
    annotation=ModelResourceContainerFactory.createNewAnnotation(modelResource.getModelAnnotation(),modelResource.getEmfResource());
    ModelContents contents=ModelerCore.getModelEditor().getModelContents(modelResource);
    AnnotationContainer ac=contents.getAnnotationContainer(false);
    if (ac != null)     annotation.setAnnotationContainer(ac);
  }
  return annotation;
}
Program: 102369
Project: 102369
Buggy source:
final void fileChanged(final IResourceDelta delta){
  if ((delta.getFlags() & (IResourceDelta.REPLACED | IResourceDelta.MOVED_FROM | IResourceDelta.MOVED_TO)) > 0)   throw new UnsupportedOperationException(toString(delta));
  final int kind=delta.getKind();
  if (kind == IResourceDelta.REMOVED)   setSynchronization(Synchronization.NotApplicable);
 else   if (kind == IResourceDelta.ADDED || kind == IResourceDelta.CHANGED) {
    if (getChecksum() != computeChecksum((IFile)delta.getResource()))     setSynchronization(Synchronization.NotSynchronized);
 else     setSynchronization(Synchronization.Synchronized);
  }
 else   throw new UnsupportedOperationException(toString(delta));
}

Fixed version (ground truth):
final void fileChanged(final IResourceDelta delta){
  if ((delta.getFlags() & (IResourceDelta.REPLACED | IResourceDelta.MOVED_FROM | IResourceDelta.MOVED_TO)) > 0)   return;
  final int kind=delta.getKind();
  if (kind == IResourceDelta.REMOVED)   setSynchronization(Synchronization.NotApplicable);
 else   if (kind == IResourceDelta.ADDED || kind == IResourceDelta.CHANGED) {
    if (getChecksum() != computeChecksum((IFile)delta.getResource()))     setSynchronization(Synchronization.NotSynchronized);
 else     setSynchronization(Synchronization.Synchronized);
  }
 else   throw new UnsupportedOperationException(toString(delta));
}
Program: 102370
Project: 102370
Buggy source:
public void resourceChanged(final IResourceChangeEvent event){
  if (event.getDelta() == null)   return;
  final IResourceDelta delta=event.getDelta().findMember(name);
  if (delta == null)   return;
  fileChanged(delta);
}

Fixed version (ground truth):
public void resourceChanged(final IResourceChangeEvent event){
  final IResourceDelta delta=event.getDelta() == null ? null : event.getDelta().findMember(name);
  if (delta == null)   return;
  fileChanged(delta);
}
Program: 102371
Project: 102371
Buggy source:
/** 
 * @param description (never <code>null</code>)
 */
public final void setDescription(String description){
  if (StringUtilities.isEmpty(description))   description=StringUtilities.EMPTY_STRING;
  final String oldDescription=this.description.get();
  if (StringUtilities.equals(description,oldDescription))   return;
  this.description.set(description);
  vdb.setModified(this,Vdb.ENTRY_DESCRIPTION,oldDescription,description);
}

Fixed version (ground truth):
/** 
 * @param description (never <code>null</code>)
 */
public final void setDescription(String description){
  if (StringUtilities.isEmpty(description))   description=null;
  final String oldDescription=this.description.get();
  if (StringUtilities.equals(description,oldDescription))   return;
  this.description.set(description);
  vdb.setModified(this,Vdb.ENTRY_DESCRIPTION,oldDescription,description);
}
Program: 102372
Project: 102372
Buggy source:
VdbModelEntry(final Vdb vdb,final ModelElement element,final IProgressMonitor monitor){
  super(vdb,element,monitor);
  this.element=element;
  type=ModelType.get(element.getType());
  visible.set(element.isVisible());
  for (  final SourceElement source : element.getSources()) {
    this.source.set(source.getName());
    translator.set(source.getTranslatorName());
    jndiName.set(source.getJndiName());
    break;
  }
  String desc=StringUtilities.EMPTY_STRING;
  if (element.getDescription() != null) {
    desc=element.getDescription();
  }
  description.set(desc);
  for (  final ProblemElement problem : element.getProblems())   problems.add(new Problem(problem));
  boolean builtIn=false;
  String indexName=null;
  for (  final PropertyElement property : element.getProperties()) {
    final String name=property.getName();
    if (ModelElement.BUILT_IN.equals(name))     builtIn=Boolean.parseBoolean(property.getValue());
 else     if (ModelElement.INDEX_NAME.equals(name))     indexName=property.getValue();
  }
  this.builtIn=builtIn;
  this.indexName=indexName;
}

Fixed version (ground truth):
VdbModelEntry(final Vdb vdb,final ModelElement element,final IProgressMonitor monitor){
  super(vdb,element,monitor);
  this.element=element;
  type=ModelType.get(element.getType());
  visible.set(element.isVisible());
  for (  final SourceElement source : element.getSources()) {
    this.source.set(source.getName());
    translator.set(source.getTranslatorName());
    jndiName.set(source.getJndiName());
    break;
  }
  for (  final ProblemElement problem : element.getProblems())   problems.add(new Problem(problem));
  boolean builtIn=false;
  String indexName=null;
  for (  final PropertyElement property : element.getProperties()) {
    final String name=property.getName();
    if (ModelElement.BUILT_IN.equals(name))     builtIn=Boolean.parseBoolean(property.getValue());
 else     if (ModelElement.INDEX_NAME.equals(name))     indexName=property.getValue();
  }
  this.builtIn=builtIn;
  this.indexName=indexName;
}
Program: 102373
Project: 102373
Buggy source:
/** 
 * Create the child nodes for this type of DisplayNode.
 */
private void createChildNodes(){
  childNodeList=new ArrayList();
  JoinPredicate joinPredicate=(JoinPredicate)this.getLanguageObject();
  FromClause clause=joinPredicate.getLeftClause();
  if (clause == null) {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,ERROR));
  }
 else {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,clause));
  }
  clause=joinPredicate.getRightClause();
  if (clause == null) {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,ERROR));
  }
 else {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,clause));
  }
  Iterator iter=joinPredicate.getJoinCriteria().iterator();
  while (iter.hasNext()) {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,iter.next()));
  }
  createDisplayNodeList();
}

Fixed version (ground truth):
/** 
 * Create the child nodes for this type of DisplayNode.
 */
private void createChildNodes(){
  childNodeList=new ArrayList();
  JoinPredicate joinPredicate=(JoinPredicate)this.getLanguageObject();
  FromClause clause=joinPredicate.getLeftClause();
  if (clause == null) {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,ERROR));
  }
 else {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,clause));
  }
  clause=joinPredicate.getRightClause();
  if (clause == null) {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,ERROR));
  }
 else {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,clause));
  }
  Iterator iter=joinPredicate.getJoinCriteria().iterator();
  while (iter.hasNext()) {
    childNodeList.add(DisplayNodeFactory.createDisplayNode(this,clause));
  }
  createDisplayNodeList();
}
Program: 102375
Project: 102375
Buggy source:
/** 
 * Used by the   {@link #computeModelResources(IContainer,ArrayList)} method.
 * @param resource
 * @return
 */
protected ModelResource createModelResource(final IFile resource){
  ModelWorkspaceItem parent=findParent(resource);
  return new ModelResourceImpl(parent,resource.getName());
}

Fixed version (ground truth):
/** 
 * Used by the   {@link #computeModelResources(IContainer,ArrayList)} method.
 * @param resource
 * @return
 */
protected ModelResource createModelResource(final IFile resource){
  ModelWorkspaceItem parent=findParent(resource);
  if (!ModelUtil.isVdbArchiveFile(resource)) {
    return new ModelResourceImpl(parent,resource.getName(),false);
  }
  return new ModelResourceImpl(parent,resource.getName());
}
Program: 102377
Project: 102377
Buggy source:
/** 
 * @since 4.0
 */
public void update(){
  if (pageControl.isDisposed())   return;
  final Vdb vdb=this.editor.getVdb();
  Severity severity=null;
  for (  VdbModelEntry entry : vdb.getModelEntries()) {
    if (!entry.getErrors().isEmpty()) {
      severity=Severity.ERROR_LITERAL;
      break;
    }
    if (severity == null && !entry.getWarnings().isEmpty())     severity=Severity.WARNING_LITERAL;
  }
  String statusText=severity.getName();
  if (severity.getValue() == Severity.ERROR) {
    statusText=statusText + ' ' + STATUS_ERROR_MESSAGE;
  }
  this.statusLabel.setText(statusText);
  this.statusLabel.setImage(VdbEditor.getStatusImage(severity));
  reloadingDescription=true;
  String description=editor.getVdb().getDescription();
  if (description == null) {
    description="String_Node_Str";
  }
  if (!description.equals(this.textEditor.getText())) {
    this.textEditor.setText(description);
  }
  reloadingDescription=false;
  setEnabledState();
}

Fixed version (ground truth):
/** 
 * @since 4.0
 */
public void update(){
  if (pageControl.isDisposed())   return;
  final Vdb vdb=this.editor.getVdb();
  Severity severity=Severity.OK_LITERAL;
  for (  VdbModelEntry entry : vdb.getModelEntries()) {
    if (!entry.getErrors().isEmpty()) {
      severity=Severity.ERROR_LITERAL;
      break;
    }
    if (severity == null && !entry.getWarnings().isEmpty())     severity=Severity.WARNING_LITERAL;
  }
  String statusText=severity.getName();
  if (severity.getValue() == Severity.ERROR) {
    statusText=statusText + ' ' + STATUS_ERROR_MESSAGE;
  }
  this.statusLabel.setText(statusText);
  this.statusLabel.setImage(VdbEditor.getStatusImage(severity));
  reloadingDescription=true;
  String description=editor.getVdb().getDescription();
  if (description == null) {
    description="String_Node_Str";
  }
  if (!description.equals(this.textEditor.getText())) {
    this.textEditor.setText(description);
  }
  reloadingDescription=false;
  setEnabledState();
}
Program: 102378
Project: 102378
Buggy source:
private void clean(){
  errors.clear();
  warnings.clear();
  for (  final VdbModelEntry entry : dependsUpon) {
    entry.dependentOf.remove(this);
    if (entry.isBuiltIn())     entry.dispose();
  }
  dependsUpon.clear();
}

Fixed version (ground truth):
private void clean(){
  if (this.errors == null) {
    this.errors=new HashSet<Diagnostic>();
  }
  errors.clear();
  if (this.warnings == null) {
    this.warnings=new HashSet<Diagnostic>();
  }
  warnings.clear();
  if (dependsUpon == null) {
    dependsUpon=new CopyOnWriteArraySet<VdbModelEntry>();
  }
  if (dependentOf == null) {
    dependentOf=new CopyOnWriteArraySet<VdbModelEntry>();
  }
  for (  final VdbModelEntry entry : dependsUpon) {
    entry.dependentOf.remove(this);
    if (entry.isBuiltIn())     entry.dispose();
  }
  dependsUpon.clear();
}
Program: 102379
Project: 102379
Buggy source:
public String getText(Connector binding){
  if (binding == null) {
    if (this.vdbContext.isReadOnly()) {
      return getString("String_Node_Str");
    }
    return getString("String_Node_Str");
  }
  return binding.getName() + "String_Node_Str" + binding.getComponentTypeID().getName();
}

Fixed version (ground truth):
public String getText(Connector binding){
  if (binding == null) {
    if (this.vdbContext.isReadOnly()) {
      return getString("String_Node_Str");
    }
    return getString("String_Node_Str");
  }
  return binding.getName();
}
Program: 102381
Project: 102381
Buggy source:
/** 
 * @param changedProperties the list of properties that are being changed (never <code>null</code> or empty)
 * @throws Exception if there is a problem changing the properties
 * @since 7.0
 */
public void setProperties(Properties changedProperties) throws Exception {
  ArgCheck.isNotEmpty(changedProperties.entrySet(),"String_Node_Str");
  this.type.getAdmin().setProperties(this,changedProperties);
  Properties props=getProperties();
  for (  String name : changedProperties.stringPropertyNames()) {
    props.setProperty(name,changedProperties.getProperty(name));
  }
}

Fixed version (ground truth):
/** 
 * @param changedProperties the list of properties that are being changed (never <code>null</code> or empty)
 * @throws Exception if there is a problem changing the properties
 * @since 7.0
 */
public void setProperties(Properties changedProperties) throws Exception {
  ArgCheck.isNotNull(changedProperties,"String_Node_Str");
  Set<Entry<Object,Object>> entrySet=changedProperties.entrySet();
  ArgCheck.isNotEmpty(entrySet,"String_Node_Str");
  this.type.getAdmin().setProperties(this,changedProperties);
  Properties props=getProperties();
  for (  Entry<Object,Object> entry : entrySet) {
    props.setProperty((String)entry.getKey(),(String)entry.getValue());
  }
}
Program: 102382
Project: 102382
Buggy source:
/** 
 * Close the text widget and reset the editorText field.
 */
void disposeTextWidget(){
  if (textActionHandler != null)   textActionHandler.removeText(textEditor);
  if (textEditorParent != null) {
    textEditorParent.dispose();
    textEditorParent=null;
    textEditor=null;
    treeEditor.setEditor(null,null);
  }
}

Fixed version (ground truth):
/** 
 * Close the text widget and reset the editorText field.
 */
void disposeTextWidget(){
  if (textActionHandler != null)   textActionHandler.removeText(textEditor);
  if (textEditorParent != null) {
    textEditorParent.dispose();
    textEditorParent=null;
    textEditor=null;
    treeEditor.setEditor(null,null);
  }
  insureOpenEditor();
}
Program: 102383
Project: 102383
Buggy source:
/** 
 * This method is called in the run() method of AbstractAction to give the actions a hook into canceling the run at the last minute. This overrides the AbstractAction preRun() method.
 */
@Override protected boolean preRun(){
  if (requiresEditorForRun()) {
    List allSelectedEObjects=SelectionUtilities.getSelectedEObjects(getSelection());
    if (allSelectedEObjects != null && !allSelectedEObjects.isEmpty()) {
      EObject eObject=(EObject)allSelectedEObjects.get(0);
      ModelResource mr=ModelUtilities.getModelResourceForModelObject(eObject);
      if (mr != null) {
        ModelEditorManager.open(eObject,true,UiConstants.ObjectEditor.REFRESH_EDITOR_IF_OPEN);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * This method is called in the run() method of AbstractAction to give the actions a hook into canceling the run at the last minute. This overrides the AbstractAction preRun() method.
 */
@Override protected boolean preRun(){
  if (requiresEditorForRun()) {
    List allSelectedEObjects=SelectionUtilities.getSelectedEObjects(getSelection());
    if (allSelectedEObjects != null && !allSelectedEObjects.isEmpty()) {
      EObject eObject=(EObject)allSelectedEObjects.get(0);
      ModelResource mr=ModelUtilities.getModelResourceForModelObject(eObject);
      if (mr != null) {
        if (!ModelEditorManager.isOpen(eObject)) {
          ModelEditorManager.activate(mr,true);
        }
      }
    }
  }
  return true;
}
Program: 102384
Project: 102384
Buggy source:
/** 
 * Overridden to allow calling setSelection from outside the table package, this method converts the selection from EObjects to ModelRowElements and set it on the table.
 * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
 * @since 5.0.2
 */
@Override public void setSelection(final ISelection selection){
  if (this.viewer != null && SelectionUtilities.isSingleSelection(selection) && SelectionUtilities.isAllEObjects(selection)) {
    EObject eObj=SelectionUtilities.getSelectedEObject(selection);
    if (eObj != null && (eObj instanceof Operation || eObj instanceof Interface)) {
      this.viewer.setSelection(new StructuredSelection(eObj),true);
    }
  }
}

Fixed version (ground truth):
/** 
 * Overridden to allow calling setSelection from outside the table package, this method converts the selection from EObjects to ModelRowElements and set it on the table.
 * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
 * @since 5.0.2
 */
@Override public void setSelection(final ISelection selection){
}
Program: 102385
Project: 102385
Buggy source:
/** 
 * @return the <code>modeler.dqp</code> plugin's runtime workspace path or the test runtime path
 * @throws IOException if an error occurs obtaining the path
 * @since 6.0.0
 */
public static IPath getRuntimePath(){
  if (runtimePath == null) {
    if (testRuntimeDir == null) {
      runtimePath=Platform.getStateLocation(DqpPlugin.getInstance().getBundle());
    }
 else {
      runtimePath=new Path(testRuntimeDir);
    }
  }
  return (IPath)runtimePath.clone();
}

Fixed version (ground truth):
/** 
 * @return the <code>modeler.dqp</code> plugin's runtime workspace path or the test runtime path
 * @throws IOException if an error occurs obtaining the path
 * @since 6.0.0
 */
public static IPath getRuntimePath(){
  if (runtimePath == null) {
    if (testRuntimeDir == null) {
      runtimePath=DqpPlugin.getInstance().getStateLocation();
    }
 else {
      runtimePath=new Path(testRuntimeDir);
    }
  }
  return (IPath)runtimePath.clone();
}
Program: 102386
Project: 102386
Buggy source:
private IPath getRuntimePath(){
  if (this.runtimePath == null) {
    if (this.testRuntimePath == null) {
      this.runtimePath=Platform.getStateLocation(TransformationPlugin.getDefault().getBundle());
    }
 else {
      this.runtimePath=new Path(this.testRuntimePath);
    }
  }
  return (IPath)this.runtimePath.clone();
}

Fixed version (ground truth):
private IPath getRuntimePath(){
  if (this.runtimePath == null) {
    if (this.testRuntimePath == null) {
      this.runtimePath=TransformationPlugin.getDefault().getStateLocation();
    }
 else {
      this.runtimePath=new Path(this.testRuntimePath);
    }
  }
  return (IPath)this.runtimePath.clone();
}
Program: 102388
Project: 102388
Buggy source:
public ModelEditorActionContributor(){
  super();
  Util.trace(this,new StringBuffer().append("String_Node_Str").append(System.identityHashCode(this)).toString());
}

Fixed version (ground truth):
public ModelEditorActionContributor(){
  super();
  Util.trace(this,new StringBuffer().append("String_Node_Str").append(System.identityHashCode(this)).toString());
  this.actionHandlerMap=new HashMap<String,IHandlerActivation>(ModelerGlobalActionsMap.ALL_GLOBAL_ACTIONS.length);
}
Program: 102389
Project: 102389
Buggy source:
private boolean migrate(MigrationResult migrationResult) throws Exception {
  ListAccess<Space> allSpacesListAccess=spaceService.getAllSpacesWithListAccess();
  int spacesCount=allSpacesListAccess.getSize();
  if (spacesCount == 0) {
    return true;
  }
  List<Space> allSpaces=getAllSpaces(allSpacesListAccess,spacesCount);
  spacesCount=allSpaces.size();
  int numberOfThreads=spacesCount >= THREAD ? THREAD : spacesCount;
  int numberOfSpacesPerThreads=(int)Math.ceil((double)spacesCount / (double)numberOfThreads);
  migrationResult.setSpacesCount(spacesCount);
  List<Future<Boolean>> futures=new ArrayList<>();
  for (int i=0; i < numberOfThreads; i++) {
    int fromIndex=numberOfSpacesPerThreads * i;
    int toIndex=fromIndex + numberOfSpacesPerThreads;
    toIndex=toIndex > spacesCount ? spacesCount : toIndex;
    List<Space> spaces=allSpaces.subList(fromIndex,toIndex);
    Future<Boolean> future=executorService.submit(new SpaceMigrationCallable(spaces,migrationResult));
    futures.add(future);
  }
  boolean migrationCompletedSuccessfully=true;
  for (  Future<Boolean> future : futures) {
    migrationCompletedSuccessfully=migrationCompletedSuccessfully && future.get();
  }
  return migrationCompletedSuccessfully;
}

Fixed version (ground truth):
private boolean migrate(MigrationResult migrationResult) throws Exception {
  ListAccess<Space> allSpacesListAccess=spaceService.getAllSpacesWithListAccess();
  int spacesCount=allSpacesListAccess.getSize();
  if (spacesCount == 0) {
    return true;
  }
  List<Space> allSpaces=getAllSpaces(allSpacesListAccess,spacesCount);
  spacesCount=allSpaces.size();
  int numberOfThreads=spacesCount >= THREAD ? THREAD : spacesCount;
  int numberOfSpacesPerThreads=(int)Math.ceil((double)spacesCount / (double)numberOfThreads);
  migrationResult.setSpacesCount(spacesCount);
  List<Future<Boolean>> futures=new ArrayList<>();
  for (int i=0; i < numberOfThreads; i++) {
    int fromIndex=numberOfSpacesPerThreads * i;
    if (fromIndex > spacesCount) {
      break;
    }
    int toIndex=fromIndex + numberOfSpacesPerThreads;
    toIndex=toIndex > spacesCount ? spacesCount : toIndex;
    List<Space> spaces=allSpaces.subList(fromIndex,toIndex);
    Future<Boolean> future=executorService.submit(new SpaceMigrationCallable(spaces,migrationResult));
    futures.add(future);
  }
  boolean migrationCompletedSuccessfully=true;
  for (  Future<Boolean> future : futures) {
    migrationCompletedSuccessfully=migrationCompletedSuccessfully && future.get();
  }
  return migrationCompletedSuccessfully;
}
Program: 102390
Project: 102390
Buggy source:
@Override public void execute(Event<BaseUIActivity> event) throws Exception {
  WebuiRequestContext requestContext=event.getRequestContext();
  String[] likeStatus=requestContext.getRequestParameter(OBJECTID).split("String_Node_Str");
  BaseUIActivity uiActivity=event.getSource();
  uiActivity.setLikeComment(Boolean.parseBoolean(likeStatus[0]),likeStatus[1]);
  requestContext.addUIComponentToUpdateByAjax(uiActivity);
  Utils.initUserProfilePopup(uiActivity.getId());
  Utils.resizeHomePage();
}

Fixed version (ground truth):
@Override public void execute(Event<BaseUIActivity> event) throws Exception {
  WebuiRequestContext requestContext=event.getRequestContext();
  String[] likeStatus=requestContext.getRequestParameter(OBJECTID).split("String_Node_Str");
  BaseUIActivity uiActivity=event.getSource();
  uiActivity.setLikeComment(Boolean.parseBoolean(likeStatus[0]),likeStatus[1]);
  requestContext.addUIComponentToUpdateByAjax(uiActivity);
  Utils.initUserProfilePopup(uiActivity.getId());
}
Program: 102391
Project: 102391
Buggy source:
/** 
 * Gets list of existing users in a space
 * @return list of existing users
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") public List<String> getExistingUsers(){
  SpaceService spaceService=getSpaceService();
  Space space=spaceService.getSpaceById(spaceId);
  try {
    if (space == null) {
      throw new Exception("String_Node_Str" + spaceId);
    }
    String[] memberUsers=space.getMembers();
    if (memberUsers == null || memberUsers.length == 0) {
      return new ArrayList<String>();
    }
    int currentPage=iteratorExistingUsers.getCurrentPage();
    Set<String> users=new HashSet<String>(Arrays.asList(memberUsers));
    users.addAll(SpaceUtils.findMembershipUsersByGroupAndTypes(space.getGroupId(),MembershipTypeHandler.ANY_MEMBERSHIP_TYPE));
    LazyPageList<String> pageList=new LazyPageList<String>(new StringListAccess(new ArrayList<String>(users)),MEMBERS_PER_PAGE);
    iteratorExistingUsers.setPageList(pageList);
    if (this.isNewSearch()) {
      iteratorExistingUsers.setCurrentPage(FIRST_PAGE);
    }
 else {
      iteratorExistingUsers.setCurrentPage(currentPage);
    }
    this.setNewSearch(false);
    return iteratorExistingUsers.getCurrentPageData();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
    UIApplication uiApplication=context.getUIApplication();
    uiApplication.addMessage(new ApplicationMessage(MSG_ERROR_MEMBERS_LOADING,null,ApplicationMessage.ERROR));
  }
  return new ArrayList<>();
}

Fixed version (ground truth):
/** 
 * Gets list of existing users in a space
 * @return list of existing users
 */
@SuppressWarnings("String_Node_Str") public List<String> getExistingUsers(){
  SpaceService spaceService=getSpaceService();
  Space space=spaceService.getSpaceById(spaceId);
  try {
    if (space == null) {
      throw new Exception("String_Node_Str" + spaceId);
    }
    String[] memberUsers=space.getMembers();
    if (memberUsers == null || memberUsers.length == 0) {
      return new ArrayList<String>();
    }
    int currentPage=iteratorExistingUsers.getCurrentPage();
    Set<String> users=new HashSet<String>(Arrays.asList(memberUsers));
    users.addAll(SpaceUtils.findMembershipUsersByGroupAndTypes(space.getGroupId(),MembershipTypeHandler.ANY_MEMBERSHIP_TYPE));
    LazyPageList<String> pageList=new LazyPageList<String>(new StringListAccess(new ArrayList<String>(users)),MEMBERS_PER_PAGE);
    iteratorExistingUsers.setPageList(pageList);
    if (this.isNewSearch()) {
      iteratorExistingUsers.setCurrentPage(FIRST_PAGE);
    }
 else {
      iteratorExistingUsers.setCurrentPage(currentPage);
    }
    this.setNewSearch(false);
    return iteratorExistingUsers.getCurrentPageData();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
    UIApplication uiApplication=context.getUIApplication();
    uiApplication.addMessage(new ApplicationMessage(MSG_ERROR_MEMBERS_LOADING,null,ApplicationMessage.ERROR));
  }
  return new ArrayList<>();
}
Program: 102392
Project: 102392
Buggy source:
/** 
 * Gets list of invited users in a space
 * @return lists of invited users
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") public List<String> getInvitedUsers(){
  SpaceService spaceService=getSpaceService();
  Space space=spaceService.getSpaceById(spaceId);
  try {
    if (space == null) {
      throw new Exception("String_Node_Str" + spaceId);
    }
    String[] invitedUsers=space.getInvitedUsers();
    if (invitedUsers == null || invitedUsers.length == 0) {
      return new ArrayList<String>();
    }
    int currentPage=iteratorInvitedUsers.getCurrentPage();
    LazyPageList<String> pageList=new LazyPageList<String>(new StringListAccess(Arrays.asList(invitedUsers)),INVITATION_PER_PAGE);
    iteratorInvitedUsers.setPageList(pageList);
    int pageCount=iteratorInvitedUsers.getAvailablePage();
    if (pageCount >= currentPage) {
      iteratorInvitedUsers.setCurrentPage(currentPage);
    }
 else     if (pageCount < currentPage) {
      iteratorInvitedUsers.setCurrentPage(currentPage - 1);
    }
    return iteratorInvitedUsers.getCurrentPageData();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
    UIApplication uiApplication=context.getUIApplication();
    uiApplication.addMessage(new ApplicationMessage(MSG_ERROR_INVITED_USERS_LOADING,null,ApplicationMessage.ERROR));
  }
  return new ArrayList<>();
}

Fixed version (ground truth):
/** 
 * Gets list of invited users in a space
 * @return lists of invited users
 */
@SuppressWarnings("String_Node_Str") public List<String> getInvitedUsers(){
  SpaceService spaceService=getSpaceService();
  Space space=spaceService.getSpaceById(spaceId);
  try {
    if (space == null) {
      throw new Exception("String_Node_Str" + spaceId);
    }
    String[] invitedUsers=space.getInvitedUsers();
    if (invitedUsers == null || invitedUsers.length == 0) {
      return new ArrayList<String>();
    }
    int currentPage=iteratorInvitedUsers.getCurrentPage();
    LazyPageList<String> pageList=new LazyPageList<String>(new StringListAccess(Arrays.asList(invitedUsers)),INVITATION_PER_PAGE);
    iteratorInvitedUsers.setPageList(pageList);
    int pageCount=iteratorInvitedUsers.getAvailablePage();
    if (pageCount >= currentPage) {
      iteratorInvitedUsers.setCurrentPage(currentPage);
    }
 else     if (pageCount < currentPage) {
      iteratorInvitedUsers.setCurrentPage(currentPage - 1);
    }
    return iteratorInvitedUsers.getCurrentPageData();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
    UIApplication uiApplication=context.getUIApplication();
    uiApplication.addMessage(new ApplicationMessage(MSG_ERROR_INVITED_USERS_LOADING,null,ApplicationMessage.ERROR));
  }
  return new ArrayList<>();
}
Program: 102393
Project: 102393
Buggy source:
/** 
 * Gets list of pending users in a space
 * @return list of pending users
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") public List<String> getPendingUsers() throws Exception {
  SpaceService spaceService=getSpaceService();
  Space space=spaceService.getSpaceById(spaceId);
  try {
    if (space == null) {
      throw new Exception("String_Node_Str" + spaceId);
    }
    String[] pendingUsers=space.getPendingUsers();
    if (pendingUsers == null || pendingUsers.length == 0) {
      return new ArrayList<String>();
    }
    int currentPage=iteratorPendingUsers.getCurrentPage();
    LazyPageList<String> pageList=new LazyPageList<String>(new StringListAccess(Arrays.asList(pendingUsers)),PENDING_PER_PAGE);
    iteratorPendingUsers.setPageList(pageList);
    int pageCount=iteratorPendingUsers.getAvailablePage();
    if (pageCount >= currentPage) {
      iteratorPendingUsers.setCurrentPage(currentPage);
    }
 else     if (pageCount < currentPage) {
      iteratorPendingUsers.setCurrentPage(currentPage - 1);
    }
    return iteratorPendingUsers.getCurrentPageData();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
    UIApplication uiApplication=context.getUIApplication();
    uiApplication.addMessage(new ApplicationMessage(MSG_ERROR_PENDING_USERS_LOADING,null,ApplicationMessage.ERROR));
  }
  return new ArrayList<>();
}

Fixed version (ground truth):
/** 
 * Gets list of pending users in a space
 * @return list of pending users
 */
@SuppressWarnings("String_Node_Str") public List<String> getPendingUsers() throws Exception {
  SpaceService spaceService=getSpaceService();
  Space space=spaceService.getSpaceById(spaceId);
  try {
    if (space == null) {
      throw new Exception("String_Node_Str" + spaceId);
    }
    String[] pendingUsers=space.getPendingUsers();
    if (pendingUsers == null || pendingUsers.length == 0) {
      return new ArrayList<String>();
    }
    int currentPage=iteratorPendingUsers.getCurrentPage();
    LazyPageList<String> pageList=new LazyPageList<String>(new StringListAccess(Arrays.asList(pendingUsers)),PENDING_PER_PAGE);
    iteratorPendingUsers.setPageList(pageList);
    int pageCount=iteratorPendingUsers.getAvailablePage();
    if (pageCount >= currentPage) {
      iteratorPendingUsers.setCurrentPage(currentPage);
    }
 else     if (pageCount < currentPage) {
      iteratorPendingUsers.setCurrentPage(currentPage - 1);
    }
    return iteratorPendingUsers.getCurrentPageData();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
    UIApplication uiApplication=context.getUIApplication();
    uiApplication.addMessage(new ApplicationMessage(MSG_ERROR_PENDING_USERS_LOADING,null,ApplicationMessage.ERROR));
  }
  return new ArrayList<>();
}
Program: 102395
Project: 102395
Buggy source:
/** 
 * {@inheritDoc}
 */
public void deleteSpace(final String id) throws SpaceStorageException {
  storage.deleteSpace(id);
  exoSpaceCache.remove(new SpaceKey(id));
  clearSpaceCache();
  cleanRef(space);
  getCachedActivityStorage().clearCache();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void deleteSpace(final String id) throws SpaceStorageException {
  Space space=getSpaceById(id);
  storage.deleteSpace(id);
  exoSpaceCache.remove(new SpaceKey(id));
  clearSpaceCache();
  cleanRef(space);
  getCachedActivityStorage().clearCache();
}
Program: 102396
Project: 102396
Buggy source:
public void execute(Event<UIUserActivitiesDisplay> event) throws Exception {
  UIUserActivitiesDisplay uiUserActivities=event.getSource();
  uiUserActivities.init();
  event.getRequestContext().getJavascriptManager().require("String_Node_Str","String_Node_Str").addScripts("String_Node_Str" + uiUserActivities.getAncestorOfType(UIPortletApplication.class).getId() + "String_Node_Str");
  event.getRequestContext().addUIComponentToUpdateByAjax(uiUserActivities);
  Utils.resizeHomePage();
}

Fixed version (ground truth):
public void execute(Event<UIUserActivitiesDisplay> event) throws Exception {
  UIUserActivitiesDisplay uiUserActivities=event.getSource();
  uiUserActivities.init();
  event.getRequestContext().addUIComponentToUpdateByAjax(uiUserActivities);
  Utils.resizeHomePage();
}
Program: 102397
Project: 102397
Buggy source:
/** 
 * Counts the number of identities
 * @param identityId Id of Identity.
 * @return Number of identities.
 * @throws Exception
 * @since 4.4.0
 */
int countIdentitiesWithRelationships(String id) throws Exception ;

Fixed version (ground truth):
/** 
 * Counts the number of identities
 * @param identityId Id of Identity.
 * @return Number of identities.
 * @throws Exception
 * @since 4.4.0
 */
int countIdentitiesWithRelationships(String identityId) throws Exception ;
Program: 102398
Project: 102398
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public int countIdentitiesWithRelationships(String id) throws Exception {
  return storage.countIdentitiesWithRelationships(id);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public int countIdentitiesWithRelationships(String identityId) throws Exception {
  return storage.countIdentitiesWithRelationships(identityId);
}
Program: 102402
Project: 102402
Buggy source:
/** 
 * Gets the number of updated elements based on the of multi-value since time.
 * @param sinceTime the postedTime
 * @return number of newer elements if any
 */
int getNumberOfMultiUpdated(Map<String,Long> sinceTimes);

Fixed version (ground truth):
/** 
 * Gets the number of updated elements based on the of multi-value since time.
 * @param sinceTime the postedTime
 * @return number of newer elements if any
 */
int getNumberOfMultiUpdated(Map<String,Long> sinceTime);
Program: 102403
Project: 102403
Buggy source:
/** 
 * With single quote in resource bundle, MessageFormat will be escape single quote then it needs to replace single quote by double single quotes Sample: I'm connected with {0} => I''m connected with {0}
 * @param message given message replacement
 * @return add double single quotes.
 */
public static String processSingleQuote(String message){
  String temp=message;
  while (true) {
    if (temp.indexOf("String_Node_Str") < 0) {
      break;
    }
    temp=temp.replace("String_Node_Str","String_Node_Str");
  }
  return temp.replaceAll("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * With single quote in resource bundle, MessageFormat will be escape single quote then it needs to replace single quote by double single quotes Sample:  {@literal} I'm connected with 0} => I''m connected with {0}}
 * @param message given message replacement
 * @return add double single quotes.
 */
public static String processSingleQuote(String message){
  String temp=message;
  while (true) {
    if (temp.indexOf("String_Node_Str") < 0) {
      break;
    }
    temp=temp.replace("String_Node_Str","String_Node_Str");
  }
  return temp.replaceAll("String_Node_Str","String_Node_Str");
}
Program: 102404
Project: 102404
Buggy source:
/** 
 * Removes the query parameter.
 * @param param
 * @return
 */
FilterLiteral<P> remove(OrderByOption<P> orderBy);

Fixed version (ground truth):
/** 
 * Removes the query parameter.
 * @param orderBy
 * @return
 */
FilterLiteral<P> remove(OrderByOption<P> orderBy);
Program: 102405
Project: 102405
Buggy source:
/** 
 * plug a filter in FilterLiteral
 * @param filter
 * @return
 */
OrderByOption<P> with(OrderByOption<P> orderBy);

Fixed version (ground truth):
/** 
 * plug a filter in FilterLiteral
 * @param orderBy
 * @return
 */
OrderByOption<P> with(OrderByOption<P> orderBy);
Program: 102406
Project: 102406
Buggy source:
/** 
 * Append the orderBy option.
 * @param param
 * @return
 */
FilterLiteral<P> append(OrderByOption<P> orderBy);

Fixed version (ground truth):
/** 
 * Append the orderBy option.
 * @param orderBy
 * @return
 */
FilterLiteral<P> append(OrderByOption<P> orderBy);
Program: 102408
Project: 102408
Buggy source:
/** 
 * Base on defined Pattern, when provided URI path,  this method will extract all of parameters path value  in given path which reflects in defined Pattern Example:  defined Pattern = "/{pageID}/topic/{topicID}" invokes:: matches("1256/topic/topic544343"); result: Map<String, String> = {"pageID" -> "1256"}, {"topicID" -> "topic544343"}
 * @param path : given URI path
 * @return
 */
public Map<String,String> matches(String path){
  ExoMatcher matcher=pattern.matcher(path);
  if (matcher.matches()) {
    Map<String,String> localArgs=new HashMap<String,String>();
    for (    ParamArg arg : args) {
      if (arg.defaultValue == null) {
        localArgs.put(arg.name,matcher.group(arg.name));
      }
    }
    return localArgs;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Base on defined Pattern, when provided URI path,  this method will extract all of parameters path value  in given path which reflects in defined Pattern Example:  defined Pattern = "/{pageID}/topic/{topicID}" invokes:: matches("1256/topic/topic544343"); result:   {@code} Map<String, String> = "pageID" -> "1256"}, {"topicID" -> "topic544343"}}
 * @param path : given URI path
 * @return
 */
public Map<String,String> matches(String path){
  ExoMatcher matcher=pattern.matcher(path);
  if (matcher.matches()) {
    Map<String,String> localArgs=new HashMap<String,String>();
    for (    ParamArg arg : args) {
      if (arg.defaultValue == null) {
        localArgs.put(arg.name,matcher.group(arg.name));
      }
    }
    return localArgs;
  }
  return null;
}
Program: 102409
Project: 102409
Buggy source:
/** 
 * Add new route which loaded from route configuration file.
 * @param path /{pageID}/ForumService
 * @param action /{pageID}/ForumService
 * @param params the action which appends to patch after "ForumService" stringex: /{pageID}/{ForumService|}/{action} =>/{pageID}/ForumService/{}
 */
public static void addRoute(String path,String action,String params){
  appendRoute(path,action,params);
}

Fixed version (ground truth):
/** 
 * Add new route which loaded from route configuration file.
 * @param path /{pageID}/ForumService
 * @param action /{pageID}/ForumService
 * @param params the action which appends to patch after "ForumService" stringex:  {@literal} /pageID}/{ForumService|}/{action} =>/{pageID}/ForumService/{}}
 */
public static void addRoute(String path,String action,String params){
  appendRoute(path,action,params);
}
Program: 102410
Project: 102410
Buggy source:
/** 
 * This method is invoked once the proccessor is done. <p/> If an exception occurred while processing the exchange, the exception field of the  {@Service} being processed will hold the caused exception.
 * @param processContext 
 */
void done(ProcessContext processContext);

Fixed version (ground truth):
/** 
 * This method is invoked once the proccessor is done. <br> If an exception occurred while processing the exchange, the exception field of the Service being processed will hold the caused exception.
 * @param processContext 
 */
void done(ProcessContext processContext);
Program: 102411
Project: 102411
Buggy source:
/** 
 * Creates a new thread pool using the default thread pool profile.
 * @param source the source object, usually it should be <tt>this</tt> passed in as parameter
 * @param name   name which is appended to the thread name
 * @return the created thread pool
 */
ExecutorService newDefaultThreadPool(String name);

Fixed version (ground truth):
/** 
 * Creates a new thread pool using the default thread pool profile.
 * @param name   name which is appended to the thread name
 * @return the created thread pool
 */
ExecutorService newDefaultThreadPool(String name);
Program: 102412
Project: 102412
Buggy source:
/** 
 * Sets the thread name pattern used for creating the full thread name. <p/>
 * @param pattern the pattern
 * @throws IllegalArgumentException if the pattern is invalid.
 */
void setThreadNamePattern(String pattern) throws IllegalArgumentException ;

Fixed version (ground truth):
/** 
 * Sets the thread name pattern used for creating the full thread name. <br>
 * @param pattern the pattern
 * @throws IllegalArgumentException if the pattern is invalid.
 */
void setThreadNamePattern(String pattern) throws IllegalArgumentException ;
Program: 102413
Project: 102413
Buggy source:
/** 
 * Adds the given lifecycle services to be used.
 * @param lifecycleServices the service
 */
void addLifecycleService(LifecycleService lifecycleService);

Fixed version (ground truth):
/** 
 * Adds the given lifecycle services to be used.
 * @param lifecycleService the service
 */
void addLifecycleService(LifecycleService lifecycleService);
Program: 102414
Project: 102414
Buggy source:
/** 
 * Sets the maximum number of tasks in the work queue. <p/> Use <tt>-1</tt> or <tt>Integer.MAX_VALUE</tt> for an unbounded queue
 * @param maxQueueSize the max queue size
 */
public void setMaxQueueSize(Integer maxQueueSize){
  this.maxQueueSize=maxQueueSize;
}

Fixed version (ground truth):
/** 
 * Sets the maximum number of tasks in the work queue. <br> Use <tt>-1</tt> or <tt>Integer.MAX_VALUE</tt> for an unbounded queue
 * @param maxQueueSize the max queue size
 */
public void setMaxQueueSize(Integer maxQueueSize){
  this.maxQueueSize=maxQueueSize;
}
Program: 102415
Project: 102415
Buggy source:
/** 
 * Gets the maximum number of tasks in the work queue. <p/> Use <tt>-1</tt> or <tt>Integer.MAX_VALUE</tt> for an unbounded queue
 * @return the max queue size
 */
public Integer getMaxQueueSize(){
  return maxQueueSize;
}

Fixed version (ground truth):
/** 
 * Gets the maximum number of tasks in the work queue. <br> Use <tt>-1</tt> or <tt>Integer.MAX_VALUE</tt> for an unbounded queue
 * @return the max queue size
 */
public Integer getMaxQueueSize(){
  return maxQueueSize;
}
Program: 102416
Project: 102416
Buggy source:
/** 
 * Creates a new cached thread pool <p/> The cached thread pool is a term from the JDK from the method   {@link java.util.concurrent.Executors#newCachedThreadPool()}. Typically it will have no size limit (this is why it is handled separately
 * @param threadFactory factory for creating threads
 * @return the created thread pool
 */
ExecutorService newCachedThreadPool(ThreadFactory threadFactory);

Fixed version (ground truth):
/** 
 * Creates a new cached thread pool <br> The cached thread pool is a term from the JDK from the method   {@link java.util.concurrent.Executors#newCachedThreadPool()}. Typically it will have no size limit (this is why it is handled separately
 * @param threadFactory factory for creating threads
 * @return the created thread pool
 */
ExecutorService newCachedThreadPool(ThreadFactory threadFactory);
Program: 102417
Project: 102417
Buggy source:
/** 
 * Calls the async of the processor's process method and waits for it to complete before returning. This can be used by   {@link AsyncProcessor}objects to implement their sync version of the process method.
 * @param processor the processor
 * @param exchange  the exchange
 * @throws Exception can be thrown if waiting is interrupted
 */
public static void process(final AsyncProcessor processor,final ProcessContext processContext) throws Exception {
  processor.start(processContext);
  processor.process(processContext,new AsyncCallback(){
    public void done(    ProcessContext processContext){
    }
    @Override public String toString(){
      return "String_Node_Str" + processor;
    }
  }
);
  processor.end(processContext);
}

Fixed version (ground truth):
/** 
 * Calls the async of the processor's process method and waits for it to complete before returning. This can be used by   {@link AsyncProcessor}objects to implement their sync version of the process method.
 * @param processor the processor
 * @param processContext  the context
 * @throws Exception can be thrown if waiting is interrupted
 */
public static void process(final AsyncProcessor processor,final ProcessContext processContext) throws Exception {
  processor.start(processContext);
  processor.process(processContext,new AsyncCallback(){
    public void done(    ProcessContext processContext){
    }
    @Override public String toString(){
      return "String_Node_Str" + processor;
    }
  }
);
  processor.end(processContext);
}
Program: 102418
Project: 102418
Buggy source:
/** 
 * Retrieves the given exception type from the exception. <p/> Is used to get the caused exception that typically have been wrapped in some sort of Camel wrapper exception <p/> The strategy is to look in the exception hierarchy to find the first given cause that matches the type. Will start from the bottom (the real cause) and walk upwards.
 * @param type the exception type wanted to retrieve
 * @param exception the caused exception
 * @return the exception found (or <tt>null</tt> if not found in the exception hierarchy)
 */
public static <T>T getException(Class<T> type,Throwable exception){
  if (exception == null) {
    return null;
  }
  Iterator<Throwable> it=createExceptionIterator(exception);
  while (it.hasNext()) {
    Throwable e=it.next();
    if (type.isInstance(e)) {
      return type.cast(e);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Retrieves the given exception type from the exception. <br> Is used to get the caused exception that typically have been wrapped in some sort of Camel wrapper exception <br> The strategy is to look in the exception hierarchy to find the first given cause that matches the type. Will start from the bottom (the real cause) and walk upwards.
 * @param type the exception type wanted to retrieve
 * @param exception the caused exception
 * @return the exception found (or <tt>null</tt> if not found in the exception hierarchy)
 */
public static <T>T getException(Class<T> type,Throwable exception){
  if (exception == null) {
    return null;
  }
  Iterator<Throwable> it=createExceptionIterator(exception);
  while (it.hasNext()) {
    Throwable e=it.next();
    if (type.isInstance(e)) {
      return type.cast(e);
    }
  }
  return null;
}