nus-yam/ex-repair huggingface dataset:
Program: 13552
Project: 13552
Buggy source:
void updatePartsData(){
  UUID uuid=this.mc.thePlayer.getPersistentID();
  PartEntry tailEntry=(PartEntry)partList.getListEntry(partList.getCurrrentIndex());
  partInfo.setTexture(null);
  if (currTintEdit > 0)   partInfo.tints[currTintEdit - 1]=currTintColour | 0xFF << 24;
  partInfo=new PartInfo(uuid,tailEntry.partInfo.hasPart,tailEntry.partInfo.typeid,tailEntry.partInfo.subid,textureID,partInfo.tints,partType,null);
  partInfo.setTexture(TextureHelper.generateTexture(partInfo));
  partsData.setPartInfo(partType,partInfo);
  Tails.proxy.addPartsData(uuid,partsData);
}

Fixed version (ground truth):
void updatePartsData(){
  UUID uuid=this.mc.thePlayer.getPersistentID();
  PartEntry tailEntry=(PartEntry)partList.getListEntry(partList.getCurrrentIndex());
  partInfo.setTexture(null);
  if (currTintEdit > 0)   partInfo.tints[currTintEdit - 1]=currTintColour | 0xFF << 24;
  partInfo=new PartInfo(uuid,tailEntry.partInfo.hasPart,tailEntry.partInfo.typeid,tailEntry.partInfo.subid,textureID,partInfo.tints,partType,null);
  if (partInfo.hasPart)   partInfo.setTexture(TextureHelper.generateTexture(partInfo));
  partsData.setPartInfo(partType,partInfo);
  Tails.proxy.addPartsData(uuid,partsData);
}
Program: 13553
Project: 13553
Buggy source:
private void selectDefaultListEntry(){
  for (  GuiListExtended.IGuiListEntry entry : this.partList.getEntries()) {
    PartEntry partEntry=(PartEntry)entry;
    if ((!partEntry.partInfo.hasPart && !originalPartInfo.hasPart) || (partEntry.partInfo.typeid == originalPartInfo.typeid && partEntry.partInfo.subid == originalPartInfo.subid)) {
      this.partList.setCurrrentIndex(this.partList.getEntries().indexOf(partEntry));
    }
  }
}

Fixed version (ground truth):
private void selectDefaultListEntry(){
  for (  GuiListExtended.IGuiListEntry entry : this.partList.getEntries()) {
    PartEntry partEntry=(PartEntry)entry;
    if ((!partEntry.partInfo.hasPart && !partInfo.hasPart) || (partInfo.hasPart && partEntry.partInfo.hasPart && partEntry.partInfo.typeid == partInfo.typeid && partEntry.partInfo.subid == partInfo.subid)) {
      this.partList.setCurrrentIndex(this.partList.getEntries().indexOf(partEntry));
      break;
    }
  }
}
Program: 13555
Project: 13555
Buggy source:
@Override public void onPreRenderTail(EntityLivingBase entity,RenderPart tail,PartInfo info,double x,double y,double z){
  if (tail.modelPart instanceof ModelFoxEars)   return;
  if (tail.modelPart instanceof ModelDragonTail) {
    if (!entity.isSneaking())     GL11.glTranslatef(0F,0.68F,0.1F);
 else     GL11.glTranslatef(0F,0.6F,0.35F);
    GL11.glScalef(0.8F,0.8F,0.8F);
  }
 else   if (tail.modelPart instanceof ModelCatTail || tail.modelPart instanceof ModelDevilTail) {
    if (!entity.isSneaking())     GL11.glTranslatef(0F,0.65F,0.1F);
 else     GL11.glTranslatef(0F,0.55F,0.4F);
    GL11.glScalef(0.9F,0.9F,0.9F);
  }
 else {
    if (!entity.isSneaking())     GL11.glTranslatef(0F,0.65F,0.1F);
 else     GL11.glTranslatef(0F,0.55F,0.4F);
    GL11.glScalef(0.8F,0.8F,0.8F);
  }
}

Fixed version (ground truth):
@Override public void onPreRenderTail(EntityLivingBase entity,RenderPart tail,PartInfo info,double x,double y,double z){
  if (info.partType == PartsData.PartType.EARS)   return;
  if (tail.modelPart instanceof ModelDragonTail) {
    if (!entity.isSneaking())     GL11.glTranslatef(0F,0.68F,0.1F);
 else     GL11.glTranslatef(0F,0.6F,0.35F);
    GL11.glScalef(0.8F,0.8F,0.8F);
  }
 else   if (tail.modelPart instanceof ModelCatTail || tail.modelPart instanceof ModelDevilTail) {
    if (!entity.isSneaking())     GL11.glTranslatef(0F,0.65F,0.1F);
 else     GL11.glTranslatef(0F,0.55F,0.4F);
    GL11.glScalef(0.9F,0.9F,0.9F);
  }
 else {
    if (!entity.isSneaking())     GL11.glTranslatef(0F,0.65F,0.1F);
 else     GL11.glTranslatef(0F,0.55F,0.4F);
    GL11.glScalef(0.8F,0.8F,0.8F);
  }
}
Program: 13558
Project: 13558
Buggy source:
/** 
 * Factory constructor, creates and attaches the buffer to the DOM.
 * @return Browser specific implementation of a paste buffer.
 */
static PasteBufferImpl create(){
  PasteBufferImpl pasteBuffer;
  if (UserAgent.isSafari()) {
    pasteBuffer=new PasteBufferImplSafari();
  }
 else   if (UserAgent.isFirefox() && !QuirksConstants.SANITIZES_PASTED_CONTENT) {
    pasteBuffer=new PasteBufferImplFirefox();
  }
 else {
    pasteBuffer=new PasteBufferImpl();
  }
  pasteBuffer.setupDom();
  return pasteBuffer;
}

Fixed version (ground truth):
/** 
 * Factory constructor, creates and attaches the buffer to the DOM.
 * @return Browser specific implementation of a paste buffer.
 */
static PasteBufferImpl create(){
  PasteBufferImpl pasteBuffer;
  if (UserAgent.isSafari() || QuirksConstants.FIREFOX_GREATER_THAN_VER_15) {
    pasteBuffer=new PasteBufferImplSafariAndNewFirefox();
  }
 else   if (UserAgent.isFirefox() && !QuirksConstants.SANITIZES_PASTED_CONTENT) {
    pasteBuffer=new PasteBufferImplOldFirefox();
  }
 else {
    pasteBuffer=new PasteBufferImpl();
  }
  pasteBuffer.setupDom();
  return pasteBuffer;
}
Program: 13559
Project: 13559
Buggy source:
private static UserAgentRuntimeProperties createInstance(){
  return GWT.isScript() ? new UserAgentRuntimeProperties(getNativeUserAgent()) : new UserAgentRuntimeProperties("String_Node_Str");
}

