nus-yam/ex-repair huggingface dataset:
Program: 32250
Project: 32250
Buggy source:
@Override public void onInvalidated(final SdlRemoteDisplay remoteDisplay){
  remoteDisplay.getMainView().post(new Runnable(){
    @Override public void run(){
      hapticManager.refreshHapticData(remoteDisplay.getMainView());
    }
  }
);
}

Fixed version (ground truth):
@Override public void onInvalidated(final SdlRemoteDisplay remoteDisplay){
  if (hapticManager != null) {
    remoteDisplay.getMainView().post(new Runnable(){
      @Override public void run(){
        hapticManager.refreshHapticData(remoteDisplay.getMainView());
      }
    }
);
  }
}
Program: 32251
Project: 32251
Buggy source:
@Override public void onCreated(final SdlRemoteDisplay remoteDisplay){
  VideoStreamingManager.this.remoteDisplay=remoteDisplay;
  remoteDisplay.getMainView().post(new Runnable(){
    @Override public void run(){
      hapticManager.refreshHapticData(remoteDisplay.getMainView());
    }
  }
);
  ImageResolution resolution=null;
  if (getWiProVersion() >= 5) {
    VideoStreamingCapability capability=(VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
    resolution=capability.getPreferredResolution();
  }
 else {
    DisplayCapabilities dispCap=(DisplayCapabilities)_systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
    if (dispCap != null) {
      resolution=(dispCap.getScreenParams().getImageResolution());
    }
  }
  if (resolution != null) {
    DisplayMetrics displayMetrics=new DisplayMetrics();
    disp.getMetrics(displayMetrics);
    touchScalar[0]=((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
    touchScalar[1]=((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
  }
}

Fixed version (ground truth):
@Override public void onCreated(final SdlRemoteDisplay remoteDisplay){
  VideoStreamingManager.this.remoteDisplay=remoteDisplay;
  if (hapticManager != null) {
    remoteDisplay.getMainView().post(new Runnable(){
      @Override public void run(){
        hapticManager.refreshHapticData(remoteDisplay.getMainView());
      }
    }
);
  }
  ImageResolution resolution=null;
  if (getWiProVersion() >= 5) {
    VideoStreamingCapability capability=(VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
    resolution=capability.getPreferredResolution();
  }
 else {
    DisplayCapabilities dispCap=(DisplayCapabilities)_systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
    if (dispCap != null) {
      resolution=(dispCap.getScreenParams().getImageResolution());
    }
  }
  if (resolution != null) {
    DisplayMetrics displayMetrics=new DisplayMetrics();
    disp.getMetrics(displayMetrics);
    touchScalar[0]=((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
    touchScalar[1]=((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
  }
}
Program: 32252
Project: 32252
Buggy source:
@Override public void onServiceEnded(SdlSession session,SessionType type){
  if (SessionType.NAV.equals(type)) {
    dispose();
  }
}

Fixed version (ground truth):
@Override public void onServiceEnded(SdlSession session,SessionType type){
  if (SessionType.NAV.equals(type)) {
    if (remoteDisplay != null) {
      stopStreaming();
    }
  }
}
Program: 32253
Project: 32253
Buggy source:
public void stopStreaming(){
  if (remoteDisplay != null) {
    remoteDisplay.stop();
  }
  if (encoder != null) {
    encoder.shutDown();
  }
}

Fixed version (ground truth):
public void stopStreaming(){
  if (remoteDisplay != null) {
    remoteDisplay.stop();
    remoteDisplay=null;
  }
  if (encoder != null) {
    encoder.shutDown();
  }
  if (internalInterface != null) {
    internalInterface.stopVideoService();
  }
}
Program: 32255
Project: 32255
Buggy source:
/** 
 * Sets the radioEnable portion of the RadioControlData class <br><b>Note: </b> This setting is normally a <b>READ-ONLY</b> setting
 * @param radioEnable True if the radio is on, false is the radio is off.
 */
public void setRadioEnable(Boolean radioEnable){
  setValue(KEY_RADIO_ENABLE,radioEnable);
}

Fixed version (ground truth):
/** 
 * Sets the radioEnable portion of the RadioControlData class <br><b>Note: </b> If this is set to false, no other data will be included. <br><b>Note: </b> This setting is normally a <b>READ-ONLY</b> setting.
 * @param radioEnable True if the radio is on, false is the radio is off.
 */
public void setRadioEnable(Boolean radioEnable){
  setValue(KEY_RADIO_ENABLE,radioEnable);
}
Program: 32256
Project: 32256
Buggy source:
public void startVideoStreaming(Class<? extends SdlRemoteDisplay> remoteDisplayClass,VideoStreamingParameters parameters,boolean encrypted){
  streamListener=startVideoStream(encrypted,parameters);
  if (streamListener == null) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  this.remoteDisplayClass=remoteDisplayClass;
  try {
    encoder.init(context,streamListener,parameters);
    encoder.start();
    createRemoteDisplay(encoder.getVirtualDisplay());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  Log.d(TAG,parameters.toString());
}

Fixed version (ground truth):
public void startVideoStreaming(Class<? extends SdlRemoteDisplay> remoteDisplayClass,VideoStreamingParameters parameters,boolean encrypted){
  streamListener=startVideoStream(encrypted,parameters);
  if (streamListener == null) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  VideoStreamingCapability capability=(VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
  if (capability != null && capability.getIsHapticSpatialDataSupported()) {
    hapticManager=new HapticInterfaceManager(internalInterface);
  }
  this.remoteDisplayClass=remoteDisplayClass;
  try {
    encoder.init(context,streamListener,parameters);
    encoder.start();
    createRemoteDisplay(encoder.getVirtualDisplay());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  Log.d(TAG,parameters.toString());
}
Program: 32257
Project: 32257
Buggy source:
public VideoStreamingManager(Context context,ISdl iSdl){
  this.context=context;
  this.internalInterface=iSdl;
  encoder=new VirtualDisplayEncoder();
  internalInterface.addServiceListener(SessionType.NAV,this);
  internalInterface.addOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT,new OnRPCNotificationListener(){
    @Override public void onNotified(    RPCNotification notification){
      if (notification != null && remoteDisplay != null) {
        MotionEvent event=convertTouchEvent((OnTouchEvent)notification);
        if (event != null) {
          remoteDisplay.handleMotionEvent(event);
        }
      }
    }
  }
);
  VideoStreamingCapability capability=(VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
  if (capability != null && capability.getIsHapticSpatialDataSupported()) {
    hapticManager=new HapticInterfaceManager(iSdl);
  }
}

Fixed version (ground truth):
public VideoStreamingManager(Context context,ISdl iSdl){
  this.context=context;
  this.internalInterface=iSdl;
  encoder=new VirtualDisplayEncoder();
  internalInterface.addServiceListener(SessionType.NAV,this);
  internalInterface.addOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT,new OnRPCNotificationListener(){
    @Override public void onNotified(    RPCNotification notification){
      if (notification != null && remoteDisplay != null) {
        MotionEvent event=convertTouchEvent((OnTouchEvent)notification);
        if (event != null) {
          remoteDisplay.handleMotionEvent(event);
        }
      }
    }
  }
);
}
Program: 32259
Project: 32259
Buggy source:
/** 
 * Releases encoder resources.
 */
public void releaseEncoder(){
  if (mEncoder != null) {
    mEncoder.stop();
    mEncoder.release();
    mEncoder=null;
  }
  if (mOutputStream != null) {
    try {
      mOutputStream.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    mOutputStream=null;
  }
}

Fixed version (ground truth):
/** 
 * Releases encoder resources.
 */
public void releaseEncoder(){
  if (mEncoder != null) {
    mEncoder.stop();
    mEncoder.release();
    mEncoder=null;
  }
  if (mOutputStream != null) {
    try {
      mOutputStream.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    mOutputStream=null;
  }
  mH264CodecSpecificData=null;
}
Program: 32261
Project: 32261
Buggy source:
public void EndProtocolSession(SessionType sessionType,byte sessionID,int hashId){
  SdlPacket header=SdlPacketFactory.createEndSession(sessionType,sessionID,hashID,getMajorVersionByte(),BitConverter.intToByteArray(hashId));
  if (sessionType.equals(SessionType.RPC)) {
    header.putTag(ControlFrameTags.RPC.EndService.HASH_ID,hashID);
  }
  handlePacketToSend(header);
}

Fixed version (ground truth):
public void EndProtocolSession(SessionType sessionType,byte sessionID,int hashId){
  SdlPacket header;
  if (sessionType.equals(SessionType.RPC)) {
    if (_version < 5) {
      header=SdlPacketFactory.createEndSession(sessionType,sessionID,hashID,getMajorVersionByte(),BitConverter.intToByteArray(hashID));
    }
 else {
      header=SdlPacketFactory.createEndSession(sessionType,sessionID,hashID,getMajorVersionByte(),new byte[0]);
      header.putTag(ControlFrameTags.RPC.EndService.HASH_ID,hashID);
    }
  }
 else {
    header=SdlPacketFactory.createEndSession(sessionType,sessionID,hashID,getMajorVersionByte(),new byte[0]);
  }
  handlePacketToSend(header);
}
Program: 32262
Project: 32262
Buggy source:
@Override public void EndProtocolService(SessionType serviceType,byte sessionID){
  SdlPacket header=SdlPacketFactory.createEndSession(serviceType,sessionID,hashID,getMajorVersionByte(),new byte[4]);
  handlePacketToSend(header);
}

Fixed version (ground truth):
@Override public void EndProtocolService(SessionType serviceType,byte sessionID){
  if (serviceType.equals(SessionType.RPC)) {
    EndProtocolSession(serviceType,sessionID,hashID);
  }
 else {
    SdlPacket header=SdlPacketFactory.createEndSession(serviceType,sessionID,hashID,getMajorVersionByte(),new byte[0]);
    handlePacketToSend(header);
  }
}
Program: 32265
Project: 32265
Buggy source:
public static boolean isEmulator(){
  return Build.FINGERPRINT.startsWith("String_Node_Str") || Build.FINGERPRINT.startsWith("String_Node_Str") || Build.MODEL.contains("String_Node_Str")|| Build.MODEL.contains("String_Node_Str")|| (Build.BRAND.startsWith("String_Node_Str") && Build.DEVICE.startsWith("String_Node_Str"))|| "String_Node_Str".equals(Build.PRODUCT);
}

Fixed version (ground truth):
public static boolean isEmulator(){
  return Build.FINGERPRINT.startsWith("String_Node_Str") || Build.FINGERPRINT.startsWith("String_Node_Str") || Build.MODEL.contains("String_Node_Str")|| Build.MODEL.contains("String_Node_Str")|| Build.MODEL.contains("String_Node_Str")|| (Build.BRAND.startsWith("String_Node_Str") && Build.DEVICE.startsWith("String_Node_Str"))|| (Build.BRAND.startsWith("String_Node_Str") && Build.DEVICE.startsWith("String_Node_Str"))|| (Build.PRODUCT != null && Build.PRODUCT.startsWith("String_Node_Str"))|| "String_Node_Str".equals(Build.PRODUCT);
}
Program: 32266
Project: 32266
Buggy source:
public void testJson(){
  JSONObject reference=new JSONObject();
  try {
    reference.put(Rectangle.KEY_X,((Float)Test.GENERAL_FLOAT));
    reference.put(Rectangle.KEY_Y,((Float)Test.GENERAL_FLOAT));
    reference.put(Rectangle.KEY_WIDTH,((Float)Test.GENERAL_FLOAT));
    reference.put(Rectangle.KEY_HEIGHT,((Float)Test.GENERAL_FLOAT));
    JSONObject underTest=msg.serializeJSON();
    assertEquals(Test.MATCH,reference.length(),underTest.length());
    Iterator<?> iterator=reference.keys();
    while (iterator.hasNext()) {
      String key=(String)iterator.next();
      assertEquals(Test.MATCH,JsonUtils.readObjectFromJsonObject(reference,key),JsonUtils.readObjectFromJsonObject(underTest,key));
    }
  }
 catch (  JSONException e) {
    fail(Test.JSON_FAIL);
  }
}

Fixed version (ground truth):
public void testJson(){
  JSONObject reference=new JSONObject();
  try {
    reference.put(Rectangle.KEY_X,(Test.GENERAL_FLOAT));
    reference.put(Rectangle.KEY_Y,(Test.GENERAL_FLOAT));
    reference.put(Rectangle.KEY_WIDTH,(Test.GENERAL_FLOAT));
    reference.put(Rectangle.KEY_HEIGHT,(Test.GENERAL_FLOAT));
    JSONObject underTest=msg.serializeJSON();
    assertEquals(Test.MATCH,reference.length(),underTest.length());
    Iterator<?> iterator=reference.keys();
    while (iterator.hasNext()) {
      String key=(String)iterator.next();
      assertEquals(Test.MATCH,JsonUtils.readObjectFromJsonObject(reference,key),JsonUtils.readObjectFromJsonObject(underTest,key));
    }
  }
 catch (  JSONException e) {
    fail(Test.JSON_FAIL);
  }
}
Program: 32267
Project: 32267
Buggy source:
@Override protected RPCMessage createMessage(){
  hapticRect=new HapticRect();
  hapticRect.setId(Test.GENERAL_INTEGER);
  hapticRect.setRect(Test.GENERAL_RECTANGLE);
  ArrayList<HapticRect> hapticArray=new ArrayList<HapticRect>();
  hapticArray.add(0,hapticRect);
  SendHapticData msg=new SendHapticData();
  msg.setHapticRectData(hapticArray);
  return msg;
}

Fixed version (ground truth):
@Override protected RPCMessage createMessage(){
  hapticRect=new HapticRect();
  hapticRect.setId(Test.GENERAL_INTEGER);
  hapticRect.setRect(Test.GENERAL_RECTANGLE);
  hapticArray=new ArrayList<HapticRect>();
  hapticArray.add(0,hapticRect);
  SendHapticData msg=new SendHapticData();
  msg.setHapticRectData(hapticArray);
  return msg;
}
Program: 32268
Project: 32268
Buggy source:
@Override protected JSONObject getExpectedParameters(int sdlVersion){
  JSONObject result=new JSONObject();
  try {
    result.put(SendHapticData.KEY_HAPTIC_RECT_DATA,hapticRect.serializeJSON());
  }
 catch (  JSONException e) {
    fail(Test.JSON_FAIL);
  }
  return result;
}

Fixed version (ground truth):
@Override protected JSONObject getExpectedParameters(int sdlVersion){
  JSONObject result=new JSONObject();
  try {
    result.put(SendHapticData.KEY_HAPTIC_RECT_DATA,hapticArray);
  }
 catch (  JSONException e) {
    fail(Test.JSON_FAIL);
  }
  return result;
}
Program: 32270
Project: 32270
Buggy source:
/** 
 * Test writeBytesToTransport method for handling null byte array in bundle
 * @see SdlRouterService#writeBytesToTransport(Bundle)
 */
public void testWriteBytesToTransport(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  Method method;
  Field field=null;
  Object sdlRouterService=null;
  try {
    sdlRouterService=Class.forName("String_Node_Str").newInstance();
    method=SdlRouterService.class.getDeclaredMethod("String_Node_Str",Bundle.class);
    Bundle bundle=null;
    method.invoke(sdlRouterService,bundle);
    MultiplexBluetoothTransport transport=MultiplexBluetoothTransport.getBluetoothSerialServerInstance(null);
    transport.setStateManually(MultiplexBluetoothTransport.STATE_CONNECTED);
    field=SdlRouterService.class.getDeclaredField("String_Node_Str");
    field.setAccessible(true);
    field.set(sdlRouterService,transport);
    bundle=new Bundle();
    bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME,null);
    method.invoke(sdlRouterService,bundle);
  }
 catch (  Exception e) {
    Assert.fail("String_Node_Str" + e);
  }
  if (field != null && sdlRouterService != null) {
    try {
      field.set(sdlRouterService,null);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Test writeBytesToTransport method for handling null byte array in bundle
 * @see SdlRouterService#writeBytesToTransport(Bundle)
 */
public void testWriteBytesToTransport(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  Method method;
  Field field=null;
  Object sdlRouterService=null;
  try {
    sdlRouterService=Class.forName("String_Node_Str").newInstance();
    method=SdlRouterService.class.getDeclaredMethod("String_Node_Str",Bundle.class);
    Bundle bundle=null;
    method.invoke(sdlRouterService,bundle);
    MultiplexBluetoothTransport transport=new MultiplexBluetoothTransport(null);
    transport.setStateManually(MultiplexBluetoothTransport.STATE_CONNECTED);
    field=SdlRouterService.class.getDeclaredField("String_Node_Str");
    field.setAccessible(true);
    field.set(sdlRouterService,transport);
    bundle=new Bundle();
    bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME,null);
    method.invoke(sdlRouterService,bundle);
  }
 catch (  Exception e) {
    Assert.fail("String_Node_Str" + e);
  }
  if (field != null && sdlRouterService != null) {
    try {
      field.set(sdlRouterService,null);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}
Program: 32271
Project: 32271
Buggy source:
/** 
 * Main function to call to ensure we are connecting to a validated router service
 * @return whether or not the currently running router service can be trusted.
 */
public boolean validate(){
  if (securityLevel == -1) {
    securityLevel=getSecurityLevel(context);
  }
  if (securityLevel == MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF) {
    return true;
  }
  PackageManager pm=context.getPackageManager();
  String packageName=null;
  if (this.service != null) {
    Log.d(TAG,"String_Node_Str" + this.service.getClassName());
    if (!isServiceRunning(context,this.service)) {
      service=null;
      Log.w(TAG,"String_Node_Str");
    }
  }
  if (this.service == null) {
    this.service=componentNameForServiceRunning(pm);
    if (this.service == null) {
      wakeUpRouterServices();
      return false;
    }
  }
  packageName=this.appPackageForComponentName(service,pm);
  if (packageName != null) {
    if (wasInstalledByAppStore(packageName)) {
      if (isTrustedPackage(packageName,pm)) {
        return true;
      }
    }
  }
  wakeUpRouterServices();
  return false;
}

Fixed version (ground truth):
/** 
 * Main function to call to ensure we are connecting to a validated router service
 * @return whether or not the currently running router service can be trusted.
 */
public boolean validate(){
  if (securityLevel == -1) {
    securityLevel=getSecurityLevel(context);
  }
  if (securityLevel == MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF) {
    return true;
  }
  PackageManager pm=context.getPackageManager();
  String packageName=null;
  if (this.service != null) {
    Log.d(TAG,"String_Node_Str" + this.service.getClassName());
    if (!isServiceRunning(context,this.service)) {
      service=null;
      Log.w(TAG,"String_Node_Str");
    }
 else {
      if (this.service.getPackageName().equals(context.getPackageName())) {
        return true;
      }
    }
  }
  if (this.service == null) {
    this.service=componentNameForServiceRunning(pm);
    if (this.service == null) {
      wakeUpRouterServices();
      return false;
    }
  }
  packageName=this.appPackageForComponentName(service,pm);
  if (packageName != null) {
    if (wasInstalledByAppStore(packageName)) {
      if (isTrustedPackage(packageName,pm)) {
        return true;
      }
    }
  }
  wakeUpRouterServices();
  return false;
}
Program: 32272
Project: 32272
Buggy source:
/** 
 * Sets a file reference name
 * @param sdlFileName a String value representing a file reference name <p></p> <b>Notes: </b>Maxlength=500
 */
public void setSdlFileName(String sdlFileName){
  setParameters(KEY_SDL_FILE_NAME,sdlFileName);
}

Fixed version (ground truth):
/** 
 * Sets a file reference name
 * @param sdlFileName a String value representing a file reference name <p></p> <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
 */
public void setSdlFileName(String sdlFileName){
  setParameters(KEY_SDL_FILE_NAME,sdlFileName);
}
Program: 32273
Project: 32273
Buggy source:
/** 
 * Sets a file reference name
 * @param sdlFileName a String value representing a file reference name <p></p> <b>Notes: </b>Maxlength=500
 */
public void setSdlFileName(String sdlFileName){
  setParameters(KEY_SDL_FILE_NAME,sdlFileName);
}

Fixed version (ground truth):
/** 
 * Sets a file reference name
 * @param sdlFileName a String value representing a file reference name <p></p> <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
 */
public void setSdlFileName(String sdlFileName){
  setParameters(KEY_SDL_FILE_NAME,sdlFileName);
}
Program: 32274
Project: 32274
Buggy source:
@SuppressWarnings("String_Node_Str") public boolean writeBytesToTransport(Bundle bundle){
  if (bundle == null) {
    return false;
  }
  if (mSerialService != null && mSerialService.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
    byte[] packet=bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
    int offset=bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET,0);
    int count=bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT,packet.length);
    if (packet != null) {
      mSerialService.write(packet,offset,count);
      return true;
    }
    return false;
  }
 else   if (sendThroughAltTransport(bundle)) {
    return true;
  }
 else {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public boolean writeBytesToTransport(Bundle bundle){
  if (bundle == null) {
    return false;
  }
  if (mSerialService != null && mSerialService.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
    byte[] packet=bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
    if (packet != null) {
      int offset=bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET,0);
      int count=bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT,packet.length);
      mSerialService.write(packet,offset,count);
      return true;
    }
    return false;
  }
 else   if (sendThroughAltTransport(bundle)) {
    return true;
  }
 else {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
}
Program: 32275
Project: 32275
Buggy source:
/** 
 * Verifies that the enum values are not null upon valid assignment.
 */
public void testValidEnums(){
  String example="String_Node_Str";
  TouchType enumBegin=TouchType.valueForString(example);
  example="String_Node_Str";
  TouchType enumMove=TouchType.valueForString(example);
  example="String_Node_Str";
  TouchType enumEnd=TouchType.valueForString(example);
  assertNotNull("String_Node_Str",enumBegin);
  assertNotNull("String_Node_Str",enumMove);
  assertNotNull("String_Node_Str",enumEnd);
}

Fixed version (ground truth):
/** 
 * Verifies that the enum values are not null upon valid assignment.
 */
public void testValidEnums(){
  String example="String_Node_Str";
  TouchType enumBegin=TouchType.valueForString(example);
  example="String_Node_Str";
  TouchType enumMove=TouchType.valueForString(example);
  example="String_Node_Str";
  TouchType enumEnd=TouchType.valueForString(example);
  example="String_Node_Str";
  TouchType enumCancel=TouchType.valueForString(example);
  assertNotNull("String_Node_Str",enumBegin);
  assertNotNull("String_Node_Str",enumMove);
  assertNotNull("String_Node_Str",enumEnd);
  assertNotNull("String_Node_Str",enumCancel);
}
Program: 32276
Project: 32276
Buggy source:
/** 
 * Verifies the possible enum values of TouchType.
 */
public void testListEnum(){
  List<TouchType> enumValueList=Arrays.asList(TouchType.values());
  List<TouchType> enumTestList=new ArrayList<TouchType>();
  enumTestList.add(TouchType.BEGIN);
  enumTestList.add(TouchType.MOVE);
  enumTestList.add(TouchType.END);
  assertTrue("String_Node_Str",enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}

Fixed version (ground truth):
/** 
 * Verifies the possible enum values of TouchType.
 */
public void testListEnum(){
  List<TouchType> enumValueList=Arrays.asList(TouchType.values());
  List<TouchType> enumTestList=new ArrayList<TouchType>();
  enumTestList.add(TouchType.BEGIN);
  enumTestList.add(TouchType.MOVE);
  enumTestList.add(TouchType.END);
  enumTestList.add(TouchType.CANCEL);
  assertTrue("String_Node_Str",enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
Program: 32277
Project: 32277
Buggy source:
/** 
 * Using the knowledge that all SDL enabled apps have an SDL Broadcast Receiver that has an intent filter that includes a specific  intent. 
 * @return 
 */
private static List<SdlApp> findAllSdlApps(Context context){
  List<SdlApp> apps=new ArrayList<SdlApp>();
  PackageManager packageManager=context.getPackageManager();
  Intent intent=new Intent();
  intent.setAction("String_Node_Str");
  List<ResolveInfo> infoList=packageManager.queryBroadcastReceivers(intent,0);
  Collections.sort(infoList,new Comparator<ResolveInfo>(){
    @Override public int compare(    ResolveInfo lhs,    ResolveInfo rhs){
      return lhs.activityInfo.packageName.compareTo(rhs.activityInfo.packageName);
    }
  }
);
  if (infoList != null) {
    String packageName;
    for (    ResolveInfo info : infoList) {
      packageName=info.activityInfo.packageName;
      try {
        apps.add(new SdlApp(packageName,packageManager.getPackageInfo(packageName,0).versionCode));
      }
 catch (      NameNotFoundException e) {
        e.printStackTrace();
      }
    }
    return apps;
  }
 else {
    Log.i(TAG,"String_Node_Str");
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Using the knowledge that all SDL enabled apps have an SDL Broadcast Receiver that has an intent filter that includes a specific  intent. 
 * @return 
 */
private static List<SdlApp> findAllSdlApps(Context context){
  List<SdlApp> apps=new ArrayList<SdlApp>();
  PackageManager packageManager=context.getPackageManager();
  Intent intent=new Intent();
  intent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
  List<ResolveInfo> infoList=packageManager.queryBroadcastReceivers(intent,0);
  Collections.sort(infoList,new Comparator<ResolveInfo>(){
    @Override public int compare(    ResolveInfo lhs,    ResolveInfo rhs){
      return lhs.activityInfo.packageName.compareTo(rhs.activityInfo.packageName);
    }
  }
);
  if (infoList != null) {
    String packageName;
    for (    ResolveInfo info : infoList) {
      packageName=info.activityInfo.packageName;
      try {
        apps.add(new SdlApp(packageName,packageManager.getPackageInfo(packageName,0).versionCode));
      }
 catch (      NameNotFoundException e) {
        e.printStackTrace();
      }
    }
    return apps;
  }
 else {
    Log.i(TAG,"String_Node_Str");
    return null;
  }
}
Program: 32278
Project: 32278
Buggy source:
public void startVersionCheck(){
  Intent intent=new Intent(START_SERVICE_ACTION);
  List<ResolveInfo> infos=getPackageManager().queryBroadcastReceivers(intent,0);
  sdlMultiList=new HashMap<String,ResolveInfo>();
  for (  ResolveInfo info : infos) {
    if (getPackageName().equals(info.activityInfo.applicationInfo.packageName)) {
      continue;
    }
    sdlMultiList.put(info.activityInfo.packageName,info);
  }
  registerReceiver(registerAnInstanceOfSerialServer,new IntentFilter(REGISTER_NEWER_SERVER_INSTANCE_ACTION));
  newestServiceCheck(currentContext);
}

Fixed version (ground truth):
public void startVersionCheck(){
  Intent intent=new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
  List<ResolveInfo> infos=getPackageManager().queryBroadcastReceivers(intent,0);
  sdlMultiList=new HashMap<String,ResolveInfo>();
  for (  ResolveInfo info : infos) {
    if (getPackageName().equals(info.activityInfo.applicationInfo.packageName)) {
      continue;
    }
    sdlMultiList.put(info.activityInfo.packageName,info);
  }
  registerReceiver(registerAnInstanceOfSerialServer,new IntentFilter(REGISTER_NEWER_SERVER_INSTANCE_ACTION));
  newestServiceCheck(currentContext);
}
Program: 32279
Project: 32279
Buggy source:
public void onTransportConnected(final TransportType type){
  isTransportConnected=true;
  enterForeground();
  if (packetWriteTaskMaster != null) {
    packetWriteTaskMaster.close();
    packetWriteTaskMaster=null;
  }
  packetWriteTaskMaster=new PacketWriteTaskMaster();
  packetWriteTaskMaster.start();
  connectedTransportType=type;
  Intent startService=new Intent();
  startService.setAction(START_SERVICE_ACTION);
  startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA,true);
  startService.putExtra(TransportConstants.FORCE_TRANSPORT_CONNECTED,true);
  startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE,getBaseContext().getPackageName());
  startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME,new ComponentName(this,this.getClass()));
  sendBroadcast(startService);
  if (!(registeredApps == null || registeredApps.isEmpty())) {
    notifyClients(createHardwareConnectedMessage(type));
  }
}

Fixed version (ground truth):
public void onTransportConnected(final TransportType type){
  isTransportConnected=true;
  enterForeground();
  if (packetWriteTaskMaster != null) {
    packetWriteTaskMaster.close();
    packetWriteTaskMaster=null;
  }
  packetWriteTaskMaster=new PacketWriteTaskMaster();
  packetWriteTaskMaster.start();
  connectedTransportType=type;
  Intent startService=new Intent();
  startService.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
  startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA,true);
  startService.putExtra(TransportConstants.FORCE_TRANSPORT_CONNECTED,true);
  startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE,getBaseContext().getPackageName());
  startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME,new ComponentName(this,this.getClass()));
  sendBroadcast(startService);
  if (!(registeredApps == null || registeredApps.isEmpty())) {
    notifyClients(createHardwareConnectedMessage(type));
  }
}
Program: 32280
Project: 32280
Buggy source:
private void initPingIntent(){
  pingIntent=new Intent();
  pingIntent.setAction(START_SERVICE_ACTION);
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA,true);
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE,getBaseContext().getPackageName());
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME,new ComponentName(SdlRouterService.this,SdlRouterService.this.getClass()));
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_PING,true);
}

Fixed version (ground truth):
private void initPingIntent(){
  pingIntent=new Intent();
  pingIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA,true);
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE,getBaseContext().getPackageName());
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME,new ComponentName(SdlRouterService.this,SdlRouterService.this.getClass()));
  pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_PING,true);
}
Program: 32281
Project: 32281
Buggy source:
public void testThreadRecoverability(){
  MultiplexTransportConfig config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  MultiplexTransport trans=new MultiplexTransport(config,transportListener);
  assertTrue(trans.brokerThread.isAlive());
  if (trans.brokerThread.broker == null) {
synchronized (trans.brokerThread) {
      try {
        trans.brokerThread.wait(TIMEOUT);
        ;
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
  assertNotNull(trans.brokerThread.broker);
  trans.brokerThread.connected=true;
  trans.brokerThread.broker.onHardwareDisconnected(TransportType.BLUETOOTH);
  assertNull(trans.brokerThread);
  trans=new MultiplexTransport(config,transportListener);
  assertTrue(trans.brokerThread.isAlive());
}

Fixed version (ground truth):
public void testThreadRecoverability(){
  MultiplexTransportConfig config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  MultiplexTransport trans=new MultiplexTransport(config,transportListener);
  assertTrue(trans.brokerThread.isAlive());
  if (trans.brokerThread.broker == null) {
synchronized (trans.brokerThread) {
      try {
        trans.brokerThread.wait(TIMEOUT);
        ;
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
  assertNotNull(trans.brokerThread.broker);
  trans.brokerThread.connected=true;
  trans.brokerThread.broker.onHardwareDisconnected(TransportType.BLUETOOTH);
  assertNull(trans.brokerThread);
  trans=new MultiplexTransport(config,transportListener);
  assertTrue(trans.brokerThread.isAlive());
  try {
    trans=new MultiplexTransport(null,transportListener);
  }
 catch (  IllegalArgumentException e) {
    assertEquals("String_Node_Str",e.getMessage());
  }
catch (  NullPointerException e) {
    Assert.fail("String_Node_Str");
  }
}
Program: 32282
Project: 32282
Buggy source:
public MultiplexTransport(MultiplexTransportConfig transportConfig,final ITransportListener transportListener){
  super(transportListener);
  if (transportConfig == null) {
    this.handleTransportError("String_Node_Str",null);
  }
  this.transportConfig=transportConfig;
  brokerThread=new TransportBrokerThread(transportConfig.context,transportConfig.appId,transportConfig.service);
  brokerThread.start();
  isDisconnecting=false;
}

Fixed version (ground truth):
public MultiplexTransport(MultiplexTransportConfig transportConfig,final ITransportListener transportListener){
  super(transportListener);
  if (transportConfig == null) {
    this.handleTransportError("String_Node_Str",null);
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.transportConfig=transportConfig;
  brokerThread=new TransportBrokerThread(transportConfig.context,transportConfig.appId,transportConfig.service);
  brokerThread.start();
  isDisconnecting=false;
}
Program: 32284
Project: 32284
Buggy source:
/** 
 * This is a unit test for the following methods :   {@link com.smartdevicelink.streaming.StreamPacketizer#StreamPacketizer(IStreamListener,InputStream,SessionType,byte)}
 */
public void testConstructor(){
  byte testSessionId=(byte)0x0A;
  SessionType testSessionType=SessionType.RPC;
  InputStream testInputStream=null;
  byte testWiproVersion=(byte)0x0B;
  IStreamListener testListener=new MockStreamListener();
  MockInterfaceBroker _interfaceBroker=new MockInterfaceBroker();
  BaseTransportConfig _transportConfig=new BTTransportConfig(true);
  SdlSession testSdlSession=SdlSession.createSession(testWiproVersion,_interfaceBroker,_transportConfig);
  try {
    URL url=new URL("String_Node_Str");
    URLConnection urlConnection=url.openConnection();
    testInputStream=new BufferedInputStream(urlConnection.getInputStream());
    StreamPacketizer testStreamPacketizer=new StreamPacketizer(testListener,testInputStream,testSessionType,testSessionId,testSdlSession);
    assertNotNull(Test.NOT_NULL,testStreamPacketizer);
  }
 catch (  IOException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * This is a unit test for the following methods :   {@link com.smartdevicelink.streaming.StreamPacketizer#StreamPacketizer(IStreamListener,InputStream,SessionType,byte)}
 */
public void testConstructor(){
  byte testSessionId=(byte)0x0A;
  SessionType testSessionType=SessionType.RPC;
  InputStream testInputStream=null;
  byte testWiproVersion=(byte)0x0B;
  IStreamListener testListener=new MockStreamListener();
  MockInterfaceBroker _interfaceBroker=new MockInterfaceBroker();
  BaseTransportConfig _transportConfig=new BTTransportConfig(true);
  SdlSession testSdlSession=SdlSession.createSession(testWiproVersion,_interfaceBroker,_transportConfig);
  try {
    testInputStream=new BufferedInputStream(new ByteArrayInputStream("String_Node_Str".getBytes()));
    StreamPacketizer testStreamPacketizer=new StreamPacketizer(testListener,testInputStream,testSessionType,testSessionId,testSdlSession);
    assertNotNull(Test.NOT_NULL,testStreamPacketizer);
  }
 catch (  IOException e) {
    fail("String_Node_Str");
  }
}
Program: 32285
Project: 32285
Buggy source:
/** 
 * This is a unit test for the following methods :   {@link com.smartdevicelink.streaming.StreamRPCPacketizer#StreamRPCPacketizer(IStreamListener,InputStream,RPCRequest,SessionType,byte,byte)}
 */
public void testConstructor(){
  byte testSessionId=(byte)0x0A;
  byte testWV=(byte)0x0B;
  RPCRequest testRequest=new RPCRequest("String_Node_Str");
  SessionType testSessionType=SessionType.RPC;
  InputStream testInputStream=null;
  IStreamListener testListener=new MockStreamListener();
  byte testWiproVersion=(byte)0x0B;
  MockInterfaceBroker _interfaceBroker=new MockInterfaceBroker();
  BaseTransportConfig _transportConfig=new BTTransportConfig(true);
  SdlSession testSdlSession=SdlSession.createSession(testWiproVersion,_interfaceBroker,_transportConfig);
  try {
    URL url=new URL("String_Node_Str");
    URLConnection urlConnection=url.openConnection();
    testInputStream=new BufferedInputStream(urlConnection.getInputStream());
    StreamRPCPacketizer testStreamRpcPacketizer=new StreamRPCPacketizer(null,testListener,testInputStream,testRequest,testSessionType,testSessionId,testWV,testWV,testSdlSession);
    assertNotNull(Test.NOT_NULL,testStreamRpcPacketizer);
  }
 catch (  IOException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * This is a unit test for the following methods :   {@link com.smartdevicelink.streaming.StreamRPCPacketizer#StreamRPCPacketizer(IStreamListener,InputStream,RPCRequest,SessionType,byte,byte)}
 */
public void testConstructor(){
  byte testSessionId=(byte)0x0A;
  byte testWV=(byte)0x0B;
  RPCRequest testRequest=new RPCRequest("String_Node_Str");
  SessionType testSessionType=SessionType.RPC;
  InputStream testInputStream=null;
  IStreamListener testListener=new MockStreamListener();
  byte testWiproVersion=(byte)0x0B;
  MockInterfaceBroker _interfaceBroker=new MockInterfaceBroker();
  BaseTransportConfig _transportConfig=new BTTransportConfig(true);
  SdlSession testSdlSession=SdlSession.createSession(testWiproVersion,_interfaceBroker,_transportConfig);
  try {
    testInputStream=new BufferedInputStream(new ByteArrayInputStream("String_Node_Str".getBytes()));
    StreamRPCPacketizer testStreamRpcPacketizer=new StreamRPCPacketizer(null,testListener,testInputStream,testRequest,testSessionType,testSessionId,testWV,testWV,testSdlSession);
    assertNotNull(Test.NOT_NULL,testStreamRpcPacketizer);
  }
 catch (  IOException e) {
    fail("String_Node_Str");
  }
}
Program: 32286
Project: 32286
Buggy source:
protected synchronized void setStateManually(int state){
  mState=state;
}

Fixed version (ground truth):
protected synchronized void setStateManually(int state){
  mState=state;
  clearInstanceOnError(state);
}
Program: 32287
Project: 32287
Buggy source:
/** 
 * Set the current state of the chat connection
 * @param state  An integer defining the current connection state
 */
private synchronized void setState(int state){
  int previousState=mState;
  mState=state;
  mHandler.obtainMessage(SdlRouterService.MESSAGE_STATE_CHANGE,state,previousState).sendToTarget();
}

Fixed version (ground truth):
/** 
 * Set the current state of the chat connection
 * @param state  An integer defining the current connection state
 */
private synchronized void setState(int state){
  int previousState=mState;
  mState=state;
  mHandler.obtainMessage(SdlRouterService.MESSAGE_STATE_CHANGE,state,previousState).sendToTarget();
  clearInstanceOnError(state);
}
Program: 32288
Project: 32288
Buggy source:
public void testMultiplexConstructor(){
  SdlConnection.enableLegacyMode(false,null);
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
  MultiplexTransportConfig config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  SdlConnection connection=new SdlConnection(config,rsvp);
  assertEquals(TransportType.MULTIPLEX,connection.getCurrentTransportType());
}

Fixed version (ground truth):
public void testMultiplexConstructor(){
  SdlConnection.enableLegacyMode(false,null);
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
  MultiplexTransportConfig config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  SdlConnection connection=new SdlConnection(config,rsvp);
  if (DeviceUtil.isEmulator()) {
    assertEquals(TransportType.BLUETOOTH,connection.getCurrentTransportType());
  }
 else {
    assertEquals(TransportType.MULTIPLEX,connection.getCurrentTransportType());
  }
}
Program: 32291
Project: 32291
Buggy source:
public void testStateTransitions(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  stateChangeHandler=new Handler(){
    int stateDesired=MultiplexBluetoothTransport.STATE_LISTEN;
    @Override public void handleMessage(    Message msg){
      if (!isWaitingForResponse) {
        return;
      }
switch (msg.what) {
case SdlRouterService.MESSAGE_STATE_CHANGE:
        if (msg.arg1 == stateDesired) {
          didCorrectThing=true;
          break;
        }
default :
      didCorrectThing=false;
  }
  REQUEST_LOCK.notify();
}
}
;
bluetooth=MultiplexBluetoothTransport.getBluetoothSerialServerInstance();
assertNull(bluetooth);
bluetooth=MultiplexBluetoothTransport.getBluetoothSerialServerInstance(stateChangeHandler);
assertEquals(bluetooth.getState(),MultiplexBluetoothTransport.STATE_NONE);
bluetooth.start();
assertEquals(bluetooth.getState(),MultiplexBluetoothTransport.STATE_LISTEN);
bluetooth.stop();
assertEquals(bluetooth.getState(),MultiplexBluetoothTransport.STATE_NONE);
}

Fixed version (ground truth):
public void testStateTransitions(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  stateChangeHandler=new Handler(){
    int stateDesired=MultiplexBluetoothTransport.STATE_LISTEN;
    @Override public void handleMessage(    Message msg){
      if (!isWaitingForResponse) {
        return;
      }
switch (msg.what) {
case SdlRouterService.MESSAGE_STATE_CHANGE:
        if (msg.arg1 == stateDesired) {
          didCorrectThing=true;
          break;
        }
default :
      didCorrectThing=false;
  }
  REQUEST_LOCK.notify();
}
}
;
bluetooth=MultiplexBluetoothTransport.getBluetoothSerialServerInstance();
assertNull(bluetooth);
bluetooth=MultiplexBluetoothTransport.getBluetoothSerialServerInstance(stateChangeHandler);
assertEquals(bluetooth.getState(),MultiplexBluetoothTransport.STATE_NONE);
bluetooth.start();
if (DeviceUtil.isEmulator()) {
assertEquals(bluetooth.getState(),MultiplexBluetoothTransport.STATE_NONE);
}
 else {
assertEquals(bluetooth.getState(),MultiplexBluetoothTransport.STATE_LISTEN);
}
bluetooth.stop();
assertEquals(bluetooth.getState(),MultiplexBluetoothTransport.STATE_NONE);
}
Program: 32292
Project: 32292
Buggy source:
public void testOnPacketReceived(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  TransportBroker broker=new TransportBroker(mContext,SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
  assertTrue(broker.start());
}

Fixed version (ground truth):
public void testOnPacketReceived(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  TransportBroker broker=new TransportBroker(mContext,SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
  if (!DeviceUtil.isEmulator()) {
    assertTrue(broker.start());
  }
}
Program: 32293
Project: 32293
Buggy source:
public void testSendPacket(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  TransportBroker broker=new TransportBroker(mContext,SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
  assertTrue(broker.start());
  BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  assertNotNull(adapter);
  assertTrue(adapter.isEnabled());
  int count=0;
  while (broker.routerServiceMessenger == null && count < 10) {
    sleep();
    count++;
  }
  assertNotNull(broker.routerServiceMessenger);
  broker.stop();
}

Fixed version (ground truth):
public void testSendPacket(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  TransportBroker broker=new TransportBroker(mContext,SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
  if (!DeviceUtil.isEmulator()) {
    assertTrue(broker.start());
  }
  BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  if (!DeviceUtil.isEmulator()) {
    assertNotNull(adapter);
    assertTrue(adapter.isEnabled());
  }
  int count=0;
  while (broker.routerServiceMessenger == null && count < 10) {
    sleep();
    count++;
  }
  if (!DeviceUtil.isEmulator()) {
    assertNotNull(broker.routerServiceMessenger);
  }
  broker.stop();
}
Program: 32294
Project: 32294
Buggy source:
public void testStart(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  TransportBroker broker=new TransportBroker(mContext,SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
  assertTrue(broker.start());
  broker.stop();
}

Fixed version (ground truth):
public void testStart(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  TransportBroker broker=new TransportBroker(mContext,SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
  if (!DeviceUtil.isEmulator()) {
    assertTrue(broker.start());
  }
  broker.stop();
}
Program: 32295
Project: 32295
Buggy source:
/** 
 * This is a unit test for the following method :   {@link com.smartdevicelink.util.SdlDataTypeConverter#objectToDouble(Object)}
 */
public void testObjectToDouble(){
  Long testLong=Long.valueOf(1);
  Short testShort=1;
  Float testFloat=1f;
  Double testDouble=1.0;
  Integer testInteger=1;
  Double expectedValue=1.0;
  Double actualNullValue=SdlDataTypeConverter.objectToDouble(null);
  Double actualLongValue=SdlDataTypeConverter.objectToDouble(testLong);
  Double actualShortValue=SdlDataTypeConverter.objectToDouble(testShort);
  Double actualFloatValue=SdlDataTypeConverter.objectToDouble(testFloat);
  Double actualDoubleValue=SdlDataTypeConverter.objectToDouble(testDouble);
  Double actualIntegerValue=SdlDataTypeConverter.objectToDouble(testInteger);
  assertEquals(Test.MATCH,expectedValue,actualDoubleValue);
  assertEquals(Test.MATCH,expectedValue,actualIntegerValue);
  assertNull(Test.NULL,actualNullValue);
  assertNull(Test.NULL,actualLongValue);
  assertNull(Test.NULL,actualShortValue);
  assertNull(Test.NULL,actualFloatValue);
}

Fixed version (ground truth):
/** 
 * This is a unit test for the following method :   {@link com.smartdevicelink.util.SdlDataTypeConverter#objectToDouble(Object)}
 */
public void testObjectToDouble(){
  Long testLong=Long.valueOf(1);
  Short testShort=1;
  Float testFloat=1f;
  Double testDouble=1.0;
  Integer testInteger=1;
  Double expectedValue=1.0;
  Double actualNullValue=SdlDataTypeConverter.objectToDouble(null);
  Double actualLongValue=SdlDataTypeConverter.objectToDouble(testLong);
  Double actualShortValue=SdlDataTypeConverter.objectToDouble(testShort);
  Double actualFloatValue=SdlDataTypeConverter.objectToDouble(testFloat);
  Double actualDoubleValue=SdlDataTypeConverter.objectToDouble(testDouble);
  Double actualIntegerValue=SdlDataTypeConverter.objectToDouble(testInteger);
  assertEquals(Test.MATCH,expectedValue,actualDoubleValue);
  assertEquals(Test.MATCH,expectedValue,actualIntegerValue);
  assertEquals(Test.MATCH,expectedValue,actualFloatValue);
  assertNull(Test.NULL,actualNullValue);
  assertNull(Test.NULL,actualLongValue);
  assertNull(Test.NULL,actualShortValue);
}
Program: 32296
Project: 32296
Buggy source:
@Override protected RPCMessage createMessage(){
  OnSdlChoiceChosen msg=new OnSdlChoiceChosen();
  SdlChoice sdlChoice=msg.new SdlChoice(Test.GENERAL_CHOICE);
  msg.setTriggerSource(Test.GENERAL_TRIGGERSOURCE);
  msg.setSdlChoice(sdlChoice);
  return msg;
}

Fixed version (ground truth):
@Override protected RPCMessage createMessage(){
  OnSdlChoiceChosen msg=new OnSdlChoiceChosen();
  sdlChoice=msg.new SdlChoice(Test.GENERAL_CHOICE);
  msg.setTriggerSource(Test.GENERAL_TRIGGERSOURCE);
  msg.setSdlChoice(sdlChoice);
  return msg;
}