nus-yam/ex-repair huggingface dataset:
Program: 115341
Project: 115341
Buggy source:
@Override public void configureTableFacade(HttpServletResponse response,TableFacade tableFacade){
  super.configureTableFacade(response,tableFacade);
  tableFacade.addFilterMatcher(new MatcherKey(Date.class,"String_Node_Str"),new DateFilterMatcher(getDateFormat()));
  tableFacade.addFilterMatcher(new MatcherKey(Date.class,"String_Node_Str"),new DateFilterMatcher(getDateFormat()));
  tableFacade.addFilterMatcher(new MatcherKey(UserAccountBean.class,"String_Node_Str"),new GenericFilterMatecher());
  tableFacade.addFilterMatcher(new MatcherKey(UserAccountBean.class,"String_Node_Str"),new GenericFilterMatecher());
}

Fixed version (ground truth):
@Override public void configureTableFacade(HttpServletResponse response,TableFacade tableFacade){
  super.configureTableFacade(response,tableFacade);
  tableFacade.addFilterMatcher(new MatcherKey(Date.class,"String_Node_Str"),new DateFilterMatcher(getDateFormat()));
  tableFacade.addFilterMatcher(new MatcherKey(Date.class,"String_Node_Str"),new DateFilterMatcher(getDateFormat()));
  tableFacade.addFilterMatcher(new MatcherKey(UserAccountBean.class,"String_Node_Str"),new GenericFilterMatecher());
  tableFacade.addFilterMatcher(new MatcherKey(UserAccountBean.class,"String_Node_Str"),new GenericFilterMatecher());
  tableFacade.addFilterMatcher(new MatcherKey(String.class,"String_Node_Str"),new StringFilterMatcher());
  tableFacade.addFilterMatcher(new MatcherKey(String.class,"String_Node_Str"),new StringFilterMatcher());
  tableFacade.addFilterMatcher(new MatcherKey(String.class,"String_Node_Str"),new StringFilterMatcher());
  tableFacade.addFilterMatcher(new MatcherKey(String.class,"String_Node_Str"),new StringFilterMatcher());
}
Program: 115343
Project: 115343
Buggy source:
private int getDiscrepancyNoteResolutionStatus(List existingNotes){
  int resolutionStatus=0;
  boolean hasOtherThread=false;
  for (  Object obj : existingNotes) {
    DiscrepancyNoteBean note=(DiscrepancyNoteBean)obj;
    if (note.getParentDnId() == 0) {
      resolutionStatus=note.getResolutionStatusId();
      if (hasOtherThread) {
        if (resolutionStatus > note.getResolutionStatusId()) {
          resolutionStatus=note.getResolutionStatusId();
        }
      }
      hasOtherThread=true;
    }
  }
  return resolutionStatus;
}

Fixed version (ground truth):
private int getDiscrepancyNoteResolutionStatus(List existingNotes){
  int resolutionStatus=0;
  boolean hasOtherThread=false;
  for (  Object obj : existingNotes) {
    DiscrepancyNoteBean note=(DiscrepancyNoteBean)obj;
    if (note.getParentDnId() == 0) {
      if (hasOtherThread) {
        if (resolutionStatus > note.getResolutionStatusId()) {
          resolutionStatus=note.getResolutionStatusId();
        }
      }
 else {
        resolutionStatus=note.getResolutionStatusId();
      }
      hasOtherThread=true;
    }
  }
  return resolutionStatus;
}
Program: 115345
Project: 115345
Buggy source:
public String checkValidityOfItemOrItemGroupOidInCrf(String oid,RuleSetBean ruleSet){
  String[] theOid=oid.split(ESCAPED_SEPERATOR);
  if (theOid.length == 2) {
    ItemGroupBean itemGroup=getItemGroupDao().findByOid(theOid[0]);
    if (itemGroup != null && itemGroup.getCrfId().equals(ruleSet.getCrfId())) {
      ItemBean item=getItemDao().findItemByGroupIdandItemOid(itemGroup.getId(),theOid[1]);
      if (item != null) {
        return "String_Node_Str";
      }
    }
  }
  if (theOid.length == 1) {
    ItemGroupBean itemGroup=getItemGroupDao().findByOid(oid);
    if (itemGroup != null && itemGroup.getCrfId() == ruleSet.getCrf().getId()) {
      return "String_Node_Str";
    }
    ItemBean item=getItemDao().findItemByGroupIdandItemOid(getItemGroupExpression(ruleSet.getTarget().getValue()).getId(),oid);
    if (item != null) {
      return "String_Node_Str";
    }
  }
  return oid;
}

Fixed version (ground truth):
public String checkValidityOfItemOrItemGroupOidInCrf(String oid,RuleSetBean ruleSet){
  String[] theOid=oid.split(ESCAPED_SEPERATOR);
  if (theOid.length == 2) {
    ItemGroupBean itemGroup=getItemGroupDao().findByOid(theOid[0]);
    if (itemGroup != null && itemGroup.getCrfId().equals(ruleSet.getCrfId())) {
      ItemBean item=getItemDao().findItemByGroupIdandItemOid(itemGroup.getId(),theOid[1]);
      if (item != null) {
        return "String_Node_Str";
      }
    }
  }
  if (theOid.length == 1) {
    ItemGroupBean itemGroup=getItemGroupDao().findByOid(oid);
    if (itemGroup != null && itemGroup.getCrfId() == ruleSet.getCrfId()) {
      return "String_Node_Str";
    }
    ItemBean item=getItemDao().findItemByGroupIdandItemOid(getItemGroupExpression(ruleSet.getTarget().getValue()).getId(),oid);
    if (item != null) {
      return "String_Node_Str";
    }
  }
  return oid;
}
Program: 115346
Project: 115346
Buggy source:
protected FindSubjectsFilter getSubjectFilter(Limit limit){
  FindSubjectsFilter auditUserLoginFilter=new FindSubjectsFilter();
  FilterSet filterSet=limit.getFilterSet();
  Collection<Filter> filters=filterSet.getFilters();
  for (  Filter filter : filters) {
    String property=filter.getProperty();
    showMoreLink=auditUserLoginFilter.getColumnMapping().get(property).equals("String_Node_Str");
    String value=filter.getValue();
    auditUserLoginFilter.addFilter(property,value);
  }
  return auditUserLoginFilter;
}

