nus-yam/ex-repair huggingface dataset:
Program: 20827
Project: 20827
Buggy source:
@Override public void launchAppWithInfo(final AppInfo appInfo,Object params,final Launcher.AppLaunchListener listener){
  String uri="String_Node_Str";
  JSONObject payload=new JSONObject();
  final String appId=appInfo.getId();
  String contentId=null;
  if (params != null) {
    try {
      contentId=(String)((JSONObject)params).get("String_Node_Str");
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
  }
  try {
    payload.put("String_Node_Str",appId);
    if (contentId != null) {
      payload.put("String_Node_Str",contentId);
    }
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      JSONObject obj=(JSONObject)response;
      LaunchSession launchSession=new LaunchSession();
      launchSession.setService(WebOSTVService.this);
      launchSession.setAppId(obj.optString("String_Node_Str"));
      launchSession.setSessionId(obj.optString("String_Node_Str"));
      launchSession.setSessionType(LaunchSessionType.App);
      Util.postSuccess(listener,launchSession);
    }
    @Override public void onError(    ServiceCommandError error){
      Util.postError(listener,error);
    }
  }
;
  ServiceCommand<ResponseListener<Object>> request=new ServiceCommand<ResponseListener<Object>>(this,uri,payload,true,responseListener);
  request.send();
}

Fixed version (ground truth):
@Override public void launchAppWithInfo(final AppInfo appInfo,Object params,final Launcher.AppLaunchListener listener){
  String uri="String_Node_Str";
  JSONObject payload=new JSONObject();
  final String appId=appInfo.getId();
  String contentId=null;
  if (params != null) {
    try {
      contentId=(String)((JSONObject)params).get("String_Node_Str");
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
  }
  try {
    payload.put("String_Node_Str",appId);
    if (contentId != null) {
      payload.put("String_Node_Str",contentId);
    }
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      JSONObject obj=(JSONObject)response;
      LaunchSession launchSession=new LaunchSession();
      launchSession.setService(WebOSTVService.this);
      launchSession.setAppId(appId);
      launchSession.setSessionId(obj.optString("String_Node_Str"));
      launchSession.setSessionType(LaunchSessionType.App);
      Util.postSuccess(listener,launchSession);
    }
    @Override public void onError(    ServiceCommandError error){
      Util.postError(listener,error);
    }
  }
;
  ServiceCommand<ResponseListener<Object>> request=new ServiceCommand<ResponseListener<Object>>(this,uri,payload,true,responseListener);
  request.send();
}
Program: 20828
Project: 20828
Buggy source:
@Override public void onRouteRemoved(MediaRouter router,RouteInfo route){
  super.onRouteRemoved(router,route);
}

Fixed version (ground truth):
@Override public void onRouteRemoved(MediaRouter router,RouteInfo route){
  super.onRouteRemoved(router,route);
  CastDevice castDevice=CastDevice.getFromBundle(route.getExtras());
  String uuid=castDevice.getDeviceId();
  if (services.containsKey(uuid)) {
    ServiceDescription serviceDescription=services.get(uuid);
    for (    DiscoveryProviderListener listener : serviceListeners) {
      listener.onServiceRemoved(CastDiscoveryProvider.this,serviceDescription);
    }
    services.remove(uuid);
  }
}
Program: 20829
Project: 20829
Buggy source:
@Override public void closeApp(final LaunchSession launchSession,final ResponseListener<Object> listener){
  getAppState(launchSession.getAppName(),new AppStateListener(){
    @Override public void onSuccess(    AppState state){
      String uri=requestURL(launchSession.getAppName());
      if (state.running) {
        uri+="String_Node_Str";
      }
      ServiceCommand<ResponseListener<Object>> command=new ServiceCommand<ResponseListener<Object>>(launchSession.getService(),uri,null,listener);
      command.setHttpMethod(ServiceCommand.TYPE_DEL);
      command.send();
    }
    @Override public void onError(    ServiceCommandError error){
      Util.postError(listener,error);
    }
  }
);
}

Fixed version (ground truth):
@Override public void closeApp(final LaunchSession launchSession,final ResponseListener<Object> listener){
  getAppState(launchSession.getAppName(),new AppStateListener(){
    @Override public void onSuccess(    AppState state){
      String uri=requestURL(launchSession.getAppName());
      ServiceCommand<ResponseListener<Object>> command=new ServiceCommand<ResponseListener<Object>>(launchSession.getService(),uri,null,listener);
      command.setHttpMethod(ServiceCommand.TYPE_DEL);
      command.send();
    }
    @Override public void onError(    ServiceCommandError error){
      Util.postError(listener,error);
    }
  }
);
}
Program: 20830
Project: 20830
Buggy source:
private String requestURL(String appName){
  String applicationURL=serviceDescription != null ? serviceDescription.getApplicationURL() : null;
  if (applicationURL == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  StringBuilder sb=new StringBuilder();
  sb.append(applicationURL);
  sb.append(appName);
  return sb.toString();
}

Fixed version (ground truth):
private String requestURL(String appName){
  String applicationURL=serviceDescription != null ? serviceDescription.getApplicationURL() : null;
  if (applicationURL == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  StringBuilder sb=new StringBuilder();
  sb.append(applicationURL);
  if (!applicationURL.endsWith("String_Node_Str"))   sb.append("String_Node_Str");
  sb.append(appName);
  return sb.toString();
}
Program: 20831
Project: 20831
Buggy source:
private void probeForAppSupport(){
  if (serviceDescription.getApplicationURL() == null) {
    Log.d("String_Node_Str","String_Node_Str");
    return;
  }
  for (  final String appID : registeredApps) {
    hasApplication(appID,new ResponseListener<Object>(){
      @Override public void onError(      ServiceCommandError error){
      }
      @Override public void onSuccess(      Object object){
        addCapability("String_Node_Str" + appID);
      }
    }
);
  }
}

Fixed version (ground truth):
private void probeForAppSupport(){
  if (serviceDescription.getApplicationURL() == null) {
    Log.d("String_Node_Str","String_Node_Str");
    return;
  }
  for (  final String appID : registeredApps) {
    hasApplication(appID,new ResponseListener<Object>(){
      @Override public void onError(      ServiceCommandError error){
      }
      @Override public void onSuccess(      Object object){
        addCapability("String_Node_Str" + appID);
        addCapability("String_Node_Str" + appID + "String_Node_Str");
      }
    }
);
  }
}
Program: 20832
Project: 20832
Buggy source:
@Override public void onSuccess(Object object){
  addCapability("String_Node_Str" + appID);
}

Fixed version (ground truth):
@Override public void onSuccess(Object object){
  addCapability("String_Node_Str" + appID);
  addCapability("String_Node_Str" + appID + "String_Node_Str");
}
Program: 20833
Project: 20833
Buggy source:
public RokuService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
}

Fixed version (ground truth):
public RokuService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
  probeForAppSupport();
}
Program: 20834
Project: 20834
Buggy source:
@Override public void onSuccess(Object response){
}