Fixed version (ground truth):
private static UserAgentRuntimeProperties createInstance(){
  return GWT.isClient() ? new UserAgentRuntimeProperties(getNativeUserAgent()) : new UserAgentRuntimeProperties("String_Node_Str");
}
Program: 13560
Project: 13560
Buggy source:
@Override public void onOpened(WaveContext wave){
  Document document=wave.getConversations().getRoot().getRootThread().getFirstBlip().getContent();
  String waveTitle=TitleHelper.extractTitle(document);
  String windowTitle=formatTitle(waveTitle);
  if (waveTitle == null || waveTitle.isEmpty()) {
    windowTitle=DEFAULT_TITLE;
  }
  Window.setTitle(windowTitle);
  waveFrame.setTitle(waveTitle);
  waveFrame.setTitleText(waveTitle);
}

Fixed version (ground truth):
@Override public void onOpened(WaveContext wave){
  Document document=wave.getConversations().getRoot().getRootThread().getFirstBlip().getContent();
  String waveTitle=TitleHelper.extractTitle(document);
  String windowTitle=formatTitle(waveTitle);
  if (waveTitle == null || waveTitle.isEmpty()) {
    windowTitle=DEFAULT_TITLE;
  }
  Window.setTitle(windowTitle);
  waveFrame.setTitleText(waveTitle);
}
Program: 13561
Project: 13561
Buggy source:
/** 
 * @param waveId the id of the wave to open, or null to create a new wave
 * @param channel communication channel
 * @param idGenerator
 * @param unsavedIndicatorElement
 */
public StageTwoProvider(StageOne stageOne,WaveRef waveRef,RemoteViewServiceMultiplexer channel,boolean isNewWave,IdGenerator idGenerator,ProfileManager profiles,Element unsavedIndicatorElement){
  super(stageOne,unsavedIndicatorElement);
  Preconditions.checkArgument(stageOne != null);
  Preconditions.checkArgument(waveRef != null);
  Preconditions.checkArgument(waveRef.getWaveId() != null);
  this.waveRef=waveRef;
  this.channel=channel;
  this.isNewWave=isNewWave;
  this.idGenerator=idGenerator;
  this.profiles=profiles;
}

Fixed version (ground truth):
/** 
 * @param waveId the id of the wave to open, or null to create a new wave
 * @param channel communication channel
 * @param idGenerator
 * @param unsavedIndicatorElement
 */
public StageTwoProvider(StageOne stageOne,WaveRef waveRef,RemoteViewServiceMultiplexer channel,boolean isNewWave,IdGenerator idGenerator,ProfileManager profiles,UnsavedDataListener unsavedDataListener){
  super(stageOne,unsavedDataListener);
  Preconditions.checkArgument(stageOne != null);
  Preconditions.checkArgument(waveRef != null);
  Preconditions.checkArgument(waveRef.getWaveId() != null);
  this.waveRef=waveRef;
  this.channel=channel;
  this.isNewWave=isNewWave;
  this.idGenerator=idGenerator;
  this.profiles=profiles;
}
Program: 13562
Project: 13562
Buggy source:
@Override protected AsyncHolder<StageTwo> createStageTwoLoader(StageOne one){
  return haltIfClosed(new StageTwoProvider(this.one=one,waveRef,channel,isNewWave,idGenerator,profiles,unsavedIndicatorElement));
}

Fixed version (ground truth):
@Override protected AsyncHolder<StageTwo> createStageTwoLoader(StageOne one){
  return haltIfClosed(new StageTwoProvider(this.one=one,waveRef,channel,isNewWave,idGenerator,profiles,new SavedStateIndicator(unsavedIndicatorElement)));
}
Program: 13564
Project: 13564
Buggy source:
public DefaultProvider(StageOne stageOne,Element unsavedIndicatorElement){
  this.stageOne=stageOne;
  this.unsavedIndicatorElement=unsavedIndicatorElement;
}

Fixed version (ground truth):
public DefaultProvider(StageOne stageOne,UnsavedDataListener unsavedDataListener){
  this.stageOne=stageOne;
  this.unsavedDataListener=unsavedDataListener;
}
Program: 13565
Project: 13565
Buggy source:
@Override public void flush(HashedVersion version){
  transformedDeltas.remove(version);
  appliedDeltas.remove(version);
  if (LOG.isFineLoggable()) {
    LOG.fine("String_Node_Str" + version);
  }
}

Fixed version (ground truth):
@Override public void flush(HashedVersion version){
  transformedDeltas.remove(transformedDeltas.lowerKey(version));
  appliedDeltas.remove(appliedDeltas.lowerKey(version));
  if (LOG.isFineLoggable()) {
    LOG.fine("String_Node_Str" + version);
  }
}
Program: 13566
Project: 13566
Buggy source:
@Override public void run(){
  acquireWriteLock();
  try {
    waveletState.flush(version);
    notifyOfCommit(version,domainsToNotify);
  }
  finally {
    releaseWriteLock();
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    result.get();
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
  }
catch (  ExecutionException e) {
    LOG.severe("String_Node_Str" + version,e);
  }
  acquireWriteLock();
  try {
    waveletState.flush(version);
    notifyOfCommit(version,domainsToNotify);
  }
  finally {
    releaseWriteLock();
  }
}
Program: 13567
Project: 13567
Buggy source:
protected void persist(final HashedVersion version,final ImmutableSet<String> domainsToNotify){
  Preconditions.checkState(writeLock.isHeldByCurrentThread(),"String_Node_Str");
  final ListenableFuture<Void> result=waveletState.persist(version);
  result.addListener(new Runnable(){
    @Override public void run(){
      acquireWriteLock();
      try {
        waveletState.flush(version);
        notifyOfCommit(version,domainsToNotify);
      }
  finally {
        releaseWriteLock();
      }
    }
  }
,storageContinuationExecutor);
}