Fixed version (ground truth):
protected FindSubjectsFilter getSubjectFilter(Limit limit){
  FindSubjectsFilter auditUserLoginFilter=new FindSubjectsFilter();
  FilterSet filterSet=limit.getFilterSet();
  Collection<Filter> filters=filterSet.getFilters();
  for (  Filter filter : filters) {
    String property=filter.getProperty();
    showMoreLink=auditUserLoginFilter.getColumnMapping().get(property) == null ? false : auditUserLoginFilter.getColumnMapping().get(property).equals("String_Node_Str");
    String value=filter.getValue();
    auditUserLoginFilter.addFilter(property,value);
  }
  return auditUserLoginFilter;
}
Program: 115348
Project: 115348
Buggy source:
@Override public void configureTableFacadePostColumnConfiguration(TableFacade tableFacade){
  tableFacade.setToolbar(new ListNotesTableToolbar());
}

Fixed version (ground truth):
@Override public void configureTableFacadePostColumnConfiguration(TableFacade tableFacade){
  ListNotesTableToolbar toolbar=new ListNotesTableToolbar();
  tableFacade.setToolbar(toolbar);
  toolbar.setStudyHasDiscNotes(studyHasDiscNotes);
  toolbar.setDiscNoteType(discNoteType);
  toolbar.setResolutionStatus(resolutionStatus);
  toolbar.setModule(module);
  toolbar.setResword(resword);
  tableFacade.setToolbar(toolbar);
}
Program: 115351
Project: 115351
Buggy source:
@Override protected void addToolbarItems(){
  addToolbarItem(ToolbarItemType.SEPARATOR);
  addToolbarItem(createCustomItem(new ShowMoreItem()));
  addToolbarItem(ToolbarItemType.SEPARATOR);
  addToolbarItem(createBackToNotesMatrixListItem());
}

Fixed version (ground truth):
@Override protected void addToolbarItems(){
  addToolbarItem(ToolbarItemType.SEPARATOR);
  addToolbarItem(createCustomItem(new ShowMoreItem()));
  if (this.studyHasDiscNotes) {
    addToolbarItem(createDownloadLinkItem());
  }
  addToolbarItem(ToolbarItemType.SEPARATOR);
  addToolbarItem(createBackToNotesMatrixListItem());
}
Program: 115352
Project: 115352
Buggy source:
@Override public String enabled(){
  HtmlBuilder html=new HtmlBuilder();
  html.a().href("String_Node_Str").id("String_Node_Str");
  html.quote();
  html.quote().close();
  html.nbsp().append("String_Node_Str").nbsp().aEnd();
  return html.toString();
}

Fixed version (ground truth):
@Override public String enabled(){
  HtmlBuilder html=new HtmlBuilder();
  html.a().href("String_Node_Str" + resolutionStatus + "String_Node_Str"+ discNoteType+ "String_Node_Str"+ module+ "String_Node_Str");
  html.quote();
  html.append(getAction());
  html.quote().close();
  html.img().name("String_Node_Str").src("String_Node_Str").border("String_Node_Str").alt(resword.getString("String_Node_Str")).title(resword.getString("String_Node_Str")).append("String_Node_Str").end().aEnd();
  return html.toString();
}
Program: 115353
Project: 115353
Buggy source:
public ItemFormMetadataBean findByItemIdAndCRFVersionId(int itemId,int crfVersionId){
  this.setTypesExpected();
  this.setTypeExpected(27,TypeNames.STRING);
  this.setTypeExpected(28,TypeNames.STRING);
  this.setTypeExpected(29,TypeNames.INT);
  this.setTypeExpected(30,TypeNames.STRING);
  HashMap variables=new HashMap();
  variables.put(new Integer(1),new Integer(itemId));
  variables.put(new Integer(2),new Integer(crfVersionId));
  String sql=digester.getQuery("String_Node_Str");
  ArrayList alist=this.select(sql,variables);
  Iterator it=alist.iterator();
  ItemFormMetadataBean ifmb=new ItemFormMetadataBean();
  HashMap hm=new HashMap();
  if (it.hasNext()) {
    hm=(HashMap)it.next();
    ifmb=(ItemFormMetadataBean)this.getEntityFromHashMap(hm);
  }
  String versionName=(String)hm.get("String_Node_Str");
  String groupLabel=(String)hm.get("String_Node_Str");
  String sectionName=(String)hm.get("String_Node_Str");
  Integer repeatMax=(Integer)hm.get("String_Node_Str");
  int repeatMaxInt=repeatMax != null ? repeatMax.intValue() : 0;
  ifmb.setCrfVersionName(versionName);
  ifmb.setGroupLabel(groupLabel);
  ifmb.setSectionName(sectionName);
  ifmb.setRepeatMax(repeatMaxInt);
  return ifmb;
}