Fixed version (ground truth):
@Override public void onSuccess(List<AppInfo> object){
  List<String> appsToAdd=new ArrayList<String>();
  for (  String probe : registeredApps) {
    for (    AppInfo app : object) {
      if (app.getName().contains(probe)) {
        appsToAdd.add("String_Node_Str" + probe);
        appsToAdd.add("String_Node_Str" + probe + "String_Node_Str");
      }
    }
  }
  addCapabilities(appsToAdd);
}
Program: 20835
Project: 20835
Buggy source:
/** 
 * Compares two ChannelInfo objects.
 * @param channelInfo ChannelInfo object to compare.
 * @return YES if both ChannelInfo number & name values are equal
 */
@Override public boolean equals(Object o){
  if (o instanceof ChannelInfo) {
    ChannelInfo other=(ChannelInfo)o;
    return this.channelId.equals(other.channelId) && this.channelName.equals(other.channelName) && this.channelNumber.equals(other.channelNumber)&& this.majorNumber == other.majorNumber && this.minorNumber == other.minorNumber;
  }
  return super.equals(o);
}

Fixed version (ground truth):
/** 
 * Compares two ChannelInfo objects.
 * @param channelInfo ChannelInfo object to compare.
 * @return YES if both ChannelInfo number & name values are equal
 */
@Override public boolean equals(Object o){
  if (o instanceof ChannelInfo) {
    ChannelInfo other=(ChannelInfo)o;
    if (this.channelId != null) {
      if (this.channelId.equals(other.channelId))       return true;
    }
 else     if (this.channelName != null && this.channelNumber != null) {
      return this.channelName.equals(other.channelName) && this.channelNumber.equals(other.channelNumber) && this.majorNumber == other.majorNumber && this.minorNumber == other.minorNumber;
    }
    Log.d(TAG,"String_Node_Str");
    Log.d(TAG,"String_Node_Str" + this.rawData.toString());
    Log.d(TAG,"String_Node_Str" + other.rawData.toString());
    return false;
  }
  return super.equals(o);
}
Program: 20836
Project: 20836
Buggy source:
@Override public void run(){
  for (  ConnectableDeviceListener listener : listeners)   listener.onDeviceDisconnected(ConnectableDevice.this);
}

Fixed version (ground truth):
@Override public void run(){
  for (  ConnectableDeviceListener listener : listeners)   listener.onDeviceReady(ConnectableDevice.this);
}
Program: 20837
Project: 20837
Buggy source:
@Override public void onConnectionSuccess(DeviceService service){
  if (isConnected()) {
    ConnectableDeviceStore deviceStore=DiscoveryManager.getInstance().getConnectableDeviceStore();
    if (deviceStore != null) {
      deviceStore.addDevice(this);
    }
    for (    ConnectableDeviceListener listener : listeners)     listener.onDeviceReady(ConnectableDevice.this);
    setLastConnected(Util.getTime());
  }
}

Fixed version (ground truth):
@Override public void onConnectionSuccess(DeviceService service){
  if (isConnected()) {
    ConnectableDeviceStore deviceStore=DiscoveryManager.getInstance().getConnectableDeviceStore();
    if (deviceStore != null) {
      deviceStore.addDevice(this);
    }
    Util.runOnUI(new Runnable(){
      @Override public void run(){
        for (        ConnectableDeviceListener listener : listeners)         listener.onDeviceReady(ConnectableDevice.this);
      }
    }
);
    setLastConnected(Util.getTime());
  }
}
Program: 20838
Project: 20838
Buggy source:
public CastService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
  mCastClientListener=new CastListener();
  mConnectionCallbacks=new ConnectionCallbacks();
  mConnectionFailedListener=new ConnectionFailedListener();
}

Fixed version (ground truth):
public CastService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  mCastClientListener=new CastListener();
  mConnectionCallbacks=new ConnectionCallbacks();
  mConnectionFailedListener=new ConnectionFailedListener();
}
Program: 20839
Project: 20839
Buggy source:
private void setCapabilities(){
  appendCapabilites(MediaPlayer.Capabilities);
  appendCapabilites(VolumeControl.Capabilities);
  appendCapabilites(Play,Pause,Stop,Duration,Seek,Position,Launch,Message_Send,Message_Receive,Message_Send_JSON,Message_Receive_JSON,WebAppLauncher.Close);
}