Fixed version (ground truth):
protected void persist(final HashedVersion version,final ImmutableSet<String> domainsToNotify){
  Preconditions.checkState(writeLock.isHeldByCurrentThread(),"String_Node_Str");
  final ListenableFuture<Void> result=waveletState.persist(version);
  result.addListener(new Runnable(){
    @Override public void run(){
      try {
        result.get();
      }
 catch (      InterruptedException e) {
        Thread.currentThread().interrupt();
      }
catch (      ExecutionException e) {
        LOG.severe("String_Node_Str" + version,e);
      }
      acquireWriteLock();
      try {
        waveletState.flush(version);
        notifyOfCommit(version,domainsToNotify);
      }
  finally {
        releaseWriteLock();
      }
    }
  }
,storageContinuationExecutor);
}
Program: 13568
Project: 13568
Buggy source:
/** 
 * Commonly we start to listen history changes when webclient starts calling this method. If you are using wave client integrated with other different GWT application and with a different History management, you can avoid to use this and just call to the   {@link WaveSelectionEvent} events (for example) or other uses.
 */
public static void init(){
  History.addValueChangeHandler(new ValueChangeHandler<String>(){
    @Override public void onValueChange(    ValueChangeEvent<String> event){
      String encodedToken=event.getValue();
      if (encodedToken == null || encodedToken.length() == 0) {
        return;
      }
      WaveRef waveRef=HistorySupport.waveRefFromHistoryToken(encodedToken);
      if (waveRef == null) {
        LOG.info("String_Node_Str" + encodedToken);
        return;
      }
      LOG.info("String_Node_Str" + waveRef.toString());
      ClientEvents.get().fireEvent(new WaveSelectionEvent(waveRef));
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Commonly we start to listen history changes when webclient starts calling this method. If you are using wave client integrated with other different GWT application and with a different History management, you can avoid to use this and just call to the   {@link WaveSelectionEvent} events (for example) or other uses.
 */
public static void init(){
  History.addValueChangeHandler(new ValueChangeHandler<String>(){
    @Override public void onValueChange(    ValueChangeEvent<String> event){
      String encodedToken=event.getValue();
      if (encodedToken == null || encodedToken.length() == 0) {
        return;
      }
      WaveRef waveRef;
      try {
        waveRef=GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
      }
 catch (      InvalidWaveRefException e) {
        LOG.info("String_Node_Str" + encodedToken);
        return;
      }
      LOG.info("String_Node_Str" + waveRef.toString());
      ClientEvents.get().fireEvent(new WaveSelectionEvent(waveRef));
    }
  }
);
}
Program: 13569
Project: 13569
Buggy source:
@Override public void onValueChange(ValueChangeEvent<String> event){
  String encodedToken=event.getValue();
  if (encodedToken == null || encodedToken.length() == 0) {
    return;
  }
  WaveRef waveRef=HistorySupport.waveRefFromHistoryToken(encodedToken);
  if (waveRef == null) {
    LOG.info("String_Node_Str" + encodedToken);
    return;
  }
  LOG.info("String_Node_Str" + waveRef.toString());
  ClientEvents.get().fireEvent(new WaveSelectionEvent(waveRef));
}

Fixed version (ground truth):
@Override public void onValueChange(ValueChangeEvent<String> event){
  String encodedToken=event.getValue();
  if (encodedToken == null || encodedToken.length() == 0) {
    return;
  }
  WaveRef waveRef;
  try {
    waveRef=GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
  }
 catch (  InvalidWaveRefException e) {
    LOG.info("String_Node_Str" + encodedToken);
    return;
  }
  LOG.info("String_Node_Str" + waveRef.toString());
  ClientEvents.get().fireEvent(new WaveSelectionEvent(waveRef));
}
Program: 13570
Project: 13570
Buggy source:
/** 
 * Shows a wave in a wave panel.
 * @param waveRef wave id to open
 * @param isNewWave whether the wave is being created by this client session.
 */
private void openWave(WaveRef waveRef,boolean isNewWave){
  LOG.info("String_Node_Str");
  if (wave != null) {
    wave.destroy();
    wave=null;
  }
  UIObject.setVisible(waveFrame.getElement(),true);
  waveHolder.getElement().appendChild(loading);
  Element holder=waveHolder.getElement().appendChild(Document.get().createDivElement());
  StagesProvider wave=new StagesProvider(holder,waveHolder,waveRef,channel,idGenerator,profiles,waveStore,isNewWave,Session.get().getDomain());
  this.wave=wave;
  wave.load(new Command(){
    @Override public void execute(){
      loading.removeFromParent();
    }
  }
);
  String encodedToken=History.getToken();
  if (encodedToken != null && !encodedToken.isEmpty()) {
    WaveRef fromWaveRef=HistorySupport.waveRefFromHistoryToken(encodedToken);
    if (waveRef == null) {
      LOG.info("String_Node_Str" + encodedToken);
      return;
    }
    if (fromWaveRef.getWaveId().equals(waveRef.getWaveId())) {
      return;
    }
  }
  History.newItem(HistorySupport.historyTokenFromWaveref(waveRef),false);
}

Fixed version (ground truth):
/** 
 * Shows a wave in a wave panel.
 * @param waveRef wave id to open
 * @param isNewWave whether the wave is being created by this client session.
 */
private void openWave(WaveRef waveRef,boolean isNewWave){
  LOG.info("String_Node_Str");
  if (wave != null) {
    wave.destroy();
    wave=null;
  }
  UIObject.setVisible(waveFrame.getElement(),true);
  waveHolder.getElement().appendChild(loading);
  Element holder=waveHolder.getElement().appendChild(Document.get().createDivElement());
  StagesProvider wave=new StagesProvider(holder,waveHolder,waveRef,channel,idGenerator,profiles,waveStore,isNewWave,Session.get().getDomain());
  this.wave=wave;
  wave.load(new Command(){
    @Override public void execute(){
      loading.removeFromParent();
    }
  }
);
  String encodedToken=History.getToken();
  if (encodedToken != null && !encodedToken.isEmpty()) {
    WaveRef fromWaveRef;
    try {
      fromWaveRef=GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
    }
 catch (    InvalidWaveRefException e) {
      LOG.info("String_Node_Str" + encodedToken);
      return;
    }
    if (fromWaveRef.getWaveId().equals(waveRef.getWaveId())) {
      return;
    }
  }
  History.newItem(GwtWaverefEncoder.encodeToUriPathSegment(waveRef),false);
}
Program: 13571
Project: 13571
Buggy source:
protected EditToolbar createEditToolbar(){
  return EditToolbar.create(getStageTwo().getSignedInUser(),stageTwo.getIdGenerator());
}

Fixed version (ground truth):
protected EditToolbar createEditToolbar(){
  return EditToolbar.create(getStageTwo().getSignedInUser(),stageTwo.getIdGenerator(),stageTwo.getWave().getWaveId());
}
Program: 13572
Project: 13572
Buggy source:
private EditToolbar(EditorToolbarResources.Css css,ToplevelToolbarWidget toolbarUi,ParticipantId user,IdGenerator idGenerator){
  this.css=css;
  this.toolbarUi=toolbarUi;
  this.user=user;
  attachmentIdGenerator=new AttachmentIdGeneratorImpl(idGenerator);
}

Fixed version (ground truth):
private EditToolbar(EditorToolbarResources.Css css,ToplevelToolbarWidget toolbarUi,ParticipantId user,IdGenerator idGenerator,WaveId waveId){
  this.css=css;
  this.toolbarUi=toolbarUi;
  this.user=user;
  this.waveId=waveId;
  attachmentIdGenerator=new AttachmentIdGeneratorImpl(idGenerator);
}
Program: 13573
Project: 13573
Buggy source:
/** 
 * Attaches editor behaviour to a toolbar, adding all the edit buttons.
 */
public static EditToolbar create(ParticipantId user,IdGenerator idGenerator){
  ToplevelToolbarWidget toolbarUi=new ToplevelToolbarWidget();
  EditorToolbarResources.Css css=EditorToolbarResources.Loader.res.css();
  return new EditToolbar(css,toolbarUi,user,idGenerator);
}

Fixed version (ground truth):
/** 
 * Attaches editor behaviour to a toolbar, adding all the edit buttons.
 */
public static EditToolbar create(ParticipantId user,IdGenerator idGenerator,WaveId waveId){
  ToplevelToolbarWidget toolbarUi=new ToplevelToolbarWidget();
  EditorToolbarResources.Css css=EditorToolbarResources.Loader.res.css();
  return new EditToolbar(css,toolbarUi,user,idGenerator,waveId);
}
Program: 13575
Project: 13575
Buggy source:
@Override public Multimap<WaveId,WaveletId> apply(final ParticipantId user){
  Multimap<WaveId,WaveletId> userView=HashMultimap.create();
  ExceptionalIterator<WaveId,WaveServerException> waveIds=waveMap.getWaveIds();
  try {
    while (waveIds.hasNext()) {
      WaveId waveId=waveIds.next();
      ImmutableSet<WaveletId> waveletIds=waveMap.lookupWavelets(waveId);
      for (      WaveletId waveletId : waveletIds) {
        WaveletContainer c=waveMap.getLocalWavelet(WaveletName.of(waveId,waveletId));
        try {
          if (!c.hasParticipant(user)) {
            continue;
          }
          userView.put(waveId,waveletId);
        }
 catch (        WaveletStateException e) {
          LOG.warning("String_Node_Str" + c.getWaveletName(),e);
        }
      }
    }
  }
 catch (  WaveletStateException e) {
    LOG.severe(String.format("String_Node_Str",user.getAddress()),e);
  }
catch (  WaveServerException e) {
    LOG.severe(String.format("String_Node_Str",user.getAddress()),e);
  }
  LOG.info("String_Node_Str" + user.getAddress() + "String_Node_Str"+ userView.size());
  return userView;
}

Fixed version (ground truth):
@Override public Multimap<WaveId,WaveletId> apply(final ParticipantId user){
  Multimap<WaveId,WaveletId> userView=HashMultimap.create();
  Map<WaveId,Wave> waves=waveMap.getWaves();
  for (  Map.Entry<WaveId,Wave> entry : waves.entrySet()) {
    Wave wave=entry.getValue();
    for (    WaveletContainer c : wave) {
      WaveletId waveletId=c.getWaveletName().waveletId;
      try {
        if (!c.hasParticipant(user)) {
          continue;
        }
        userView.put(entry.getKey(),waveletId);
      }
 catch (      WaveletStateException e) {
        LOG.warning("String_Node_Str" + c.getWaveletName(),e);
      }
    }
  }
  LOG.info("String_Node_Str" + user.getAddress() + "String_Node_Str"+ userView.size());
  return userView;
}
Program: 13576
Project: 13576
Buggy source:
@Inject public PerUserWaveViewSubscriber(final WaveMap waveMap){
  explicitPerUserWaveViews=new MapMaker().expireAfterAccess(PER_USER_WAVES_VIEW_CACHE_MINUTES,TimeUnit.MINUTES).makeComputingMap(new Function<ParticipantId,Multimap<WaveId,WaveletId>>(){
    @Override public Multimap<WaveId,WaveletId> apply(    final ParticipantId user){
      Multimap<WaveId,WaveletId> userView=HashMultimap.create();
      ExceptionalIterator<WaveId,WaveServerException> waveIds=waveMap.getWaveIds();
      try {
        while (waveIds.hasNext()) {
          WaveId waveId=waveIds.next();
          ImmutableSet<WaveletId> waveletIds=waveMap.lookupWavelets(waveId);
          for (          WaveletId waveletId : waveletIds) {
            WaveletContainer c=waveMap.getLocalWavelet(WaveletName.of(waveId,waveletId));
            try {
              if (!c.hasParticipant(user)) {
                continue;
              }
              userView.put(waveId,waveletId);
            }
 catch (            WaveletStateException e) {
              LOG.warning("String_Node_Str" + c.getWaveletName(),e);
            }
          }
        }
      }
 catch (      WaveletStateException e) {
        LOG.severe(String.format("String_Node_Str",user.getAddress()),e);
      }
catch (      WaveServerException e) {
        LOG.severe(String.format("String_Node_Str",user.getAddress()),e);
      }
      LOG.info("String_Node_Str" + user.getAddress() + "String_Node_Str"+ userView.size());
      return userView;
    }
  }
);
}

Fixed version (ground truth):
@Inject public PerUserWaveViewSubscriber(final WaveMap waveMap){
  explicitPerUserWaveViews=new MapMaker().expireAfterAccess(PER_USER_WAVES_VIEW_CACHE_MINUTES,TimeUnit.MINUTES).makeComputingMap(new Function<ParticipantId,Multimap<WaveId,WaveletId>>(){
    @Override public Multimap<WaveId,WaveletId> apply(    final ParticipantId user){
      Multimap<WaveId,WaveletId> userView=HashMultimap.create();
      Map<WaveId,Wave> waves=waveMap.getWaves();
      for (      Map.Entry<WaveId,Wave> entry : waves.entrySet()) {
        Wave wave=entry.getValue();
        for (        WaveletContainer c : wave) {
          WaveletId waveletId=c.getWaveletName().waveletId;
          try {
            if (!c.hasParticipant(user)) {
              continue;
            }
            userView.put(entry.getKey(),waveletId);
          }
 catch (          WaveletStateException e) {
            LOG.warning("String_Node_Str" + c.getWaveletName(),e);
          }
        }
      }
      LOG.info("String_Node_Str" + user.getAddress() + "String_Node_Str"+ userView.size());
      return userView;
    }
  }
);
}
Program: 13577
Project: 13577
Buggy source:
private <T extends WaveletContainer>T getWavelet(WaveletId waveletId,ConcurrentMap<WaveletId,T> waveletsMap) throws WaveletStateException {
  ImmutableSet<WaveletId> storedWavelets;
  try {
    storedWavelets=FutureUtil.getResultOrPropagateException(getLookedupWavelets(),PersistenceException.class);
  }
 catch (  PersistenceException e) {
    throw new WaveletStateException("String_Node_Str" + WaveletName.of(waveId,waveletId),e);
  }
catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new WaveletStateException("String_Node_Str" + WaveletName.of(waveId,waveletId),e);
  }
  if (storedWavelets != null && !storedWavelets.contains(waveletId) && !waveletsMap.containsKey(waveletId)) {
    return null;
  }
 else {
    T wavelet=waveletsMap.get(waveletId);
    Preconditions.checkNotNull(wavelet,"String_Node_Str");
    return wavelet;
  }
}

Fixed version (ground truth):
private <T extends WaveletContainer>T getWavelet(WaveletId waveletId,ConcurrentMap<WaveletId,T> waveletsMap) throws WaveletStateException {
  ImmutableSet<WaveletId> storedWavelets;
  try {
    storedWavelets=FutureUtil.getResultOrPropagateException(lookedupWavelets,PersistenceException.class);
  }
 catch (  PersistenceException e) {
    throw new WaveletStateException("String_Node_Str" + WaveletName.of(waveId,waveletId),e);
  }
catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new WaveletStateException("String_Node_Str" + WaveletName.of(waveId,waveletId),e);
  }
  if (storedWavelets != null && !storedWavelets.contains(waveletId) && !waveletsMap.containsKey(waveletId)) {
    return null;
  }
 else {
    T wavelet=waveletsMap.get(waveletId);
    Preconditions.checkNotNull(wavelet,"String_Node_Str");
    return wavelet;
  }
}
Program: 13578
Project: 13578
Buggy source:
private void createClearFormattingButton(ToolbarView toolbar){
  new ToolbarButtonViewBuilder().setIcon(css.clearFormatting()).applyTo(toolbar.addClickButton(),new ToolbarClickButton.Listener(){
    @Override public void onClicked(){
      EditorAnnotationUtil.clearAnnotationsOverSelection(editor,asArray(StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str")));
      createClearHeadingsListener().onClicked();
    }
  }
);
}

Fixed version (ground truth):
private void createClearFormattingButton(ToolbarView toolbar){
  new ToolbarButtonViewBuilder().setIcon(css.clearFormatting()).applyTo(toolbar.addClickButton(),new ToolbarClickButton.Listener(){
    @Override public void onClicked(){
      EditorAnnotationUtil.clearAnnotationsOverSelection(editor,asArray(StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str"),StyleAnnotationHandler.key("String_Node_Str")));
      createClearHeadingsListener().onClicked();
    }
  }
);
}
Program: 13579
Project: 13579
Buggy source:
public void testDoPostExecutesAndWritesResponse() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(generateOAuthHeader(ROBOT.getAddress()));
  String operationId="String_Node_Str";
  OperationRequest operation=new OperationRequest("String_Node_Str",operationId);
  List<OperationRequest> operations=Collections.singletonList(operation);
  when(robotSerializer.deserializeOperations(anyString())).thenReturn(operations);
  String responseValue="String_Node_Str";
  when(robotSerializer.serialize(any(),any(Type.class),any(ProtocolVersion.class))).thenReturn(responseValue);
  OperationService service=mock(OperationService.class);
  when(operationRegistry.getServiceFor(any(OperationType.class))).thenReturn(service);
  servlet.doPost(req,resp);
  verify(operationRegistry).getServiceFor(any(OperationType.class));
  verify(service).execute(eq(operation),any(OperationContext.class),eq(ROBOT));
  verify(resp).setStatus(HttpServletResponse.SC_OK);
  assertEquals("String_Node_Str",responseValue,outputWriter.toString());
}

Fixed version (ground truth):
public void testDoPostExecutesAndWritesResponse() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(convertRawEnumerationToGeneric(generateOAuthHeader(ROBOT.getAddress())));
  String operationId="String_Node_Str";
  OperationRequest operation=new OperationRequest("String_Node_Str",operationId);
  List<OperationRequest> operations=Collections.singletonList(operation);
  when(robotSerializer.deserializeOperations(anyString())).thenReturn(operations);
  String responseValue="String_Node_Str";
  when(robotSerializer.serialize(any(),any(Type.class),any(ProtocolVersion.class))).thenReturn(responseValue);
  OperationService service=mock(OperationService.class);
  when(operationRegistry.getServiceFor(any(OperationType.class))).thenReturn(service);
  servlet.doPost(req,resp);
  verify(operationRegistry).getServiceFor(any(OperationType.class));
  verify(service).execute(eq(operation),any(OperationContext.class),eq(ROBOT));
  verify(resp).setStatus(HttpServletResponse.SC_OK);
  assertEquals("String_Node_Str",responseValue,outputWriter.toString());
}
Program: 13580
Project: 13580
Buggy source:
public void testDoPostUnauthorizedWhenParticipantInvalid() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(generateOAuthHeader("String_Node_Str"));
  servlet.doPost(req,resp);
  verify(resp).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}

Fixed version (ground truth):
public void testDoPostUnauthorizedWhenParticipantInvalid() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(convertRawEnumerationToGeneric(generateOAuthHeader("String_Node_Str")));
  servlet.doPost(req,resp);
  verify(resp).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}
Program: 13581
Project: 13581
Buggy source:
public void testDoPostUnauthorizedWhenValidationFails() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(generateOAuthHeader(ROBOT.getAddress()));
  doThrow(new OAuthException("String_Node_Str")).when(validator).validateMessage(any(OAuthMessage.class),any(OAuthAccessor.class));
  servlet.doPost(req,resp);
  verify(resp).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}

Fixed version (ground truth):
public void testDoPostUnauthorizedWhenValidationFails() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(convertRawEnumerationToGeneric(generateOAuthHeader(ROBOT.getAddress())));
  doThrow(new OAuthException("String_Node_Str")).when(validator).validateMessage(any(OAuthMessage.class),any(OAuthAccessor.class));
  servlet.doPost(req,resp);
  verify(resp).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}