Fixed version (ground truth):
public ItemFormMetadataBean findByItemIdAndCRFVersionId(int itemId,int crfVersionId){
  this.setTypesExpected();
  this.setTypeExpected(28,TypeNames.STRING);
  this.setTypeExpected(29,TypeNames.STRING);
  this.setTypeExpected(30,TypeNames.INT);
  this.setTypeExpected(31,TypeNames.STRING);
  HashMap variables=new HashMap();
  variables.put(new Integer(1),new Integer(itemId));
  variables.put(new Integer(2),new Integer(crfVersionId));
  String sql=digester.getQuery("String_Node_Str");
  ArrayList alist=this.select(sql,variables);
  Iterator it=alist.iterator();
  ItemFormMetadataBean ifmb=new ItemFormMetadataBean();
  HashMap hm=new HashMap();
  if (it.hasNext()) {
    hm=(HashMap)it.next();
    ifmb=(ItemFormMetadataBean)this.getEntityFromHashMap(hm);
  }
  String versionName=(String)hm.get("String_Node_Str");
  String groupLabel=(String)hm.get("String_Node_Str");
  String sectionName=(String)hm.get("String_Node_Str");
  Integer repeatMax=(Integer)hm.get("String_Node_Str");
  int repeatMaxInt=repeatMax != null ? repeatMax.intValue() : 0;
  ifmb.setCrfVersionName(versionName);
  ifmb.setGroupLabel(groupLabel);
  ifmb.setSectionName(sectionName);
  ifmb.setRepeatMax(repeatMaxInt);
  return ifmb;
}
Program: 115356
Project: 115356
Buggy source:
public ItemDataBean getItemDataBeanFromDb(String expression) throws OpenClinicaSystemException {
  if (isExpressionPartial(expression)) {
    throw new OpenClinicaSystemException("String_Node_Str" + expression);
  }
  String studyEventId=getStudyEventDefinitionOidOrdinalFromExpression(expression);
  Integer index=getItemGroupOidOrdinalFromExpression(expression).equals("String_Node_Str") ? 0 : Integer.valueOf(getItemGroupOidOrdinalFromExpression(expression)) - 1;
  List<ItemDataBean> itemData=getItemDataDao().findByStudyEventAndOids(Integer.valueOf(studyEventId),getItemOidFromExpression(expression),getItemGroupOidFromExpression(expression));
  return itemData.size() > 0 ? itemData.get(index) : null;
}