Fixed version (ground truth):
@Override protected void setCapabilities(){
  appendCapabilites(MediaPlayer.Capabilities);
  appendCapabilites(VolumeControl.Capabilities);
  appendCapabilites(Play,Pause,Stop,Duration,Seek,Position,Launch,Message_Send,Message_Receive,Message_Send_JSON,Message_Receive_JSON,WebAppLauncher.Close);
}
Program: 20840
Project: 20840
Buggy source:
private void setCapabilities(){
  appendCapabilites(Display_Image,Display_Video,Play,MetaData_Title,MetaData_MimeType,Duration,Position,Seek);
}

Fixed version (ground truth):
@Override protected void setCapabilities(){
  appendCapabilites(Display_Image,Display_Video,Play,MetaData_Title,MetaData_MimeType,Duration,Position,Seek);
}
Program: 20841
Project: 20841
Buggy source:
public DLNAService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
}

Fixed version (ground truth):
public DLNAService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
}
Program: 20842
Project: 20842
Buggy source:
public DeviceService(ServiceConfig serviceConfig){
  this.serviceConfig=serviceConfig;
  mCapabilities=new ArrayList<String>();
}

Fixed version (ground truth):
public DeviceService(ServiceConfig serviceConfig){
  this.serviceConfig=serviceConfig;
  mCapabilities=new ArrayList<String>();
  setCapabilities();
}
Program: 20843
Project: 20843
Buggy source:
public NetcastTVService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  dlnaService=new DLNAService(serviceDescription,serviceConfig);
  if (serviceDescription.getPort() != 8080)   serviceDescription.setPort(8080);
  setCapabilities();
  applications=new ArrayList<AppInfo>();
  subscriptions=new ArrayList<URLServiceSubscription<?>>();
  keyboardString=new StringBuilder();
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
  state=State.INITIAL;
  inputPickerSession=null;
}

Fixed version (ground truth):
public NetcastTVService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  dlnaService=new DLNAService(serviceDescription,serviceConfig);
  if (serviceDescription.getPort() != 8080)   serviceDescription.setPort(8080);
  applications=new ArrayList<AppInfo>();
  subscriptions=new ArrayList<URLServiceSubscription<?>>();
  keyboardString=new StringBuilder();
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
  state=State.INITIAL;
  inputPickerSession=null;
}
Program: 20844
Project: 20844
Buggy source:
@Override public void sendPairingKey(final String pairingKey){
  state=State.PAIRING;
  if (!(serviceConfig instanceof NetcastTVServiceConfig)) {
    serviceConfig=new NetcastTVServiceConfig(serviceConfig.getServiceUUID());
  }
  ((NetcastTVServiceConfig)serviceConfig).setPairingKey(pairingKey);
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      state=State.PAIRED;
      if (DiscoveryManager.getInstance().getConnectableDeviceStore() != null) {
        ConnectableDevice storedDevice=DiscoveryManager.getInstance().getConnectableDeviceStore().getDevice(serviceConfig.getServiceUUID());
        if (storedDevice == null) {
          storedDevice=new ConnectableDevice(serviceDescription.getIpAddress(),serviceDescription.getFriendlyName(),serviceDescription.getModelName(),serviceDescription.getModelNumber());
        }
        storedDevice.addService(NetcastTVService.this);
        DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(storedDevice);
      }
      hConnectSuccess();
    }
    @Override public void onError(    ServiceCommandError error){
      state=State.INITIAL;
      if (listener != null)       listener.onConnectionFailure(NetcastTVService.this,error);
    }
  }
;
  String requestURL=getUDAPRequestURL(UDAP_PATH_PAIRING);
  Map<String,String> params=new HashMap<String,String>();
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str",pairingKey);
  params.put("String_Node_Str",String.valueOf(serviceDescription.getPort()));
  String httpMessage=getUDAPMessageBody(UDAP_API_PAIRING,params);
  ServiceCommand<ResponseListener<Object>> command=new ServiceCommand<ResponseListener<Object>>(this,requestURL,httpMessage,responseListener);
  command.send();
}

Fixed version (ground truth):
@Override public void sendPairingKey(final String pairingKey){
  state=State.PAIRING;
  if (!(serviceConfig instanceof NetcastTVServiceConfig)) {
    serviceConfig=new NetcastTVServiceConfig(serviceConfig.getServiceUUID());
  }
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      state=State.PAIRED;
      ((NetcastTVServiceConfig)serviceConfig).setPairingKey(pairingKey);
      hConnectSuccess();
    }
    @Override public void onError(    ServiceCommandError error){
      state=State.INITIAL;
      if (listener != null)       listener.onConnectionFailure(NetcastTVService.this,error);
    }
  }
;
  String requestURL=getUDAPRequestURL(UDAP_PATH_PAIRING);
  Map<String,String> params=new HashMap<String,String>();
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str",pairingKey);
  params.put("String_Node_Str",String.valueOf(serviceDescription.getPort()));
  String httpMessage=getUDAPMessageBody(UDAP_API_PAIRING,params);
  ServiceCommand<ResponseListener<Object>> command=new ServiceCommand<ResponseListener<Object>>(this,requestURL,httpMessage,responseListener);
  command.send();
}
Program: 20845
Project: 20845
Buggy source:
private void setCapabilities(){
  if (DiscoveryManager.getInstance().getPairingLevel() == PairingLevel.ON) {
    appendCapabilites(TextInputControl.Capabilities);
    appendCapabilites(MouseControl.Capabilities);
    appendCapabilites(KeyControl.Capabilities);
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(PowerControl.Off,Play,Pause,Stop,Rewind,FastForward,Duration,Position,Seek,MetaData_Title,MetaData_MimeType,Application,Application_Close,Application_List,Browser,Hulu,Netflix,Netflix_Params,YouTube,YouTube_Params,AppStore,AppStore_Params,Channel_Up,Channel_Down,Channel_Get,Channel_List,Channel_Subscribe,Get_3D,Set_3D,Subscribe_3D,Picker_Launch,Picker_Close,Volume_Get,Volume_Up_Down,Mute_Get,Mute_Set);
  }
 else {
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(Play,Pause,Stop,Rewind,FastForward,YouTube,YouTube_Params);
  }
}