Program: 13582
Project: 13582
Buggy source:
public void testDoPostUnauthorizedWhenParticipantUnknown() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(generateOAuthHeader(UNKNOWN.getAddress()));
  servlet.doPost(req,resp);
  verify(resp).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}

Fixed version (ground truth):
public void testDoPostUnauthorizedWhenParticipantUnknown() throws Exception {
  when(req.getHeaders("String_Node_Str")).thenReturn(convertRawEnumerationToGeneric(generateOAuthHeader(UNKNOWN.getAddress())));
  servlet.doPost(req,resp);
  verify(resp).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}
Program: 13583
Project: 13583
Buggy source:
@Override protected void setUp() throws Exception {
  robotSerializer=mock(RobotSerializer.class);
  operationRegistry=mock(OperationServiceRegistry.class);
  validator=mock(OAuthValidator.class);
  EventDataConverterManager converterManager=mock(EventDataConverterManager.class);
  WaveletProvider waveletProvider=mock(WaveletProvider.class);
  ConversationUtil conversationUtil=mock(ConversationUtil.class);
  OAuthServiceProvider oAuthServiceProvider=mock(OAuthServiceProvider.class);
  AccountStore accountStore=mock(AccountStore.class);
  when(accountStore.getAccount(ROBOT)).thenReturn(new RobotAccountDataImpl(ROBOT,"String_Node_Str","String_Node_Str",null,true));
  req=mock(HttpServletRequest.class);
  when(req.getRequestURL()).thenReturn(new StringBuffer("String_Node_Str"));
  when(req.getHeaderNames()).thenReturn(new StringTokenizer("String_Node_Str"));
  when(req.getReader()).thenReturn(new BufferedReader(new StringReader("String_Node_Str")));
  resp=mock(HttpServletResponse.class);
  outputWriter=new StringWriter();
  when(resp.getWriter()).thenReturn(new PrintWriter(outputWriter));
  servlet=new ActiveApiServlet(robotSerializer,converterManager,waveletProvider,operationRegistry,conversationUtil,oAuthServiceProvider,validator,accountStore);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  robotSerializer=mock(RobotSerializer.class);
  operationRegistry=mock(OperationServiceRegistry.class);
  validator=mock(OAuthValidator.class);
  EventDataConverterManager converterManager=mock(EventDataConverterManager.class);
  WaveletProvider waveletProvider=mock(WaveletProvider.class);
  ConversationUtil conversationUtil=mock(ConversationUtil.class);
  OAuthServiceProvider oAuthServiceProvider=mock(OAuthServiceProvider.class);
  AccountStore accountStore=mock(AccountStore.class);
  when(accountStore.getAccount(ROBOT)).thenReturn(new RobotAccountDataImpl(ROBOT,"String_Node_Str","String_Node_Str",null,true));
  req=mock(HttpServletRequest.class);
  when(req.getRequestURL()).thenReturn(new StringBuffer("String_Node_Str"));
  when(req.getHeaderNames()).thenReturn(convertRawEnumerationToGeneric(new StringTokenizer("String_Node_Str")));
  when(req.getReader()).thenReturn(new BufferedReader(new StringReader("String_Node_Str")));
  resp=mock(HttpServletResponse.class);
  outputWriter=new StringWriter();
  when(resp.getWriter()).thenReturn(new PrintWriter(outputWriter));
  servlet=new ActiveApiServlet(robotSerializer,converterManager,waveletProvider,operationRegistry,conversationUtil,oAuthServiceProvider,validator,accountStore);
}
Program: 13584
Project: 13584
Buggy source:
public void testDoPostUnauthorizedWhenMissingToken() throws Exception {
  servlet.doPost(req,resp);
  when(req.getParameterMap()).thenReturn(ImmutableMap.of());
  verify(resp).sendError(eq(HttpServletResponse.SC_UNAUTHORIZED),anyString());
}