Fixed version (ground truth):
public ItemDataBean getItemDataBeanFromDb(String expression) throws OpenClinicaSystemException {
  if (isExpressionPartial(expression)) {
    throw new OpenClinicaSystemException("String_Node_Str" + expression);
  }
  String studyEventId=getStudyEventDefinitionOidOrdinalFromExpression(expression);
  Integer index=getItemGroupOidOrdinalFromExpression(expression).equals("String_Node_Str") ? 0 : Integer.valueOf(getItemGroupOidOrdinalFromExpression(expression)) - 1;
  List<ItemDataBean> itemData=getItemDataDao().findByStudyEventAndOids(Integer.valueOf(studyEventId),getItemOidFromExpression(expression),getItemGroupOidFromExpression(expression));
  return itemData.size() > index ? itemData.get(index) : null;
}
Program: 115358
Project: 115358
Buggy source:
public ListNotesFilter(){
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public ListNotesFilter(){
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
  columnMapping.put("String_Node_Str","String_Node_Str");
}
Program: 115359
Project: 115359
Buggy source:
private String buildCriteria(String criteria,String property,Object value){
  if (value != null) {
    if (property.equals("String_Node_Str") || property.equals("String_Node_Str") || property.equals("String_Node_Str")) {
      criteria=criteria + "String_Node_Str";
      criteria=criteria + "String_Node_Str" + columnMapping.get(property)+ "String_Node_Str"+ value.toString()+ "String_Node_Str"+ "String_Node_Str";
    }
 else {
      criteria=criteria + "String_Node_Str";
      criteria=criteria + "String_Node_Str" + columnMapping.get(property)+ "String_Node_Str"+ value.toString()+ "String_Node_Str";
    }
  }
  return criteria;
}

Fixed version (ground truth):
private String buildCriteria(String criteria,String property,Object value){
  if (value != null) {
    if (property.equals("String_Node_Str") || property.equals("String_Node_Str") || property.equals("String_Node_Str")) {
      criteria=criteria + "String_Node_Str";
      criteria=criteria + "String_Node_Str" + columnMapping.get(property)+ "String_Node_Str"+ value.toString()+ "String_Node_Str"+ "String_Node_Str";
    }
 else     if (property.equals("String_Node_Str")) {
      criteria=criteria + "String_Node_Str";
      criteria=criteria + "String_Node_Str" + value.toString()+ "String_Node_Str";
    }
 else {
      criteria=criteria + "String_Node_Str";
      criteria=criteria + "String_Node_Str" + columnMapping.get(property)+ "String_Node_Str"+ value.toString()+ "String_Node_Str";
    }
  }
  return criteria;
}
Program: 115366
Project: 115366
Buggy source:
public boolean isConnected(){
  return connected;
}

Fixed version (ground truth):
public final boolean isConnected(){
  return connected;
}
Program: 115367
Project: 115367
Buggy source:
public ChromeCastConnectionEvent(final boolean connected){
  this.connected=connected;
}

Fixed version (ground truth):
ChromeCastConnectionEvent(final boolean connected){
  this.connected=connected;
}
Program: 115368
Project: 115368
Buggy source:
public void setName(String name){
  this.name=name;
}

Fixed version (ground truth):
public final void setName(String name){
  this.name=name;
}
Program: 115369
Project: 115369
Buggy source:
/** 
 * <p>Resume paused media playback</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @throws IOException
 */
public void play() throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  MediaStatus mediaStatus=channel.getMediaStatus(runningApp.transportId);
  if (mediaStatus == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.play(runningApp.transportId,runningApp.sessionId,mediaStatus.mediaSessionId);
}

Fixed version (ground truth):
/** 
 * <p>Resume paused media playback</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @throws IOException
 */
public final void play() throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  MediaStatus mediaStatus=channel.getMediaStatus(runningApp.transportId);
  if (mediaStatus == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.play(runningApp.transportId,runningApp.sessionId,mediaStatus.mediaSessionId);
}
Program: 115370
Project: 115370
Buggy source:
public synchronized void disconnect() throws IOException {
  if (channel == null) {
    return;
  }
  channel.close();
  channel=null;
}

Fixed version (ground truth):
public final synchronized void disconnect() throws IOException {
  if (channel == null) {
    return;
  }
  channel.close();
  channel=null;
}
Program: 115371
Project: 115371
Buggy source:
public String getName(){
  return name;
}

Fixed version (ground truth):
public final String getName(){
  return name;
}
Program: 115372
Project: 115372
Buggy source:
public boolean isConnected(){
  return (channel != null && !channel.isClosed());
}

Fixed version (ground truth):
public final boolean isConnected(){
  return (channel != null && !channel.isClosed());
}
Program: 115373
Project: 115373
Buggy source:
/** 
 * @param muted is to mute or not
 */
public void setMuted(boolean muted) throws IOException {
  channel.setVolume(new Volume(null,muted,Volume.DEFAULT_INCREMENT,Volume.DEFAULT_INCREMENT.doubleValue(),Volume.DEFAULT_CONTROL_TYPE));
}

Fixed version (ground truth):
/** 
 * @param muted is to mute or not
 */
public final void setMuted(boolean muted) throws IOException {
  channel.setVolume(new Volume(null,muted,Volume.DEFAULT_INCREMENT,Volume.DEFAULT_INCREMENT.doubleValue(),Volume.DEFAULT_CONTROL_TYPE));
}
Program: 115374
Project: 115374
Buggy source:
/** 
 * @return current chromecast status - volume, running applications, etc.
 * @throws IOException
 */
public Status getStatus() throws IOException {
  return channel.getStatus();
}

Fixed version (ground truth):
/** 
 * @return current chromecast status - volume, running applications, etc.
 * @throws IOException
 */
public final Status getStatus() throws IOException {
  return channel.getStatus();
}
Program: 115375
Project: 115375
Buggy source:
/** 
 * @return descriptor of currently running application
 * @throws IOException
 */
public Application getRunningApp() throws IOException {
  Status status=getStatus();
  return status.getRunningApp();
}

Fixed version (ground truth):
/** 
 * @return descriptor of currently running application
 * @throws IOException
 */
public final Application getRunningApp() throws IOException {
  Status status=getStatus();
  return status.getRunningApp();
}
Program: 115376
Project: 115376
Buggy source:
/** 
 * <p>Moves current playback time point to specified value</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @param time time point between zero and media duration
 * @throws IOException
 */
public void seek(double time) throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  MediaStatus mediaStatus=channel.getMediaStatus(runningApp.transportId);
  if (mediaStatus == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.seek(runningApp.transportId,runningApp.sessionId,mediaStatus.mediaSessionId,time);
}

Fixed version (ground truth):
/** 
 * <p>Moves current playback time point to specified value</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @param time time point between zero and media duration
 * @throws IOException
 */
public final void seek(double time) throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  MediaStatus mediaStatus=channel.getMediaStatus(runningApp.transportId);
  if (mediaStatus == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.seek(runningApp.transportId,runningApp.sessionId,mediaStatus.mediaSessionId,time);
}
Program: 115377
Project: 115377
Buggy source:
public void registerListener(final ChromeCastSpontaneousEventListener listener){
  this.eventListenerHolder.registerListener(listener);
}

Fixed version (ground truth):
public final void registerListener(final ChromeCastSpontaneousEventListener listener){
  this.eventListenerHolder.registerListener(listener);
}
Program: 115378
Project: 115378
Buggy source:
public void setApplication(String application){
  this.application=application;
}

Fixed version (ground truth):
public final void setApplication(String application){
  this.application=application;
}
Program: 115379
Project: 115379
Buggy source:
/** 
 * <p>Stops currently running application</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @throws IOException
 */
public void stopApp() throws IOException {
  Application runningApp=getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.stop(runningApp.sessionId);
}

Fixed version (ground truth):
/** 
 * <p>Stops currently running application</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @throws IOException
 */
public final void stopApp() throws IOException {
  Application runningApp=getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.stop(runningApp.sessionId);
}
Program: 115380
Project: 115380
Buggy source:
/** 
 * <p>Loads and starts playing specified media</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @param media The media to load and play.  See https://developers.google.com/cast/docs/reference/messages#Load for further details.
 * @return The new media status that resulted from loading the media.
 * @throws IOException
 */
public MediaStatus load(final Media media) throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  return channel.load(runningApp.transportId,runningApp.sessionId,media,true,0d,null);
}

Fixed version (ground truth):
/** 
 * <p>Loads and starts playing specified media</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @param media The media to load and play.See <a href="https://developers.google.com/cast/docs/reference/messages#Load"> https://developers.google.com/cast/docs/reference/messages#Load</a> for more details.
 * @return The new media status that resulted from loading the media.
 * @throws IOException
 */
public final MediaStatus load(final Media media) throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  return channel.load(runningApp.transportId,runningApp.sessionId,media,true,0d,null);
}
Program: 115381
Project: 115381
Buggy source:
public String getAddress(){
  return address;
}

Fixed version (ground truth):
public final String getAddress(){
  return address;
}
Program: 115382
Project: 115382
Buggy source:
public synchronized void connect() throws IOException, GeneralSecurityException {
  if (channel == null) {
    channel=new Channel(getAddress(),getPort(),this.eventListenerHolder);
  }
}

Fixed version (ground truth):
public final synchronized void connect() throws IOException, GeneralSecurityException {
  if (channel == null) {
    channel=new Channel(getAddress(),getPort(),this.eventListenerHolder);
  }
}
Program: 115383
Project: 115383
Buggy source:
public String getApplication(){
  return application;
}