Fixed version (ground truth):
@Override protected void setCapabilities(){
  if (DiscoveryManager.getInstance().getPairingLevel() == PairingLevel.ON) {
    appendCapabilites(TextInputControl.Capabilities);
    appendCapabilites(MouseControl.Capabilities);
    appendCapabilites(KeyControl.Capabilities);
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(PowerControl.Off,Play,Pause,Stop,Rewind,FastForward,Duration,Position,Seek,MetaData_Title,MetaData_MimeType,Application,Application_Close,Application_List,Browser,Hulu,Netflix,Netflix_Params,YouTube,YouTube_Params,AppStore,AppStore_Params,Channel_Up,Channel_Down,Channel_Get,Channel_List,Channel_Subscribe,Get_3D,Set_3D,Subscribe_3D,Picker_Launch,Picker_Close,Volume_Get,Volume_Up_Down,Mute_Get,Mute_Set);
  }
 else {
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(Play,Pause,Stop,Rewind,FastForward,YouTube,YouTube_Params);
  }
}
Program: 20846
Project: 20846
Buggy source:
private void setCapabilities(){
  appendCapabilites(KeyControl.Capabilities);
  appendCapabilites(Application,Application_Params,Application_List,AppStore,AppStore_Params,Application_Close,Display_Image,Display_Video,Display_Audio,Close,MetaData_Title,FastForward,Rewind,Play,Pause,Send,Send_Delete,Send_Enter);
}

Fixed version (ground truth):
@Override protected void setCapabilities(){
  appendCapabilites(KeyControl.Capabilities);
  appendCapabilites(Application,Application_Params,Application_List,AppStore,AppStore_Params,Application_Close,Display_Image,Display_Video,Display_Audio,Close,MetaData_Title,FastForward,Rewind,Play,Pause,Send,Send_Delete,Send_Enter);
}
Program: 20847
Project: 20847
Buggy source:
public RokuService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  serviceDescription.setPort(8060);
  setCapabilities();
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
  probeForAppSupport();
}

Fixed version (ground truth):
public RokuService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  serviceDescription.setPort(8060);
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
  probeForAppSupport();
}
Program: 20848
Project: 20848
Buggy source:
private void setCapabilities(){
  if (DiscoveryManager.getInstance().getPairingLevel() == PairingLevel.ON) {
    appendCapabilites(TextInputControl.Capabilities);
    appendCapabilites(MouseControl.Capabilities);
    appendCapabilites(KeyControl.Capabilities);
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(Launcher.Capabilities);
    appendCapabilites(TVControl.Capabilities);
    appendCapabilites(ExternalInputControl.Capabilities);
    appendCapabilites(VolumeControl.Capabilities);
    appendCapabilites(MediaControl.Capabilities);
    appendCapabilites(ToastControl.Capabilities);
    appendCapability(PowerControl.Off);
  }
 else {
    appendCapabilites(VolumeControl.Capabilities);
    appendCapabilites(MediaControl.Capabilities);
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(Application,Application_Params,Application_Close,Browser,Browser_Params,Hulu,Netflix,Netflix_Params,YouTube,YouTube_Params,AppStore,AppStore_Params,AppState,AppState_Subscribe);
  }
  if (!serviceDescription.getVersion().contains("String_Node_Str") && !serviceDescription.getVersion().contains("String_Node_Str")) {
    appendCapabilites(WebAppLauncher.Capabilities);
  }
 else {
    appendCapabilites(Launch,Launch_Params,WebAppLauncher.Close);
  }
}

Fixed version (ground truth):
@Override protected void setCapabilities(){
  if (DiscoveryManager.getInstance().getPairingLevel() == PairingLevel.ON) {
    appendCapabilites(TextInputControl.Capabilities);
    appendCapabilites(MouseControl.Capabilities);
    appendCapabilites(KeyControl.Capabilities);
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(Launcher.Capabilities);
    appendCapabilites(TVControl.Capabilities);
    appendCapabilites(ExternalInputControl.Capabilities);
    appendCapabilites(VolumeControl.Capabilities);
    appendCapabilites(MediaControl.Capabilities);
    appendCapabilites(ToastControl.Capabilities);
    appendCapability(PowerControl.Off);
  }
 else {
    appendCapabilites(VolumeControl.Capabilities);
    appendCapabilites(MediaControl.Capabilities);
    appendCapabilites(MediaPlayer.Capabilities);
    appendCapabilites(Application,Application_Params,Application_Close,Browser,Browser_Params,Hulu,Netflix,Netflix_Params,YouTube,YouTube_Params,AppStore,AppStore_Params,AppState,AppState_Subscribe);
  }
  if (!serviceDescription.getVersion().contains("String_Node_Str") && !serviceDescription.getVersion().contains("String_Node_Str")) {
    appendCapabilites(WebAppLauncher.Capabilities);
  }
 else {
    appendCapabilites(Launch,Launch_Params,WebAppLauncher.Close);
  }
}
Program: 20849
Project: 20849
Buggy source:
public WebOSTVService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setServiceDescription(serviceDescription);
  state=State.INITIAL;
  pairingType=PairingType.FIRST_SCREEN;
  mAppToAppSubscriptions=new HashMap<String,URLServiceSubscription<ResponseListener<Object>>>();
  mAppToAppMessageListeners=new HashMap<String,MessageListener>();
  setCapabilities();
  setDefaultManifest();
}