Fixed version (ground truth):
public void testDoPostUnauthorizedWhenMissingToken() throws Exception {
  servlet.doPost(req,resp);
  Map<String,String[]> emptyMap=Collections.emptyMap();
  when(req.getParameterMap()).thenReturn(emptyMap);
  verify(resp).sendError(eq(HttpServletResponse.SC_UNAUTHORIZED),anyString());
}
Program: 13585
Project: 13585
Buggy source:
@Test public void shouldPersistAttributesForTargeting(){
  HashMap<String,String> map=new HashMap<>();
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  tested.setAttributes(map);
  tested=null;
  tested=new InternalApplicationBootstrapper(new DumbSucessTransport(),testServiceScheduler,testHandlerManager,testHandlerManager.getCustomClock(),bluetoothPlatform,new ResolverConfiguration());
  Assertions.assertThat(tested.attributes.get("String_Node_Str")).isEqualTo("String_Node_Str");
  Assertions.assertThat(tested.attributes.get("String_Node_Str")).isEqualTo("String_Node_Str");
}

Fixed version (ground truth):
@Test public void shouldPersistAttributesForTargeting(){
  HashMap<String,String> map=new HashMap<>();
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  InternalApplicationBootstrapper.saveAttributes(map,gson,sharedPreferences);
  tested=null;
  tested=new InternalApplicationBootstrapper(new DumbSucessTransport(),testServiceScheduler,testHandlerManager,testHandlerManager.getCustomClock(),bluetoothPlatform,new ResolverConfiguration());
  Assertions.assertThat(tested.attributes.get("String_Node_Str")).isEqualTo("String_Node_Str");
  Assertions.assertThat(tested.attributes.get("String_Node_Str")).isEqualTo("String_Node_Str");
}
Program: 13586
Project: 13586
Buggy source:
private void saveAttributes(Map<String,String> attributes){
  String attrs=gson.toJson(attributes);
  Logger.log.logAttributes("String_Node_Str" + attributes.size() + "String_Node_Str");
  preferences.edit().putString(Constants.SharedPreferencesKeys.Data.TARGETING_ATTRIBUTES,attrs).apply();
}