Fixed version (ground truth):
public final String getApplication(){
  return application;
}
Program: 115384
Project: 115384
Buggy source:
public void setAppsURL(String appsURL){
  this.appsURL=appsURL;
}

Fixed version (ground truth):
public final void setAppsURL(String appsURL){
  this.appsURL=appsURL;
}
Program: 115385
Project: 115385
Buggy source:
/** 
 * @param appId    application identifier
 * @return  true if application is available to this chromecast device, false otherwise
 * @throws IOException
 */
public boolean isAppAvailable(String appId) throws IOException {
  return channel.isAppAvailable(appId);
}

Fixed version (ground truth):
/** 
 * @param appId    application identifier
 * @return  true if application is available to this chromecast device, false otherwise
 * @throws IOException
 */
public final boolean isAppAvailable(String appId) throws IOException {
  return channel.isAppAvailable(appId);
}
Program: 115386
Project: 115386
Buggy source:
/** 
 * @param level volume level from 0 to 1 to set
 */
public void setVolume(float level) throws IOException {
  channel.setVolume(new Volume(level,false,Volume.DEFAULT_INCREMENT,Volume.DEFAULT_INCREMENT.doubleValue(),Volume.DEFAULT_CONTROL_TYPE));
}

Fixed version (ground truth):
/** 
 * @param level volume level from 0 to 1 to set
 */
public final void setVolume(float level) throws IOException {
  channel.setVolume(new Volume(level,false,Volume.DEFAULT_INCREMENT,Volume.DEFAULT_INCREMENT.doubleValue(),Volume.DEFAULT_CONTROL_TYPE));
}
Program: 115387
Project: 115387
Buggy source:
/** 
 * @param appId    application identifier
 * @return application descriptor if app successfully launched, null otherwise
 * @throws IOException
 */
public Application launchApp(String appId) throws IOException {
  Status status=channel.launch(appId);
  return status == null ? null : status.getRunningApp();
}

Fixed version (ground truth):
/** 
 * @param appId    application identifier
 * @return application descriptor if app successfully launched, null otherwise
 * @throws IOException
 */
public final Application launchApp(String appId) throws IOException {
  Status status=channel.launch(appId);
  return status == null ? null : status.getRunningApp();
}
Program: 115388
Project: 115388
Buggy source:
/** 
 * <p>Pause current playback</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @throws IOException
 */
public void pause() throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  MediaStatus mediaStatus=channel.getMediaStatus(runningApp.transportId);
  if (mediaStatus == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.pause(runningApp.transportId,runningApp.sessionId,mediaStatus.mediaSessionId);
}

Fixed version (ground truth):
/** 
 * <p>Pause current playback</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @throws IOException
 */