Fixed version (ground truth):
public WebOSTVService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setServiceDescription(serviceDescription);
  state=State.INITIAL;
  pairingType=PairingType.FIRST_SCREEN;
  mAppToAppSubscriptions=new HashMap<String,URLServiceSubscription<ResponseListener<Object>>>();
  mAppToAppMessageListeners=new HashMap<String,MessageListener>();
  setDefaultManifest();
}
Program: 20850
Project: 20850
Buggy source:
public URLServiceSubscription(DeviceService service,String uri,JSONObject payload,boolean isWebOS,ResponseListener<Object> listener){
  super(service,uri,payload,isWebOS,listener);
}

Fixed version (ground truth):
public URLServiceSubscription(DeviceService service,String uri,JSONObject payload,boolean isWebOS,ResponseListener<Object> listener){
  super(service,uri,payload,isWebOS,listener);
  if (isWebOS)   httpMethod="String_Node_Str";
}
Program: 20851
Project: 20851
Buggy source:
private void sendData(){
  waiting=true;
  String uri;
  String typeTest=toSend.get(0);
  JSONObject payload=new JSONObject();
  if (typeTest.equals(ENTER)) {
    toSend.remove(0);
    uri="String_Node_Str";
  }
 else   if (typeTest.equals(DELETE)) {
    uri="String_Node_Str";
    int count=0;
    while (toSend.size() > 0 && toSend.get(0).equals(DELETE)) {
      toSend.remove(0);
      count++;
    }
    try {
      payload.put("String_Node_Str",count);
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
  }
 else {
    uri="String_Node_Str";
    StringBuilder sb=new StringBuilder();
    while (toSend.size() > 0 && !(toSend.get(0).equals(DELETE) || toSend.get(0).equals(ENTER))) {
      String text=toSend.get(0);
      sb.append(text);
      toSend.remove(0);
    }
    try {
      payload.put("String_Node_Str",sb.toString());
      payload.put("String_Node_Str",0);
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
  }
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      waiting=false;
      if (toSend.size() > 0)       sendData();
    }
    @Override public void onError(    ServiceCommandError error){
      waiting=false;
      if (toSend.size() > 0)       sendData();
    }
  }
;
  ServiceCommand<ResponseListener<Object>> request=new ServiceCommand<ResponseListener<Object>>(service,uri,payload,responseListener);
  request.send();
}

Fixed version (ground truth):
private void sendData(){
  waiting=true;
  String uri;
  String typeTest=toSend.get(0);
  JSONObject payload=new JSONObject();
  if (typeTest.equals(ENTER)) {
    toSend.remove(0);
    uri="String_Node_Str";
  }
 else   if (typeTest.equals(DELETE)) {
    uri="String_Node_Str";
    int count=0;
    while (toSend.size() > 0 && toSend.get(0).equals(DELETE)) {
      toSend.remove(0);
      count++;
    }
    try {
      payload.put("String_Node_Str",count);
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
  }
 else {
    uri="String_Node_Str";
    StringBuilder sb=new StringBuilder();
    while (toSend.size() > 0 && !(toSend.get(0).equals(DELETE) || toSend.get(0).equals(ENTER))) {
      String text=toSend.get(0);
      sb.append(text);
      toSend.remove(0);
    }
    try {
      payload.put("String_Node_Str",sb.toString());
      payload.put("String_Node_Str",0);
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
  }
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      waiting=false;
      if (toSend.size() > 0)       sendData();
    }
    @Override public void onError(    ServiceCommandError error){
      waiting=false;
      if (toSend.size() > 0)       sendData();
    }
  }
;
  ServiceCommand<ResponseListener<Object>> request=new ServiceCommand<ResponseListener<Object>>(service,uri,payload,true,responseListener);
  request.send();
}
Program: 20852
Project: 20852
Buggy source:
public URLServiceSubscription<TextInputStatusListener> connect(final TextInputStatusListener listener){
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      JSONObject jsonObj=(JSONObject)response;
      TextInputStatusInfo keyboard=parseRawKeyboardData(jsonObj);
      Util.postSuccess(listener,keyboard);
    }
    @Override public void onError(    ServiceCommandError error){
      Util.postError(listener,error);
    }
  }
;
  URLServiceSubscription<TextInputStatusListener> subscription=new URLServiceSubscription<TextInputStatusListener>(service,KEYBOARD_INPUT,null,responseListener);
  subscription.send();
  return subscription;
}

Fixed version (ground truth):
public URLServiceSubscription<TextInputStatusListener> connect(final TextInputStatusListener listener){
  ResponseListener<Object> responseListener=new ResponseListener<Object>(){
    @Override public void onSuccess(    Object response){
      JSONObject jsonObj=(JSONObject)response;
      TextInputStatusInfo keyboard=parseRawKeyboardData(jsonObj);
      Util.postSuccess(listener,keyboard);
    }
    @Override public void onError(    ServiceCommandError error){
      Util.postError(listener,error);
    }
  }
;
  URLServiceSubscription<TextInputStatusListener> subscription=new URLServiceSubscription<TextInputStatusListener>(service,KEYBOARD_INPUT,null,true,responseListener);
  subscription.send();
  return subscription;
}
Program: 20854
Project: 20854
Buggy source:
public WebOSTVService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setServiceDescription(serviceDescription);
  state=State.INITIAL;
  pairingType=PairingType.FIRST_SCREEN;
  mAppToAppSubscriptions=new HashMap<String,URLServiceSubscription<ResponseListener<Object>>>();
  mAppToAppMessageListeners=new HashMap<String,MessageListener>();
  setDefaultManifest();
}