Fixed version (ground truth):
static void saveAttributes(Map<String,String> incoming,Gson gson,SharedPreferences preferences){
  SortedMap<String,String> attributes=new TreeMap<>();
  attributes.putAll(incoming);
  String json=gson.toJson(attributes);
  Logger.log.logAttributes("String_Node_Str" + attributes.size() + "String_Node_Str");
  preferences.edit().putString(Constants.SharedPreferencesKeys.Data.TARGETING_ATTRIBUTES,json).apply();
}
Program: 13588
Project: 13588
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public int onStartCommand(Intent intent,int flags,int startId){
  Logger.log.logServiceState("String_Node_Str");
  if (!bluetoothPlatform.isBluetoothLowEnergySupported()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  if (!platform.registerBroadcastReceiver()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  if (!new PermissionChecker(this).hasScanPermissionCheckAndroid6()) {
    logError("String_Node_Str");
    if (intent != null) {
      String apikey=intent.getStringExtra(SensorbergServiceMessage.EXTRA_API_KEY);
      if (apikey != null && !apikey.isEmpty()) {
        ResolverConfiguration configuration=new ResolverConfiguration();
        configuration.setApiToken(apikey);
        persistConfiguration(configuration);
      }
    }
    return stopSensorbergService();
  }
  SensorbergSdk.init(getBaseContext());
  if (intent == null) {
    return restartSensorbergService();
  }
 else {
    return handleIntent(intent);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public int onStartCommand(Intent intent,int flags,int startId){
  Logger.log.logServiceState("String_Node_Str");
  if (intent != null && intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,0) == MSG_ATTRIBUTES) {
    saveAttributes(intent);
  }
  if (!bluetoothPlatform.isBluetoothLowEnergySupported()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  if (!platform.registerBroadcastReceiver()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  if (!new PermissionChecker(this).hasScanPermissionCheckAndroid6()) {
    logError("String_Node_Str");
    if (intent != null) {
      String apikey=intent.getStringExtra(SensorbergServiceMessage.EXTRA_API_KEY);
      if (apikey != null && !apikey.isEmpty()) {
        ResolverConfiguration configuration=new ResolverConfiguration();
        configuration.setApiToken(apikey);
        persistConfiguration(configuration);
      }
    }
    return stopSensorbergService();
  }
  SensorbergSdk.init(getBaseContext());
  if (intent == null) {
    return restartSensorbergService();
  }
 else {
    return handleIntent(intent);
  }
}
Program: 13589
Project: 13589
Buggy source:
@Test public void still_sees_exit_events_when_bluetooth_is_restarted_in_a_short_interval(){
  ScannerListener mockScannerListener=mock(ScannerListener.class);
  tested.addScannerListener(mockScannerListener);
  bluetoothPlatform.fakeIBeaconSighting();
  verify(mockScannerListener).onScanEventDetected(isEntryEvent());
  tested.stop();
  reset(mockScannerListener);
  testHandlerManager.getCustomClock().increaseTimeInMillis(RANDOM_VALUE_THAT_IS_SHORTER_THAN_CLEAN_BEACONMAP_ON_RESTART_TIMEOUT_BUT_LONGER_THAN_EXIT_EVENT_DELAY);
  tested.start();
  verify(mockScannerListener,never()).onScanEventDetected(isEntryEvent());
  verify(mockScannerListener,never()).onScanEventDetected(isExitEvent());
  long start=testHandlerManager.getCustomClock().now();
  while (testHandlerManager.getCustomClock().now() < start + Utils.EXIT_TIME) {
    testHandlerManager.getCustomClock().increaseTimeInMillis(Utils.ONE_ADVERTISEMENT_INTERVAL);
  }
  verify(mockScannerListener,never()).onScanEventDetected(isExitEvent());
  testHandlerManager.getCustomClock().increaseTimeInMillis(1);
  verify(mockScannerListener).onScanEventDetected(isExitEvent());
  verify(mockScannerListener,never()).onScanEventDetected(isEntryEvent());
}

Fixed version (ground truth):
@Test public void still_sees_exit_events_when_bluetooth_is_restarted_in_a_short_interval(){
  ScannerListener mockScannerListener=mock(ScannerListener.class);
  tested.addScannerListener(mockScannerListener);
  bluetoothPlatform.fakeIBeaconSighting();
  verify(mockScannerListener).onScanEventDetected(isEntryEvent());
  tested.stop();
  reset(mockScannerListener);
  testHandlerManager.getCustomClock().increaseTimeInMillis(RANDOM_VALUE_THAT_IS_SHORTER_THAN_CLEAN_BEACONMAP_ON_RESTART_TIMEOUT_BUT_LONGER_THAN_EXIT_EVENT_DELAY);
  tested.start();
  verify(mockScannerListener,never()).onScanEventDetected(isEntryEvent());
  verify(mockScannerListener,never()).onScanEventDetected(isExitEvent());
  long start=testHandlerManager.getCustomClock().now();
  while (testHandlerManager.getCustomClock().now() < start + Utils.GRACE_TIME - Utils.ONE_ADVERTISEMENT_INTERVAL) {
    testHandlerManager.getCustomClock().increaseTimeInMillis(Utils.ONE_ADVERTISEMENT_INTERVAL);
  }
  verify(mockScannerListener).onScanEventDetected(isExitEvent());
}
Program: 13590
Project: 13590
Buggy source:
@Override public void scheduleAtFixedRate(TimerTask timerTask,int when,long interval){
  this.timerTask=timerTask;
}

Fixed version (ground truth):
@Override public void scheduleAtFixedRate(TimerTask timerTask,long when,long interval){
  this.timerTask=timerTask;
}
Program: 13591
Project: 13591
Buggy source:
@Override public void scheduleAtFixedRate(TimerTask timerTask,int when,long interval){
  if (timer != null) {
    timer.cancel();
    timer=null;
    Logger.log.logError("String_Node_Str");
  }
  timer=new Timer();
  timer.scheduleAtFixedRate(timerTask,when,interval);
}

Fixed version (ground truth):
@Override public void scheduleAtFixedRate(TimerTask timerTask,long when,long interval){
  if (timer != null) {
    timer.cancel();
    timer=null;
    Logger.log.logError("String_Node_Str");
  }
  timer=new Timer();
  timer.scheduleAtFixedRate(timerTask,when,interval);
}
Program: 13592
Project: 13592
Buggy source:
void scheduleAtFixedRate(TimerTask timerTask,int when,long interval);

Fixed version (ground truth):
void scheduleAtFixedRate(TimerTask timerTask,long when,long interval);
Program: 13594
Project: 13594
Buggy source:
private void checkAndExitEnteredBeacons(){
  final long now=clock.now();
  lastExitCheckTimestamp=now;
synchronized (enteredBeaconsMonitor) {
    if (enteredBeacons.size() > 0) {
      enteredBeacons.filter(new BeaconMap.Filter(){
        public boolean filter(        EventEntry beaconEntry,        BeaconId beaconId){
          long timeSinceWeSawTheBeacon=now - lastBreakLength - beaconEntry.getLastBeaconTime();
          if (timeSinceWeSawTheBeacon > settingsManager.getExitTimeoutMillis()) {
            ScanEvent scanEvent=new ScanEvent(beaconId,now,false,locationHelper.getGeohash(),beaconEntry.getPairingId());
            runLoop.sendMessage(ScannerEvent.EVENT_DETECTED,scanEvent);
            Logger.log.beaconResolveState(scanEvent,"String_Node_Str" + (int)(timeSinceWeSawTheBeacon / 1000) + "String_Node_Str");
            return true;
          }
          return false;
        }
      }
);
    }
  }
}

Fixed version (ground truth):
private void checkAndExitEnteredBeacons(){
  final long now=clock.now();
  lastExitCheckTimestamp=now;
synchronized (enteredBeaconsMonitor) {
    if (enteredBeacons.size() > 0) {
      enteredBeacons.filter(new BeaconMap.Filter(){
        public boolean filter(        EventEntry beaconEntry,        BeaconId beaconId){
          long timeSinceWeSawTheBeacon=now - beaconEntry.getLastBeaconTime();
          if (timeSinceWeSawTheBeacon > settingsManager.getExitTimeoutMillis()) {
            ScanEvent scanEvent=new ScanEvent(beaconId,now,false,locationHelper.getGeohash(),beaconEntry.getPairingId());
            runLoop.sendMessage(ScannerEvent.EVENT_DETECTED,scanEvent);
            Logger.log.beaconResolveState(scanEvent,"String_Node_Str" + (int)(timeSinceWeSawTheBeacon / 1000) + "String_Node_Str");
            return true;
          }
          return false;
        }
      }
);
    }
  }
}
Program: 13595
Project: 13595
Buggy source:
@Override public void hostApplicationInForeground(){
  if (isNotSetupForForegroundScanning()) {
    waitTime=settingsManager.getForeGroundWaitTime();
    scanTime=settingsManager.getForeGroundScanTime();
    if (scanning) {
      long lastWaitTime=clock.now() - lastExitCheckTimestamp;
      clearScheduledExecutions();
      if (lastWaitTime > waitTime) {
        Logger.log.scannerStateChange("String_Node_Str");
        runLoop.sendMessage(ScannerEvent.UN_PAUSE_SCAN);
      }
 else {
        long timeRemainingToWait=waitTime - lastWaitTime;
        Logger.log.scannerStateChange("String_Node_Str" + timeRemainingToWait + "String_Node_Str");
        scheduleExecution(ScannerEvent.UN_PAUSE_SCAN,waitTime - lastWaitTime);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void hostApplicationInForeground(){
  if (isNotSetupForForegroundScanning()) {
    waitTime=settingsManager.getForeGroundWaitTime();
    scanTime=settingsManager.getForeGroundScanTime();
    exitGraceTime=settingsManager.getExitForegroundGraceMillis();
    if (exitGraceTime >= scanTime) {
      exitGraceTime=scanTime / 2;
    }
    if (scanning) {
      long lastWaitTime=clock.now() - lastExitCheckTimestamp;
      clearScheduledExecutions();
      if (lastWaitTime > waitTime) {
        Logger.log.scannerStateChange("String_Node_Str");
        runLoop.sendMessage(ScannerEvent.UN_PAUSE_SCAN);
      }
 else {
        long timeRemainingToWait=waitTime - lastWaitTime;
        Logger.log.scannerStateChange("String_Node_Str" + timeRemainingToWait + "String_Node_Str");
        scheduleExecution(ScannerEvent.UN_PAUSE_SCAN,waitTime - lastWaitTime);
      }
    }
  }
}
Program: 13596
Project: 13596
Buggy source:
public boolean filter(EventEntry beaconEntry,BeaconId beaconId){
  long timeSinceWeSawTheBeacon=now - lastBreakLength - beaconEntry.getLastBeaconTime();
  if (timeSinceWeSawTheBeacon > settingsManager.getExitTimeoutMillis()) {
    ScanEvent scanEvent=new ScanEvent(beaconId,now,false,locationHelper.getGeohash(),beaconEntry.getPairingId());
    runLoop.sendMessage(ScannerEvent.EVENT_DETECTED,scanEvent);
    Logger.log.beaconResolveState(scanEvent,"String_Node_Str" + (int)(timeSinceWeSawTheBeacon / 1000) + "String_Node_Str");
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean filter(EventEntry beaconEntry,BeaconId beaconId){
  long timeSinceWeSawTheBeacon=now - beaconEntry.getLastBeaconTime();
  if (timeSinceWeSawTheBeacon > settingsManager.getExitTimeoutMillis()) {
    ScanEvent scanEvent=new ScanEvent(beaconId,now,false,locationHelper.getGeohash(),beaconEntry.getPairingId());
    runLoop.sendMessage(ScannerEvent.EVENT_DETECTED,scanEvent);
    Logger.log.beaconResolveState(scanEvent,"String_Node_Str" + (int)(timeSinceWeSawTheBeacon / 1000) + "String_Node_Str");
    return true;
  }
  return false;
}
Program: 13597
Project: 13597
Buggy source:
@Override public void hostApplicationInBackground(){
  waitTime=settingsManager.getBackgroundWaitTime();
  scanTime=settingsManager.getBackgroundScanTime();
  if ((clock.now() - lastScanStart) > scanTime) {
    Logger.log.scannerStateChange("String_Node_Str");
    clearScheduledExecutions();
    runLoop.sendMessage(ScannerEvent.PAUSE_SCAN);
  }
}

Fixed version (ground truth):
@Override public void hostApplicationInBackground(){
  waitTime=settingsManager.getBackgroundWaitTime();
  scanTime=settingsManager.getBackgroundScanTime();
  exitGraceTime=settingsManager.getExitBackgroundGraceMillis();
  if (exitGraceTime >= scanTime) {
    exitGraceTime=scanTime / 2;
  }
  if ((clock.now() - lastScanStart) > scanTime) {
    Logger.log.scannerStateChange("String_Node_Str");
    clearScheduledExecutions();
    runLoop.sendMessage(ScannerEvent.PAUSE_SCAN);
  }
}
Program: 13598
Project: 13598
Buggy source:
private void loop(){
  if (clock.now() > (started + settingsManager.getExitTimeoutMillis())) {
    if (bluetoothPlatform.isLeScanRunning()) {
      checkAndExitEnteredBeacons();
    }
  }
}

Fixed version (ground truth):
private void loop(){
  if (bluetoothPlatform.isLeScanRunning()) {
    checkAndExitEnteredBeacons();
  }
}