public final void pause() throws IOException {
  Status status=getStatus();
  Application runningApp=status.getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  MediaStatus mediaStatus=channel.getMediaStatus(runningApp.transportId);
  if (mediaStatus == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  channel.pause(runningApp.transportId,runningApp.sessionId,mediaStatus.mediaSessionId);
}
Program: 115389
Project: 115389
Buggy source:
public String getAppsURL(){
  return appsURL;
}

Fixed version (ground truth):
public final String getAppsURL(){
  return appsURL;
}
Program: 115390
Project: 115390
Buggy source:
public void unregisterListener(final ChromeCastSpontaneousEventListener listener){
  this.eventListenerHolder.unregisterListener(listener);
}

Fixed version (ground truth):
public final void unregisterListener(final ChromeCastSpontaneousEventListener listener){
  this.eventListenerHolder.unregisterListener(listener);
}
Program: 115391
Project: 115391
Buggy source:
/** 
 * @param appId application identifier
 * @return true if application with specified identifier is running now
 * @throws IOException
 */
public boolean isAppRunning(String appId) throws IOException {
  Status status=getStatus();
  return status.getRunningApp() != null && appId.equals(status.getRunningApp().id);
}

Fixed version (ground truth):
/** 
 * @param appId application identifier
 * @return true if application with specified identifier is running now
 * @throws IOException
 */
public final boolean isAppRunning(String appId) throws IOException {
  Status status=getStatus();
  return status.getRunningApp() != null && appId.equals(status.getRunningApp().id);
}
Program: 115392
Project: 115392
Buggy source:
public int getPort(){
  return port;
}

Fixed version (ground truth):
public final int getPort(){
  return port;
}
Program: 115393
Project: 115393
Buggy source:
/** 
 * <p>If no application is running at the moment then exception is thrown.</p>
 * @return current media status, state, time, playback rate, etc.
 * @throws IOException
 */
public MediaStatus getMediaStatus() throws IOException {
  Application runningApp=getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  return channel.getMediaStatus(runningApp.transportId);
}

Fixed version (ground truth):
/** 
 * <p>If no application is running at the moment then exception is thrown.</p>
 * @return current media status, state, time, playback rate, etc.
 * @throws IOException
 */
public final MediaStatus getMediaStatus() throws IOException {
  Application runningApp=getRunningApp();
  if (runningApp == null) {
    throw new ChromeCastException("String_Node_Str");
  }
  return channel.getMediaStatus(runningApp.transportId);
}
Program: 115394
Project: 115394
Buggy source:
/** 
 * <p>Sends some generic request to the currently running application. No response is expected as a result of this call.</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @param namespace     request namespace
 * @param request       request object
 * @throws IOException
 */
public void send(String namespace,Request request) throws IOException {
  send(namespace,request,null);
}

Fixed version (ground truth):
/** 
 * <p>Sends some generic request to the currently running application. No response is expected as a result of this call.</p> <p>If no application is running at the moment then exception is thrown.</p>
 * @param namespace     request namespace
 * @param request       request object
 * @throws IOException
 */
public final void send(String namespace,Request request) throws IOException {
  send(namespace,request,null);
}
Program: 115395
Project: 115395
Buggy source:
@Override public void close() throws IOException {
synchronized (closedSync) {
    if (!closed) {
      closed=true;
      notifyListenerOfConnectionEvent(false);
      if (pingTimer != null) {
        pingTimer.cancel();
      }
      if (reader != null) {
        reader.stop=true;
      }
      if (socket != null) {
        socket.close();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
synchronized (closedSync) {
    if (closed) {
      throw new ChromeCastException("String_Node_Str");
    }
 else {
      closed=true;
      notifyListenerOfConnectionEvent(false);
      if (pingTimer != null) {
        pingTimer.cancel();
      }
      if (reader != null) {
        reader.stop=true;
      }
      if (socket != null) {
        socket.close();
      }
    }
  }
}
Program: 115396
Project: 115396
Buggy source:
/** 
 * Open the channel. <p>This function must be called before any other usage.</p>
 * @throws IOException
 * @throws GeneralSecurityException
 */
public void open() throws IOException, GeneralSecurityException {
  if (!closed) {
    throw new IOException("String_Node_Str");
  }
  connect();
}

Fixed version (ground truth):
/** 
 * Open the channel. <p>This function must be called before any other usage.</p>
 * @throws IOException
 * @throws GeneralSecurityException
 */
public void open() throws IOException, GeneralSecurityException {
  if (!closed) {
    throw new ChromeCastException("String_Node_Str");
  }
  connect();
}
Program: 115397
Project: 115397
Buggy source:
@After public void shutdown() throws IOException {
  cast.disconnect();
  chromeCastStub.close();
}

Fixed version (ground truth):
@After public void shutdown() throws IOException {
  if (cast.isConnected()) {
    cast.disconnect();
  }
  chromeCastStub.close();
}
Program: 115398
Project: 115398
Buggy source:
@Override public String toString(){
  return String.format("String_Node_Str",this.namespace,this.message);
}

Fixed version (ground truth):
@Override public final String toString(){
  return String.format("String_Node_Str",this.namespace,this.message);
}
Program: 115399
Project: 115399
Buggy source:
@Override public String toString(){
  final String namespaces=this.namespaces == null ? "String_Node_Str" : Arrays.toString(this.namespaces.toArray());
  return String.format("String_Node_Str",this.id,this.name,this.sessionId,this.statusText,this.transportId,this.isIdleScreen,namespaces);
}

Fixed version (ground truth):
@Override public final String toString(){
  final String namespacesString=this.namespaces == null ? "String_Node_Str" : Arrays.toString(this.namespaces.toArray());
  return String.format("String_Node_Str" + "String_Node_Str",this.id,this.name,this.sessionId,this.statusText,this.transportId,this.isIdleScreen,namespacesString);
}
Program: 115400
Project: 115400
Buggy source:
/** 
 * @param muted is to mute or not
 */
public void setMuted(boolean muted) throws IOException {
  channel.setVolume(new Volume(null,muted,Volume.default_increment,Volume.default_increment.doubleValue(),Volume.default_controlType));
}

Fixed version (ground truth):
/** 
 * @param muted is to mute or not
 */
public void setMuted(boolean muted) throws IOException {
  channel.setVolume(new Volume(null,muted,Volume.DEFAULT_INCREMENT,Volume.DEFAULT_INCREMENT.doubleValue(),Volume.DEFAULT_CONTROL_TYPE));
}
Program: 115401
Project: 115401
Buggy source:
/** 
 * @param level volume level from 0 to 1 to set
 */
public void setVolume(float level) throws IOException {
  channel.setVolume(new Volume(level,false,Volume.default_increment,Volume.default_increment.doubleValue(),Volume.default_controlType));
}

Fixed version (ground truth):
/** 
 * @param level volume level from 0 to 1 to set
 */
public void setVolume(float level) throws IOException {
  channel.setVolume(new Volume(level,false,Volume.DEFAULT_INCREMENT,Volume.DEFAULT_INCREMENT.doubleValue(),Volume.DEFAULT_CONTROL_TYPE));
}
Program: 115402
Project: 115402
Buggy source:
private void SpontaneousEventType(Class<?> dataClass){
  this.dataClass=dataClass;
}

Fixed version (ground truth):
void SpontaneousEventType(Class<?> dataClass){
  this.dataClass=dataClass;
}
Program: 115403
Project: 115403
Buggy source:
public SpontaneousEventType getType(){
  return this.type;
}

Fixed version (ground truth):
public final SpontaneousEventType getType(){
  return this.type;
}
Program: 115404
Project: 115404
Buggy source:
public <T>T getData(Class<T> cls){
  if (!cls.isAssignableFrom(this.type.getDataClass())) {
    throw new IllegalArgumentException("String_Node_Str" + cls + "String_Node_Str"+ this.type.getDataClass());
  }
  return cls.cast(this.data);
}

Fixed version (ground truth):
public final <T>T getData(Class<T> cls){
  if (!cls.isAssignableFrom(this.type.getDataClass())) {
    throw new IllegalArgumentException("String_Node_Str" + cls + "String_Node_Str"+ this.type.getDataClass());
  }
  return cls.cast(this.data);
}
Program: 115405
Project: 115405
Buggy source:
/** 
 * Stops ChromeCast device discovery
 */
public static void stopDiscovery() throws IOException {
  INSTANCE._stopDiscovery();
}

Fixed version (ground truth):
/** 
 * Stops ChromeCast device discovery.
 */
public static void stopDiscovery() throws IOException {
  INSTANCE.doStopDiscovery();
}
Program: 115406
Project: 115406
Buggy source:
@Override public void serviceAdded(ServiceEvent se){
  if (se.getInfo() != null) {
    ChromeCast device=new ChromeCast(mDNS,se.getInfo().getName());
    chromeCasts.add(device);
    for (    ChromeCastsListener listener : listeners) {
      listener.newChromeCastDiscovered(device);
    }
  }
}

Fixed version (ground truth):
@Override public void serviceAdded(ServiceEvent se){
  if (se.getInfo() != null) {
    ChromeCast device=new ChromeCast(mDNS,se.getInfo().getName());
    chromeCasts.add(device);
    for (    ChromeCastsListener nextListener : listeners) {
      nextListener.newChromeCastDiscovered(device);
    }
  }
}
Program: 115407
Project: 115407
Buggy source:
@Override public void serviceRemoved(ServiceEvent se){
  if (ChromeCast.SERVICE_TYPE.equals(se.getType())) {
    List<ChromeCast> copy=get();
    ChromeCast deviceRemoved=null;
    for (    ChromeCast device : copy) {
      if (device.getName().equals(se.getInfo().getName())) {
        deviceRemoved=device;
        chromeCasts.remove(device);
        break;
      }
    }
    if (deviceRemoved != null) {
      for (      ChromeCastsListener listener : listeners) {
        listener.chromeCastRemoved(deviceRemoved);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void serviceRemoved(ServiceEvent se){
  if (ChromeCast.SERVICE_TYPE.equals(se.getType())) {
    List<ChromeCast> copy=get();
    ChromeCast deviceRemoved=null;
    for (    ChromeCast device : copy) {
      if (device.getName().equals(se.getInfo().getName())) {
        deviceRemoved=device;
        chromeCasts.remove(device);
        break;
      }
    }
    if (deviceRemoved != null) {
      for (      ChromeCastsListener nextListener : listeners) {
        nextListener.chromeCastRemoved(deviceRemoved);
      }
    }
  }
}
Program: 115408
Project: 115408
Buggy source:
/** 
 * Starts ChromeCast device discovery
 * @param addr the address of the interface that should be used for discovery
 */
public static void startDiscovery(InetAddress addr) throws IOException {
  INSTANCE._startDiscovery(addr);
}

Fixed version (ground truth):
/** 
 * Starts ChromeCast device discovery.
 * @param addr the address of the interface that should be used for discovery
 */
public static void startDiscovery(InetAddress addr) throws IOException {
  INSTANCE.doStartDiscovery(addr);
}
Program: 115409
Project: 115409
Buggy source:
/** 
 * Restarts discovery by sequentially calling 'stop' and 'start' methods
 * @param addr the address of the interface that should be used for discovery
 */
public static void restartDiscovery(InetAddress addr) throws IOException {
  stopDiscovery();
  startDiscovery(addr);
}

Fixed version (ground truth):
/** 
 * Restarts discovery by sequentially calling 'stop' and 'start' methods.
 * @param addr the address of the interface that should be used for discovery
 */
public static void restartDiscovery(InetAddress addr) throws IOException {
  stopDiscovery();
  startDiscovery(addr);
}
Program: 115410
Project: 115410
Buggy source:
public void chromeCastRemoved(ChromeCast chromecast);

Fixed version (ground truth):
void chromeCastRemoved(ChromeCast chromecast);
Program: 115411
Project: 115411
Buggy source:
public void newChromeCastDiscovered(ChromeCast chromeCast);

Fixed version (ground truth):
void newChromeCastDiscovered(ChromeCast chromeCast);
Program: 115412
Project: 115412
Buggy source:
@Override public void run(){
  while (!stop) {
    try {
      CastChannel.CastMessage message=read();
      if (message.getPayloadType() == CastChannel.CastMessage.PayloadType.STRING) {
        LOG.debug("String_Node_Str",message.getPayloadUtf8());
        final String jsonMSG=message.getPayloadUtf8().replaceFirst("String_Node_Str","String_Node_Str");
        Response parsed=jsonMapper.readValue(jsonMSG,Response.class);
        if (parsed.requestId != null) {
          ResultProcessor rp=requests.remove(parsed.requestId);
          if (rp != null) {
            rp.put(parsed);
          }
 else {
            LOG.warn("String_Node_Str",parsed.requestId,jsonMSG);
          }
        }
 else         if (parsed instanceof Response.Ping) {
          write("String_Node_Str",Message.pong(),DEFAULT_RECEIVER_ID);
        }
      }
 else {
        LOG.warn("String_Node_Str",message.getPayloadType());
      }
    }
 catch (    InvalidProtocolBufferException ipbe) {
      LOG.debug("String_Node_Str",ipbe.getLocalizedMessage());
    }
catch (    IOException ioex) {
      LOG.warn("String_Node_Str",ioex.getLocalizedMessage());
      try {
        close();
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",ioex.getLocalizedMessage());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stop) {
    CastChannel.CastMessage message=null;
    try {
      message=read();
      if (message.getPayloadType() == CastChannel.CastMessage.PayloadType.STRING) {
        final String jsonMSG=message.getPayloadUtf8().replaceFirst("String_Node_Str","String_Node_Str");
        if (!jsonMSG.contains("String_Node_Str")) {
          LOG.warn("String_Node_Str",jsonMSG);
          continue;
        }
        Response parsed=jsonMapper.readValue(jsonMSG,Response.class);
        if (parsed.requestId != null) {
          ResultProcessor rp=requests.remove(parsed.requestId);
          if (rp != null) {
            rp.put(parsed);
          }
 else {
            if (parsed.requestId != 0) {
              LOG.warn("String_Node_Str",parsed.requestId,jsonMSG);
            }
          }
        }
 else         if (parsed instanceof Response.Ping) {
          write("String_Node_Str",Message.pong(),DEFAULT_RECEIVER_ID);
        }
      }
 else {
        LOG.warn("String_Node_Str",message.getPayloadType());
      }
    }
 catch (    InvalidProtocolBufferException ipbe) {
      LOG.debug("String_Node_Str",ipbe.getLocalizedMessage());
    }
catch (    IOException ioex) {
      LOG.warn("String_Node_Str",ioex.getLocalizedMessage());
      LOG.warn("String_Node_Str",message.getPayloadUtf8());
    }
  }
}
Program: 115413
Project: 115413
Buggy source:
MediaStatus(@JsonProperty("String_Node_Str") long mediaSessionId,@JsonProperty("String_Node_Str") int playbackRate,@JsonProperty("String_Node_Str") PlayerState playerState,@JsonProperty("String_Node_Str") float currentTime,@JsonProperty("String_Node_Str") int supportedMediaCommands,@JsonProperty("String_Node_Str") Volume volume,@JsonProperty("String_Node_Str") Media media,@JsonProperty("String_Node_Str") String idleReason){
  this.mediaSessionId=mediaSessionId;
  this.playbackRate=playbackRate;
  this.playerState=playerState;
  this.currentTime=currentTime;
  this.supportedMediaCommands=supportedMediaCommands;
  this.volume=volume;
  this.media=media;
  this.idleReason=idleReason;
}

Fixed version (ground truth):
MediaStatus(@JsonProperty("String_Node_Str") float currentTime,@JsonProperty("String_Node_Str") int playbackRate,@JsonProperty("String_Node_Str") int supportedMediaCommands,@JsonProperty("String_Node_Str") PlayerState playerState,@JsonProperty("String_Node_Str") Media media,@JsonProperty("String_Node_Str") long mediaSessionId,@JsonProperty("String_Node_Str") Volume volume,@JsonProperty("String_Node_Str") RepeatState repeatMode){
  this.currentTime=currentTime;
  this.playbackRate=playbackRate;
  this.supportedMediaCommands=supportedMediaCommands;
  this.playerState=playerState;
  this.media=media;
  this.mediaSessionId=mediaSessionId;
  this.volume=volume;
  this.repeatMode=repeatMode;
}
Program: 115414
Project: 115414
Buggy source:
@Test public void testDeserializationWithIdleReason() throws Exception {
  Response.MediaStatus response=(Response.MediaStatus)jsonMapper.readValue("String_Node_Str",Response.class);
  assertEquals(1,response.statuses.length);
  MediaStatus mediaStatus=response.statuses[0];
  assertEquals("String_Node_Str",mediaStatus.idleReason);
}

Fixed version (ground truth):
@Test public void testDeserializationWithIdleReason() throws Exception {
}
Program: 115415
Project: 115415
Buggy source:
@Test public void testDeserializationWithoutIdleReason() throws Exception {
  Response.MediaStatus response=(Response.MediaStatus)jsonMapper.readValue("String_Node_Str",Response.class);
  assertEquals(1,response.statuses.length);
  MediaStatus mediaStatus=response.statuses[0];
  assertNull(mediaStatus.idleReason);
}

Fixed version (ground truth):
@Test public void testDeserializationWithoutIdleReason() throws Exception {
}
Program: 115416
Project: 115416
Buggy source:
public PartitionMetadata findLeader() throws Exception {
  logger.info("String_Node_Str",partition);
  PartitionMetadata leaderPartitionMetaData=null;
  for (int i=0; i < kafkaBrokersArray.length; i++) {
    String brokerStr=kafkaBrokersArray[i];
    String[] brokerStrTokens=brokerStr.split("String_Node_Str");
    if (brokerStrTokens.length < 2) {
      logger.error("String_Node_Str",brokerStr);
      throw new Exception("String_Node_Str" + brokerStr);
    }
    leaderPartitionMetaData=findLeaderWithBroker(brokerStrTokens[0],brokerStrTokens[1]);
    if (leaderPartitionMetaData != null)     break;
  }
  if (leaderPartitionMetaData == null || leaderPartitionMetaData.leader() == null) {
    logger.error("String_Node_Str" + topic,partition,consumerConfig.kafkaBrokersList);
    throw new Exception("String_Node_Str" + topic + "String_Node_Str"+ partition+ "String_Node_Str"+ consumerConfig.kafkaBrokersList+ "String_Node_Str");
  }
  leaderBrokerHost=leaderPartitionMetaData.leader().host();
  leaderBrokerPort=leaderPartitionMetaData.leader().port();
  leaderBrokerURL=leaderBrokerHost + "String_Node_Str" + leaderBrokerPort;
  logger.info("String_Node_Str",leaderBrokerURL);
  return leaderPartitionMetaData;
}

Fixed version (ground truth):
public PartitionMetadata findLeader() throws Exception {
  logger.info("String_Node_Str",partition);
  PartitionMetadata leaderPartitionMetaData=null;
  for (int i=0; i < kafkaBrokersArray.length; i++) {
    String brokerStr=kafkaBrokersArray[i];
    String[] brokerStrTokens=brokerStr.split("String_Node_Str");
    if (brokerStrTokens.length < 2) {
      logger.error("String_Node_Str",brokerStr);
      throw new Exception("String_Node_Str" + brokerStr);
    }
    leaderPartitionMetaData=findLeaderWithBroker(brokerStrTokens[0],brokerStrTokens[1]);
    if (leaderPartitionMetaData != null)     break;
  }
  if (leaderPartitionMetaData == null || leaderPartitionMetaData.leader() == null) {
    logger.error("String_Node_Str",topic,partition,consumerConfig.kafkaBrokersList);
    throw new Exception("String_Node_Str" + topic + "String_Node_Str"+ partition+ "String_Node_Str"+ consumerConfig.kafkaBrokersList+ "String_Node_Str");
  }
  leaderBrokerHost=leaderPartitionMetaData.leader().host();
  leaderBrokerPort=leaderPartitionMetaData.leader().port();
  leaderBrokerURL=leaderBrokerHost + "String_Node_Str" + leaderBrokerPort;
  logger.info("String_Node_Str",leaderBrokerURL);
  return leaderPartitionMetaData;
}