Fixed version (ground truth):
public WebOSTVService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setServiceDescription(serviceDescription);
  state=State.INITIAL;
  pairingType=PairingType.FIRST_SCREEN;
  mAppToAppSubscriptions=new ConcurrentHashMap<String,URLServiceSubscription<ResponseListener<Object>>>();
  mAppToAppMessageListeners=new ConcurrentHashMap<String,MessageListener>();
  setDefaultManifest();
}
Program: 20855
Project: 20855
Buggy source:
@Override public void close(ResponseListener<Object> listener){
  connected=false;
  mActiveCommands.clear();
  if (mPlayStateSubscription != null) {
    mPlayStateSubscription.unsubscribe();
    mPlayStateSubscription=null;
  }
  if (mMessageSubscription != null) {
    mMessageSubscription.unsubscribe();
    mMessageSubscription=null;
  }
  service.getWebAppLauncher().closeWebApp(launchSession,listener);
}

Fixed version (ground truth):
@Override public void close(ResponseListener<Object> listener){
  connected=false;
  mActiveCommands.clear();
  if (mPlayStateSubscription != null) {
    mPlayStateSubscription.unsubscribe();
    mPlayStateSubscription=null;
  }
  if (mMessageSubscription != null) {
    mMessageSubscription.unsubscribe();
    mMessageSubscription=null;
  }
  if (launchSession.getSessionId() != null)   service.disconnectFromWebApp(this);
  service.getWebAppLauncher().closeWebApp(launchSession,listener);
}
Program: 20856
Project: 20856
Buggy source:
@Override public void onConnectionSuccess(DeviceService service){
  if (isConnected()) {
    DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(this);
    if (listener != null)     listener.onDeviceReady(ConnectableDevice.this);
    setLastConnected(Util.getTime());
  }
}

Fixed version (ground truth):
@Override public void onConnectionSuccess(DeviceService service){
  if (isConnected()) {
    if (DiscoveryManager.getInstance().getConnectableDeviceStore() != null)     DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(this);
    if (listener != null)     listener.onDeviceReady(ConnectableDevice.this);
    setLastConnected(Util.getTime());
  }
}
Program: 20857
Project: 20857
Buggy source:
public CastService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
  this.castDevice=((CastServiceDescription)serviceDescription).getCastDevice();
  mCastClientListener=new CastListener();
  mConnectionCallbacks=new ConnectionCallbacks();
  mConnectionFailedListener=new ConnectionFailedListener();
  Cast.CastOptions.Builder apiOptionsBuilder=Cast.CastOptions.builder(castDevice,mCastClientListener);
  mApiClient=new GoogleApiClient.Builder(DiscoveryManager.getInstance().getContext()).addApi(Cast.API,apiOptionsBuilder.build()).addConnectionCallbacks(mConnectionCallbacks).addOnConnectionFailedListener(mConnectionFailedListener).build();
}

Fixed version (ground truth):
public CastService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
  mCastClientListener=new CastListener();
  mConnectionCallbacks=new ConnectionCallbacks();
  mConnectionFailedListener=new ConnectionFailedListener();
}
Program: 20858
Project: 20858
Buggy source:
@Override public void joinWebApp(final LaunchSession webAppLaunchSession,final WebAppSession.LaunchListener listener){
  Cast.CastApi.joinApplication(mApiClient,webAppLaunchSession.getAppId(),webAppLaunchSession.getSessionId()).setResultCallback(new ResultCallback<Cast.ApplicationConnectionResult>(){
    @Override public void onResult(    Cast.ApplicationConnectionResult result){
      Status status=result.getStatus();
      if (status.isSuccess()) {
        Util.postSuccess(listener,new CastWebAppSession(webAppLaunchSession,CastService.this));
      }
 else {
        Util.postError(listener,new ServiceCommandError(result.getStatus().getStatusCode(),result.getStatus().toString(),result));
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void joinWebApp(String webAppId,WebAppSession.LaunchListener listener){
  LaunchSession launchSession=LaunchSession.launchSessionForAppId(webAppId);
  launchSession.setSessionType(LaunchSessionType.WebApp);
  launchSession.setService(this);
  joinWebApp(launchSession,listener);
}
Program: 20859
Project: 20859
Buggy source:
@Override public void joinWebApp(final LaunchSession webAppLaunchSession,final WebAppSession.LaunchListener listener){
  final WebOSWebAppSession webAppSession=new WebOSWebAppSession(webAppLaunchSession,this);
  webAppSession.join(new ResponseListener<Object>(){
    @Override public void onError(    ServiceCommandError error){
      Util.postError(listener,error);
    }
    @Override public void onSuccess(    Object object){
      Util.postSuccess(listener,webAppSession);
    }
  }
);
}

Fixed version (ground truth):
@Override public void joinWebApp(String webAppId,WebAppSession.LaunchListener listener){
  LaunchSession launchSession=LaunchSession.launchSessionForAppId(webAppId);
  launchSession.setSessionType(LaunchSessionType.WebApp);
  launchSession.setService(this);
  joinWebApp(launchSession,listener);
}
Program: 20861
Project: 20861
Buggy source:
public void joinWebApp(LaunchSession webAppLaunchSession,LaunchListener listener);

Fixed version (ground truth):
public void joinWebApp(String webAppId,LaunchListener listener);
Program: 20862
Project: 20862
Buggy source:
/** 
 * Enumerates through all DeviceServices and attempts to connect to each of them. When all of a ConnectableDevice's DeviceServices are ready to receive commands, the ConnectableDevice will send a onDeviceReady message to its listener. It is always necessary to call connect on a ConnectableDevice, even if it contains no connectable DeviceServices.
 */
public void connect(){
  boolean isDeviceReady=true;
  for (  DeviceService service : services.values()) {
    if (service.isServiceReady() == false) {
      service.setServiceReadyListener(serviceReadyListener);
      isDeviceReady=false;
    }
    service.setDeviceListeners(deviceListeners);
    service.connect();
  }
  if (isDeviceReady == true) {
    Util.runOnUI(new Runnable(){
      @Override public void run(){
        for (        ConnectableDeviceListenerPair pair : deviceListeners) {
          pair.listener.onDeviceReady(pair.device);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Enumerates through all DeviceServices and attempts to connect to each of them. When all of a ConnectableDevice's DeviceServices are ready to receive commands, the ConnectableDevice will send a onDeviceReady message to its listener. It is always necessary to call connect on a ConnectableDevice, even if it contains no connectable DeviceServices.
 */
public void connect(){
  for (  DeviceService service : services.values()) {
    if (!service.isConnected()) {
      service.connect();
    }
  }
}
Program: 20863
Project: 20863
Buggy source:
@Override public void onConnectionSuccess(DeviceService service){
  if (listener != null) {
  }
  if (isConnected()) {
    DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(this);
    setLastConnected(Util.getTime());
  }
}

Fixed version (ground truth):
@Override public void onConnectionSuccess(DeviceService service){
  if (isConnected()) {
    DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(this);
    for (    ConnectableDeviceListenerPair pair : deviceListeners)     pair.listener.onDeviceReady(pair.device);
    setLastConnected(Util.getTime());
  }
}
Program: 20865
Project: 20865
Buggy source:
private boolean isNetcast(ServiceDescription description){
  return "String_Node_Str".equalsIgnoreCase(description.getModelName()) && "String_Node_Str".equalsIgnoreCase(description.getModelDescription());
}

Fixed version (ground truth):
public boolean isNetcast(ServiceDescription description){
  boolean isNetcastTV=false;
  String modelName=description.getModelName();
  String modelDescription=description.getModelDescription();
  if (modelName != null && modelName.toUpperCase(Locale.US).equals("String_Node_Str")) {
    if (modelDescription != null && !(modelDescription.toUpperCase(Locale.US).contains("String_Node_Str"))) {
      isNetcastTV=true;
    }
  }
  return isNetcastTV;
}
Program: 20866
Project: 20866
Buggy source:
/** 
 * Initilizes the Discovery manager with a valid context.  This should be done as soon as possible and it should use getApplicationContext() as the Discovery manager could persist longer than the current Activity. This accepts a ConnectableDeviceStore to use instead of the default device store.
 * @code MyConnectableDeviceStore myDeviceStore = new MyConnectableDeviceStore(); DiscoveryManager.init(getApplicationContext(), myDeviceStore);
 * @endcode
 */
@SuppressWarnings("String_Node_Str") public static synchronized void init(Context context,ConnectableDeviceStore connectableDeviceStore){
  instance=new DiscoveryManager(context,connectableDeviceStore);
}

Fixed version (ground truth):
/** 
 * Initilizes the Discovery manager with a valid context.  This should be done as soon as possible and it should use getApplicationContext() as the Discovery manager could persist longer than the current Activity. This accepts a ConnectableDeviceStore to use instead of the default device store.
 * @code MyConnectableDeviceStore myDeviceStore = new MyConnectableDeviceStore(); DiscoveryManager.init(getApplicationContext(), myDeviceStore);
 * @endcode
 */
public static synchronized void init(Context context,ConnectableDeviceStore connectableDeviceStore){
  instance=new DiscoveryManager(context,connectableDeviceStore);
}
Program: 20868
Project: 20868
Buggy source:
@Override public void disconnect(){
  isServiceReady=false;
  mApiClient.disconnect();
}

Fixed version (ground truth):
@Override public void disconnect(){
  mApiClient.disconnect();
}
Program: 20869
Project: 20869
Buggy source:
public CastService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
  isServiceReady=false;
  this.castDevice=((CastServiceDescription)serviceDescription).getCastDevice();
  mCastClientListener=new CastListener();
  mConnectionCallbacks=new ConnectionCallbacks();
  mConnectionFailedListener=new ConnectionFailedListener();
  Cast.CastOptions.Builder apiOptionsBuilder=Cast.CastOptions.builder(castDevice,mCastClientListener);
  mApiClient=new GoogleApiClient.Builder(DiscoveryManager.getInstance().getContext()).addApi(Cast.API,apiOptionsBuilder.build()).addConnectionCallbacks(mConnectionCallbacks).addOnConnectionFailedListener(mConnectionFailedListener).build();
}

Fixed version (ground truth):
public CastService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
  this.castDevice=((CastServiceDescription)serviceDescription).getCastDevice();
  mCastClientListener=new CastListener();
  mConnectionCallbacks=new ConnectionCallbacks();
  mConnectionFailedListener=new ConnectionFailedListener();
  Cast.CastOptions.Builder apiOptionsBuilder=Cast.CastOptions.builder(castDevice,mCastClientListener);
  mApiClient=new GoogleApiClient.Builder(DiscoveryManager.getInstance().getContext()).addApi(Cast.API,apiOptionsBuilder.build()).addConnectionCallbacks(mConnectionCallbacks).addOnConnectionFailedListener(mConnectionFailedListener).build();
}
Program: 20870
Project: 20870
Buggy source:
@Override public void onConnected(Bundle connectionHint){
  Log.d("String_Node_Str","String_Node_Str");
  isConnected=true;
  if (serviceReadyListener != null) {
    isServiceReady=true;
    serviceReadyListener.onServiceReady();
  }
}

Fixed version (ground truth):
@Override public void onConnected(Bundle connectionHint){
  Log.d("String_Node_Str","String_Node_Str");
  isConnected=true;
  if (listener != null) {
    Util.runOnUI(new Runnable(){
      @Override public void run(){
        listener.onConnectionSuccess(CastService.this);
      }
    }
);
  }
}
Program: 20871
Project: 20871
Buggy source:
public DIALService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
  probeForAppSupport();
}

Fixed version (ground truth):
public DIALService(ServiceDescription serviceDescription,ServiceConfig serviceConfig){
  super(serviceDescription,serviceConfig);
  setCapabilities();
  httpClient=new DefaultHttpClient();
  ClientConnectionManager mgr=httpClient.getConnectionManager();
  HttpParams params=httpClient.getParams();
  httpClient=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params);
}
Program: 20872
Project: 20872
Buggy source:
@Override public void onConnectionSuccess(DeviceService service){
  if (isConnected()) {
    DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(this);
    if (listener != null)     listener.onDeviceReady(ConnectableDevice.this);
    setLastConnected(Util.getTime());
  }
}

Fixed version (ground truth):
@Override public void onConnectionSuccess(DeviceService service){
  if (isConnected()) {
    if (DiscoveryManager.getInstance().getConnectableDeviceStore() != null)     DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(this);
    if (listener != null)     listener.onDeviceReady(ConnectableDevice.this);
    setLastConnected(Util.getTime());
  }
}
Program: 20873
Project: 20873
Buggy source:
/** 
 * Listener which should receive discovery updates. It is not necessary to set this delegate property unless you are implementing your own device picker. Connect SDK provides a default DevicePicker which acts as a DiscoveryManagerListener, and should work for most cases. If you have provided a capabilityFilters array, the delegate will only receive update messages for ConnectableDevices which satisfy at least one of the CapabilityFilters. If no capabilityFilters array is provided, the listener will receive update messages for all ConnectableDevice objects that are discovered.
 */
public DiscoveryManagerListener getListener(){
  return listener;
}

Fixed version (ground truth):
/** 
 * Listener which should receive discovery updates. It is not necessary to set this delegate property unless you are implementing your own device picker. Connect SDK provides a default DevicePicker which acts as a DiscoveryManagerListener, and should work for most cases. If you have provided a capabilityFilters array, the delegate will only receive update messages for ConnectableDevices which satisfy at least one of the CapabilityFilters. If no capabilityFilters array is provided, the listener will receive update messages for all ConnectableDevice objects that are discovered.
 */
public ConnectableDeviceListener getListener(){
  return listener;
}
Program: 20874
Project: 20874
Buggy source:
/** 
 * Adds a DeviceService to the ConnectableDevice instance. Only one instance of each DeviceService type (webOS, Netcast, etc) may be attached to a single ConnectableDevice instance. If a device contains your service type already, your service will not be added.
 * @param service DeviceService to be added
 */
public void addService(DeviceService service){
  final List<String> added=getMismatchCapabilities(service.getCapabilities(),getCapabilities());
  Util.runOnUI(new Runnable(){
    @Override public void run(){
      for (      ConnectableDeviceListenerPair pair : deviceListeners) {
        pair.listener.onCapabilityUpdated(pair.device,added,null);
      }
    }
  }
);
  services.put(service.getServiceDescription().getServiceFilter(),service);
}

Fixed version (ground truth):
/** 
 * Adds a DeviceService to the ConnectableDevice instance. Only one instance of each DeviceService type (webOS, Netcast, etc) may be attached to a single ConnectableDevice instance. If a device contains your service type already, your service will not be added.
 * @param service DeviceService to be added
 */
public void addService(DeviceService service){
  final List<String> added=getMismatchCapabilities(service.getCapabilities(),getCapabilities());
  service.setListener(this);
  Util.runOnUI(new Runnable(){
    @Override public void run(){
      for (      ConnectableDeviceListenerPair pair : deviceListeners) {
        pair.listener.onCapabilityUpdated(pair.device,added,null);
      }
    }
  }
);
  services.put(service.getServiceDescription().getServiceFilter(),service);
}
Program: 20875
Project: 20875
Buggy source:
/** 
 * Sets the DiscoveryManagerListener
 * @param listener The listener that should receive callbacks.
 */
public void setListener(DiscoveryManagerListener listener){
  this.listener=listener;
}

Fixed version (ground truth):
/** 
 * Sets the DiscoveryManagerListener
 * @param listener The listener that should receive callbacks.
 */
public void setListener(ConnectableDeviceListener listener){
  this.listener=listener;
}
Program: 20876
Project: 20876
Buggy source:
@Override public void onConnectionSuccess(DeviceService service){
}

Fixed version (ground truth):
@Override public void onConnectionSuccess(DeviceService service){
  if (listener != null) {
  }
  if (isConnected()) {
    DiscoveryManager.getInstance().getConnectableDeviceStore().addDevice(this);
    setLastConnected(Util.getTime());
  }
}