nus-yam/ex-repair huggingface dataset:
Program: 32297
Project: 32297
Buggy source:
@Override protected JSONObject getExpectedParameters(int sdlVersion){
  JSONObject result=new JSONObject();
  try {
    result.put(OnSdlChoiceChosen.KEY_TRIGGER_SOURCE,Test.GENERAL_TRIGGERSOURCE);
    result.put(OnSdlChoiceChosen.KEY_SDL_CHOICE,Test.JSON_CHOICE);
  }
 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(OnSdlChoiceChosen.KEY_TRIGGER_SOURCE,Test.GENERAL_TRIGGERSOURCE);
    result.put(OnSdlChoiceChosen.KEY_SDL_CHOICE,sdlChoice);
  }
 catch (  JSONException e) {
    fail(Test.JSON_FAIL);
  }
  return result;
}
Program: 32299
Project: 32299
Buggy source:
public void testHighSecurity(){
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,false));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,null,null));
}

Fixed version (ground truth):
public void testHighSecurity(){
  requestTListLock();
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,false));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,null,trustedListCallback));
}
Program: 32300
Project: 32300
Buggy source:
public void testLowSecurity(){
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_MONTH);
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,null,null));
}

Fixed version (ground truth):
public void testLowSecurity(){
  requestTListLock();
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_MONTH);
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,null,trustedListCallback));
}
Program: 32301
Project: 32301
Buggy source:
@Override public void httpFailure(int statusCode){
  Log.e(TAG,"String_Node_Str" + statusCode);
synchronized (REQUEST_LOCK) {
    didFinish=true;
    REQUEST_LOCK.notify();
  }
}

Fixed version (ground truth):
@Override public void httpFailure(int statusCode){
  Log.e(TAG,"String_Node_Str" + statusCode);
synchronized (REQUEST_LOCK) {
    didFinish=true;
    REQUEST_LOCK.notify();
  }
  releaseTListLock();
}
Program: 32302
Project: 32302
Buggy source:
public void testNoSecurity(){
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
  assertFalse(RouterServiceValidator.createTrustedListRequest(mContext,true,null,null));
  assertTrue(rsvp.validate());
}

Fixed version (ground truth):
public void testNoSecurity(){
  requestTListLock();
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
  assertFalse(RouterServiceValidator.createTrustedListRequest(mContext,true,null,trustedListCallback));
  assertTrue(rsvp.validate());
}
Program: 32303
Project: 32303
Buggy source:
public void testMediumSecurity(){
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,null,null));
}

Fixed version (ground truth):
public void testMediumSecurity(){
  requestTListLock();
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
  assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
  assertEquals(RouterServiceValidator.getRefreshRate(),REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,null,trustedListCallback));
}
Program: 32304
Project: 32304
Buggy source:
public void testSetTrustedList(){
  assertFalse(RouterServiceValidator.setTrustedList(null,null));
  assertFalse(RouterServiceValidator.setTrustedList(mContext,null));
  assertFalse(RouterServiceValidator.setTrustedList(null,"String_Node_Str"));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,"String_Node_Str"));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST + TEST + TEST+ TEST+ TEST));
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(TEST);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
}

Fixed version (ground truth):
public void testSetTrustedList(){
  requestTListLock();
  assertFalse(RouterServiceValidator.setTrustedList(null,null));
  assertFalse(RouterServiceValidator.setTrustedList(mContext,null));
  assertFalse(RouterServiceValidator.setTrustedList(null,"String_Node_Str"));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,"String_Node_Str"));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST + TEST + TEST+ TEST+ TEST));
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(TEST);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
  releaseTListLock();
}
Program: 32305
Project: 32305
Buggy source:
public void testTrustedListSetAndGet(){
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
  String retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(TEST.equals(retVal));
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(TEST);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
  retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(builder.toString().equals(retVal));
}

Fixed version (ground truth):
public void testTrustedListSetAndGet(){
  requestTListLock();
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
  String retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(TEST.equals(retVal));
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(TEST);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
  retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(builder.toString().equals(retVal));
  releaseTListLock();
}
Program: 32306
Project: 32306
Buggy source:
public void testGetAndCheckList(){
  final Object REQUEST_LOCK=new Object();
  didFinish=false;
  HttpRequestTaskCallback cb=new HttpRequestTaskCallback(){
    @Override public void httpCallComplete(    String response){
      Log.d(TAG,"String_Node_Str" + response);
synchronized (REQUEST_LOCK) {
        didFinish=true;
        REQUEST_LOCK.notify();
      }
    }
    @Override public void httpFailure(    int statusCode){
      Log.e(TAG,"String_Node_Str" + statusCode);
synchronized (REQUEST_LOCK) {
        didFinish=true;
        REQUEST_LOCK.notify();
      }
    }
  }
;
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,cb));
synchronized (REQUEST_LOCK) {
    try {
      REQUEST_LOCK.wait();
      assertTrue(didFinish);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void testGetAndCheckList(){
  requestTListLock();
  final Object REQUEST_LOCK=new Object();
  didFinish=false;
  HttpRequestTaskCallback cb=new HttpRequestTaskCallback(){
    @Override public void httpCallComplete(    String response){
      Log.d(TAG,"String_Node_Str" + response);
synchronized (REQUEST_LOCK) {
        didFinish=true;
        REQUEST_LOCK.notify();
      }
      releaseTListLock();
    }
    @Override public void httpFailure(    int statusCode){
      Log.e(TAG,"String_Node_Str" + statusCode);
synchronized (REQUEST_LOCK) {
        didFinish=true;
        REQUEST_LOCK.notify();
      }
      releaseTListLock();
    }
  }
;
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true,cb));
synchronized (REQUEST_LOCK) {
    try {
      REQUEST_LOCK.wait();
      assertTrue(didFinish);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 32307
Project: 32307
Buggy source:
public void testInvalidateList(){
  assertFalse(RouterServiceValidator.invalidateList(null));
  assertTrue(RouterServiceValidator.invalidateList(mContext));
}

Fixed version (ground truth):
public void testInvalidateList(){
  requestTListLock();
  assertFalse(RouterServiceValidator.invalidateList(null));
  assertTrue(RouterServiceValidator.invalidateList(mContext));
  releaseTListLock();
}
Program: 32308
Project: 32308
Buggy source:
/** 
 * Test to check that we can save our last request which actually houses all the previous known sdl enabled apps
 */
public void testRequestChange(){
  RouterServiceValidator.setLastRequest(mContext,null);
  assertNull(RouterServiceValidator.getLastRequest(mContext));
  JSONObject object=null;
  try {
    object=new JSONObject(TEST);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  assertTrue(RouterServiceValidator.setLastRequest(mContext,object.toString()));
  String oldRequest=RouterServiceValidator.getLastRequest(mContext);
  assertNotNull(oldRequest);
  assertTrue(object.toString().equals(oldRequest));
  String test="String_Node_Str";
  object=null;
  try {
    object=new JSONObject(test);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  RouterServiceValidator.setLastRequest(mContext,null);
}

Fixed version (ground truth):
/** 
 * Test to check that we can save our last request which actually houses all the previous known sdl enabled apps
 */
public void testRequestChange(){
  requestTListLock();
  RouterServiceValidator.setLastRequest(mContext,null);
  assertNull(RouterServiceValidator.getLastRequest(mContext));
  JSONObject object=null;
  try {
    object=new JSONObject(TEST);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  assertTrue(RouterServiceValidator.setLastRequest(mContext,object.toString()));
  String oldRequest=RouterServiceValidator.getLastRequest(mContext);
  assertNotNull(oldRequest);
  assertTrue(object.toString().equals(oldRequest));
  String test="String_Node_Str";
  object=null;
  try {
    object=new JSONObject(test);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  RouterServiceValidator.setLastRequest(mContext,null);
  releaseTListLock();
}
Program: 32309
Project: 32309
Buggy source:
public void testGetTrustedList(){
  assertNull(RouterServiceValidator.getTrustedList(null));
  assertNotNull(RouterServiceValidator.getTrustedList(mContext));
}

Fixed version (ground truth):
public void testGetTrustedList(){
  requestTListLock();
  assertNull(RouterServiceValidator.getTrustedList(null));
  assertNotNull(RouterServiceValidator.getTrustedList(mContext));
  releaseTListLock();
}
Program: 32310
Project: 32310
Buggy source:
public void testInvalidationSequence(){
  assertTrue(RouterServiceValidator.invalidateList(mContext));
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,false));
}

Fixed version (ground truth):
public void testInvalidationSequence(){
  requestTListLock();
  assertTrue(RouterServiceValidator.invalidateList(mContext));
  assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,false,null,trustedListCallback));
}
Program: 32311
Project: 32311
Buggy source:
@Override public void httpCallComplete(String response){
  Log.d(TAG,"String_Node_Str" + response);
synchronized (REQUEST_LOCK) {
    didFinish=true;
    REQUEST_LOCK.notify();
  }
}

Fixed version (ground truth):
@Override public void httpCallComplete(String response){
  Log.d(TAG,"String_Node_Str" + response);
synchronized (REQUEST_LOCK) {
    didFinish=true;
    REQUEST_LOCK.notify();
  }
  releaseTListLock();
}
Program: 32312
Project: 32312
Buggy source:
public static String base64Encode(byte bytesToEncode[],int offset,int length){
  StringBuilder sb=new StringBuilder();
  int idxin=0;
  int b64idx=0;
  for (idxin=offset; idxin < offset + length; idxin++) {
switch ((idxin - offset) % 3) {
case 0:
      b64idx=(bytesToEncode[idxin] >> 2) & 0x3f;
    break;
case 1:
  b64idx=(bytesToEncode[idxin] >> 4) & 0x0f;
b64idx|=((bytesToEncode[idxin - 1] << 4) & 0x30);
break;
case 2:
b64idx=(bytesToEncode[idxin] >> 6) & 0x03;
b64idx|=((bytesToEncode[idxin - 1] << 2) & 0x3c);
sb.append(m_base64Chars.charAt(b64idx));
b64idx=bytesToEncode[idxin] & 0x3f;
break;
}
sb.append(m_base64Chars.charAt(b64idx));
}
switch ((idxin - offset) % 3) {
case 0:
break;
case 1:
b64idx=(bytesToEncode[idxin - 1] << 4) & 0x30;
sb.append(m_base64Chars.charAt(b64idx));
sb.append("String_Node_Str");
break;
case 2:
b64idx=((bytesToEncode[idxin - 1] << 2) & 0x3c);
sb.append(m_base64Chars.charAt(b64idx));
sb.append('=');
break;
}
return sb.toString();
}

Fixed version (ground truth):
/** 
 * @param bytesToEncode A byte array to encode into base64 String.
 * @param offset        Offset to begin at
 * @param length        Length to read
 * @return Base64 encoded String or a null String if input array is null or the input range is out of bounds.
 */
public static String base64Encode(byte bytesToEncode[],int offset,int length){
  if (bytesToEncode == null || bytesToEncode.length < length || bytesToEncode.length < offset + length) {
    return null;
  }
  StringBuilder sb=new StringBuilder();
  int idxin=0;
  int b64idx=0;
  for (idxin=offset; idxin < offset + length; idxin++) {
switch ((idxin - offset) % 3) {
case 0:
      b64idx=(bytesToEncode[idxin] >> 2) & 0x3f;
    break;
case 1:
  b64idx=(bytesToEncode[idxin] >> 4) & 0x0f;
b64idx|=((bytesToEncode[idxin - 1] << 4) & 0x30);
break;
case 2:
b64idx=(bytesToEncode[idxin] >> 6) & 0x03;
b64idx|=((bytesToEncode[idxin - 1] << 2) & 0x3c);
sb.append(getBase64Char(b64idx));
b64idx=bytesToEncode[idxin] & 0x3f;
break;
}
sb.append(getBase64Char(b64idx));
}
switch ((idxin - offset) % 3) {
case 0:
break;
case 1:
b64idx=(bytesToEncode[idxin - 1] << 4) & 0x30;
sb.append(getBase64Char(b64idx));
sb.append("String_Node_Str");
break;
case 2:
b64idx=((bytesToEncode[idxin - 1] << 2) & 0x3c);
sb.append(getBase64Char(b64idx));
sb.append('=');
break;
}
return sb.toString();
}
Program: 32313
Project: 32313
Buggy source:
/** 
 * Verifies that the enum values are not null upon valid assignment.
 */
public void testValidEnums(){
  String example="String_Node_Str";
  DisplayType enumCid=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumType2=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumType5=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumNgn=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumGen2_8Dma=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumGen2_6Dma=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumMfd3=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumMfd4=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumMfd5=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumGen3_8Inch=DisplayType.valueForString(example);
  assertNotNull("String_Node_Str",enumCid);
  assertNotNull("String_Node_Str",enumType2);
  assertNotNull("String_Node_Str",enumType5);
  assertNotNull("String_Node_Str",enumNgn);
  assertNotNull("String_Node_Str",enumGen2_8Dma);
  assertNotNull("String_Node_Str",enumGen2_6Dma);
  assertNotNull("String_Node_Str",enumMfd3);
  assertNotNull("String_Node_Str",enumMfd4);
  assertNotNull("String_Node_Str",enumMfd5);
  assertNotNull("String_Node_Str",enumGen3_8Inch);
}

Fixed version (ground truth):
/** 
 * Verifies that the enum values are not null upon valid assignment.
 */
public void testValidEnums(){
  String example="String_Node_Str";
  DisplayType enumCid=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumType2=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumType5=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumNgn=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumGen2_8Dma=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumGen2_6Dma=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumMfd3=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumMfd4=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumMfd5=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumGen3_8Inch=DisplayType.valueForString(example);
  example="String_Node_Str";
  DisplayType enumGeneric=DisplayType.valueForString(example);
  assertNotNull("String_Node_Str",enumCid);
  assertNotNull("String_Node_Str",enumType2);
  assertNotNull("String_Node_Str",enumType5);
  assertNotNull("String_Node_Str",enumNgn);
  assertNotNull("String_Node_Str",enumGen2_8Dma);
  assertNotNull("String_Node_Str",enumGen2_6Dma);
  assertNotNull("String_Node_Str",enumMfd3);
  assertNotNull("String_Node_Str",enumMfd4);
  assertNotNull("String_Node_Str",enumMfd5);
  assertNotNull("String_Node_Str",enumGen3_8Inch);
  assertNotNull("String_Node_Str",enumGeneric);
}
Program: 32314
Project: 32314
Buggy source:
/** 
 * Verifies the possible enum values of DisplayType.
 */
public void testListEnum(){
  List<DisplayType> enumValueList=Arrays.asList(DisplayType.values());
  List<DisplayType> enumTestList=new ArrayList<DisplayType>();
  enumTestList.add(DisplayType.CID);
  enumTestList.add(DisplayType.TYPE2);
  enumTestList.add(DisplayType.TYPE5);
  enumTestList.add(DisplayType.NGN);
  enumTestList.add(DisplayType.GEN2_8_DMA);
  enumTestList.add(DisplayType.GEN2_6_DMA);
  enumTestList.add(DisplayType.MFD3);
  enumTestList.add(DisplayType.MFD4);
  enumTestList.add(DisplayType.MFD5);
  enumTestList.add(DisplayType.GEN3_8_INCH);
  assertTrue("String_Node_Str",enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}

Fixed version (ground truth):
/** 
 * Verifies the possible enum values of DisplayType.
 */
public void testListEnum(){
  List<DisplayType> enumValueList=Arrays.asList(DisplayType.values());
  List<DisplayType> enumTestList=new ArrayList<DisplayType>();
  enumTestList.add(DisplayType.CID);
  enumTestList.add(DisplayType.TYPE2);
  enumTestList.add(DisplayType.TYPE5);
  enumTestList.add(DisplayType.NGN);
  enumTestList.add(DisplayType.GEN2_8_DMA);
  enumTestList.add(DisplayType.GEN2_6_DMA);
  enumTestList.add(DisplayType.MFD3);
  enumTestList.add(DisplayType.MFD4);
  enumTestList.add(DisplayType.MFD5);
  enumTestList.add(DisplayType.GEN3_8_INCH);
  enumTestList.add(DisplayType.SDL_GENERIC);
  assertTrue("String_Node_Str",enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
Program: 32315
Project: 32315
Buggy source:
public void testForceConnectEvent(){
  SdlConnection.enableLegacyMode(false,null);
  assertNull(SdlConnectionTestClass.cachedMultiConfig);
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PERFORM_ALL_CHECKS);
  MultiplexTransportConfig config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  SdlConnectionTestClass connection=new SdlConnectionTestClass(config,rsvp);
  assertNotNull(SdlConnectionTestClass.cachedMultiConfig);
  assertTrue(SdlConnectionTestClass.isLegacyModeEnabled());
  assertEquals(TransportType.BLUETOOTH,connection.getCurrentTransportType());
  assertNotNull(SdlConnectionTestClass.cachedMultiConfig);
  connection.forceHardwareConnectEvent(TransportType.MULTIPLEX);
  assertFalse(connection.connected);
  assertNotNull(SdlConnectionTestClass.cachedMultiConfig.getService());
  assertEquals(TransportType.MULTIPLEX,connection.getCurrentTransportType());
  MultiplexTransportConfig null_service_config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  null_service_config.setService(null);
  SdlConnectionTestClass null_service_connection=new SdlConnectionTestClass(null_service_config,null);
  Exception exception=null;
  try {
    null_service_connection.forceHardwareConnectEvent(TransportType.MULTIPLEX);
  }
 catch (  NullPointerException e) {
    exception=e;
  }
  assertNull(exception);
}

Fixed version (ground truth):
public void testForceConnectEvent(){
  SdlConnection.enableLegacyMode(false,null);
  assertNull(SdlConnectionTestClass.cachedMultiConfig);
  RouterServiceValidator rsvp=new RouterServiceValidator(this.mContext);
  rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PERFORM_ALL_CHECKS);
  MultiplexTransportConfig config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  SdlConnectionTestClass connection=new SdlConnectionTestClass(config,rsvp);
  assertNotNull(SdlConnectionTestClass.cachedMultiConfig);
  assertTrue(SdlConnectionTestClass.isLegacyModeEnabled());
  assertEquals(TransportType.BLUETOOTH,connection.getCurrentTransportType());
  assertNotNull(SdlConnectionTestClass.cachedMultiConfig);
  connection.forceHardwareConnectEvent(TransportType.MULTIPLEX);
  assertFalse(connection.connected);
  SdlConnectionTestClass.cachedMultiConfig.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
  assertNotNull(SdlConnectionTestClass.cachedMultiConfig.getService());
  assertEquals(TransportType.MULTIPLEX,connection.getCurrentTransportType());
  MultiplexTransportConfig null_service_config=new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
  null_service_config.setService(null);
  SdlConnectionTestClass null_service_connection=new SdlConnectionTestClass(null_service_config,null);
  Exception exception=null;
  try {
    null_service_connection.forceHardwareConnectEvent(TransportType.MULTIPLEX);
  }
 catch (  NullPointerException e) {
    exception=e;
  }
  assertNull(exception);
}
Program: 32316
Project: 32316
Buggy source:
public void testSetTrustedList(){
  assertFalse(RouterServiceValidator.setTrustedList(null,null));
  assertFalse(RouterServiceValidator.setTrustedList(mContext,null));
  assertFalse(RouterServiceValidator.setTrustedList(null,"String_Node_Str"));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,"String_Node_Str"));
  String test="String_Node_Str";
  assertTrue(RouterServiceValidator.setTrustedList(mContext,test));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,test + test + test+ test+ test));
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(test);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
}

Fixed version (ground truth):
public void testSetTrustedList(){
  assertFalse(RouterServiceValidator.setTrustedList(null,null));
  assertFalse(RouterServiceValidator.setTrustedList(mContext,null));
  assertFalse(RouterServiceValidator.setTrustedList(null,"String_Node_Str"));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,"String_Node_Str"));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST + TEST + TEST+ TEST+ TEST));
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(TEST);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
}
Program: 32317
Project: 32317
Buggy source:
public void testTrustedListSetAndGet(){
  String test="String_Node_Str";
  assertTrue(RouterServiceValidator.setTrustedList(mContext,test));
  String retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(test.equals(retVal));
  retVal=null;
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(test);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
  retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(builder.toString().equals(retVal));
}

Fixed version (ground truth):
public void testTrustedListSetAndGet(){
  assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
  String retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(TEST.equals(retVal));
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < 1000; i++) {
    builder.append(TEST);
  }
  assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
  retVal=RouterServiceValidator.getTrustedList(mContext);
  assertNotNull(retVal);
  assertTrue(builder.toString().equals(retVal));
}
Program: 32318
Project: 32318
Buggy source:
/** 
 * Test to check that we can save our last request which actually houses all the previous known sdl enabled apps
 */
public void testRequestChange(){
  RouterServiceValidator.setLastRequest(mContext,null);
  assertNull(RouterServiceValidator.getLastRequest(mContext));
  String test="String_Node_Str";
  JSONObject object=null;
  try {
    object=new JSONObject(test);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  assertTrue(RouterServiceValidator.setLastRequest(mContext,object.toString()));
  String oldRequest=RouterServiceValidator.getLastRequest(mContext);
  assertNotNull(oldRequest);
  assertTrue(object.toString().equals(oldRequest));
  test="String_Node_Str";
  object=null;
  try {
    object=new JSONObject(test);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  RouterServiceValidator.setLastRequest(mContext,null);
}

Fixed version (ground truth):
/** 
 * Test to check that we can save our last request which actually houses all the previous known sdl enabled apps
 */
public void testRequestChange(){
  RouterServiceValidator.setLastRequest(mContext,null);
  assertNull(RouterServiceValidator.getLastRequest(mContext));
  JSONObject object=null;
  try {
    object=new JSONObject(TEST);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  assertTrue(RouterServiceValidator.setLastRequest(mContext,object.toString()));
  String oldRequest=RouterServiceValidator.getLastRequest(mContext);
  assertNotNull(oldRequest);
  assertTrue(object.toString().equals(oldRequest));
  String test="String_Node_Str";
  object=null;
  try {
    object=new JSONObject(test);
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  assertNotNull(object);
  assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
  RouterServiceValidator.setLastRequest(mContext,null);
}
Program: 32319
Project: 32319
Buggy source:
public static boolean isValidDetailLevel(String dtString){
  Boolean isValid=false;
  if (dtString.equalsIgnoreCase("String_Node_Str"))   isValid=true;
 else   if (dtString.equalsIgnoreCase("String_Node_Str"))   isValid=true;
 else   if (dtString.equalsIgnoreCase("String_Node_Str"))   isValid=true;
  return isValid;
}

Fixed version (ground truth):
public static boolean isValidDetailLevel(String dtString){
  Boolean isValid=false;
  if (dtString != null) {
    if (dtString.equalsIgnoreCase("String_Node_Str"))     isValid=true;
 else     if (dtString.equalsIgnoreCase("String_Node_Str"))     isValid=true;
 else     if (dtString.equalsIgnoreCase("String_Node_Str"))     isValid=true;
  }
  return isValid;
}
Program: 32320
Project: 32320
Buggy source:
public static DetailLevel getLevel(Mod thisMod){
  return levels[thisMod.ordinal()];
}

Fixed version (ground truth):
public static DetailLevel getLevel(Mod thisMod){
  if (thisMod != null) {
    return levels[thisMod.ordinal()];
  }
  return null;
}
Program: 32321
Project: 32321
Buggy source:
public static void setAllLevels(DetailLevel thisDetail){
  for (int i=0; i < levels.length; i++) {
    levels[i]=thisDetail;
  }
}

Fixed version (ground truth):
public static void setAllLevels(DetailLevel thisDetail){
  if (thisDetail != null) {
    for (int i=0; i < levels.length; i++) {
      levels[i]=thisDetail;
    }
  }
}
Program: 32322
Project: 32322
Buggy source:
public static void setLevel(Mod thisMod,DetailLevel thisDetail){
  levels[thisMod.ordinal()]=thisDetail;
}

Fixed version (ground truth):
public static void setLevel(Mod thisMod,DetailLevel thisDetail){
  if (thisMod != null && thisDetail != null) {
    levels[thisMod.ordinal()]=thisDetail;
  }
}
Program: 32323
Project: 32323
Buggy source:
public void testHandleMessage(){
  new Handler(Looper.getMainLooper()).post(new Runnable(){
    @Override public void run(){
      SdlRouterService router=new SdlRouterService();
      SdlRouterService.RegisteredApp app=router.new RegisteredApp(APP_ID,messenger);
      app.handleMessage(TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START,bytes);
      assertNotNull(app.buffer);
    }
  }
);
}

Fixed version (ground truth):
public void testHandleMessage(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  SdlRouterService router=new SdlRouterService();
  SdlRouterService.RegisteredApp app=router.new RegisteredApp(APP_ID,messenger);
  app.handleMessage(TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START,bytes);
  assertNotNull(app.buffer);
}
Program: 32324
Project: 32324
Buggy source:
public void testNullBuffer(){
  new Handler(Looper.getMainLooper()).post(new Runnable(){
    @Override public void run(){
      SdlRouterService router=new SdlRouterService();
      SdlRouterService.RegisteredApp app=router.new RegisteredApp(APP_ID,messenger);
      app.buffer=null;
      app.handleMessage(TransportConstants.BYTES_TO_SEND_FLAG_NONE,bytes);
      assertNull(app.buffer);
    }
  }
);
}

Fixed version (ground truth):
public void testNullBuffer(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  SdlRouterService router=new SdlRouterService();
  SdlRouterService.RegisteredApp app=router.new RegisteredApp(APP_ID,messenger);
  app.buffer=null;
  app.handleMessage(TransportConstants.BYTES_TO_SEND_FLAG_NONE,bytes);
  assertNull(app.buffer);
}
Program: 32325
Project: 32325
Buggy source:
public synchronized void setHMILevel(HMILevel hmiVal){
  hmiLevel=hmiVal;
  if ((hmiVal.equals(HMILevel.HMI_FULL)) || (hmiVal.equals(HMILevel.HMI_LIMITED)))   setUserSelectedStatus(true);
 else   if (hmiVal.equals(HMILevel.HMI_NONE))   setUserSelectedStatus(false);
}

Fixed version (ground truth):
public synchronized void setHMILevel(HMILevel hmiVal){
  hmiLevel=hmiVal;
  if (hmiVal != null) {
    if ((hmiVal.equals(HMILevel.HMI_FULL)) || (hmiVal.equals(HMILevel.HMI_LIMITED)))     setUserSelectedStatus(true);
 else     if (hmiVal.equals(HMILevel.HMI_NONE))     setUserSelectedStatus(false);
  }
 else {
    setUserSelectedStatus(false);
  }
}
Program: 32326
Project: 32326
Buggy source:
public static BinaryFrameHeader parseBinaryHeader(byte[] binHeader){
  BinaryFrameHeader msg=new BinaryFrameHeader();
  byte RPC_Type=(byte)(binHeader[0] >>> 4);
  msg.setRPCType(RPC_Type);
  int _functionID=(BitConverter.intFromByteArray(binHeader,0) & 0x0FFFFFFF);
  msg.setFunctionID(_functionID);
  int corrID=BitConverter.intFromByteArray(binHeader,4);
  msg.setCorrID(corrID);
  int _jsonSize=BitConverter.intFromByteArray(binHeader,8);
  msg.setJsonSize(_jsonSize);
  try {
    if (_jsonSize > 0) {
      byte[] _jsonData=new byte[_jsonSize];
      System.arraycopy(binHeader,12,_jsonData,0,_jsonSize);
      msg.setJsonData(_jsonData);
    }
    if (binHeader.length - _jsonSize - 12 > 0) {
      byte[] _bulkData=new byte[binHeader.length - _jsonSize - 12];
      System.arraycopy(binHeader,12 + _jsonSize,_bulkData,0,_bulkData.length);
      msg.setBulkData(_bulkData);
    }
  }
 catch (  OutOfMemoryError e) {
    Log.e(TAG,"String_Node_Str");
    return null;
  }
  return msg;
}

Fixed version (ground truth):
public static BinaryFrameHeader parseBinaryHeader(byte[] binHeader){
  BinaryFrameHeader msg=new BinaryFrameHeader();
  byte RPC_Type=(byte)(binHeader[0] >>> 4);
  msg.setRPCType(RPC_Type);
  int _functionID=(BitConverter.intFromByteArray(binHeader,0) & 0x0FFFFFFF);
  msg.setFunctionID(_functionID);
  int corrID=BitConverter.intFromByteArray(binHeader,4);
  msg.setCorrID(corrID);
  int _jsonSize=BitConverter.intFromByteArray(binHeader,8);
  msg.setJsonSize(_jsonSize);
  try {
    if (_jsonSize > 0) {
      byte[] _jsonData=new byte[_jsonSize];
      System.arraycopy(binHeader,12,_jsonData,0,_jsonSize);
      msg.setJsonData(_jsonData);
    }
    if (binHeader.length - _jsonSize - 12 > 0) {
      byte[] _bulkData=new byte[binHeader.length - _jsonSize - 12];
      System.arraycopy(binHeader,12 + _jsonSize,_bulkData,0,_bulkData.length);
      msg.setBulkData(_bulkData);
    }
  }
 catch (  OutOfMemoryError|ArrayIndexOutOfBoundsException e) {
    Log.e(TAG,"String_Node_Str");
    return null;
  }
  return msg;
}
Program: 32327
Project: 32327
Buggy source:
protected void cycleProxy(SdlDisconnectedReason disconnectedReason){
  if (_cycling)   return;
synchronized (CYCLE_LOCK) {
    try {
      _cycling=true;
      cleanProxy(disconnectedReason);
      initializeProxy();
      if (!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason) && !_transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.SDL_PROXY_CYCLED),disconnectedReason);
      }
    }
 catch (    SdlException e) {
      Intent sendIntent=createBroadcastIntent();
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str");
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str" + e.getSdlExceptionCause());
      sendBroadcastIntent(sendIntent);
switch (e.getSdlExceptionCause()) {
case BLUETOOTH_DISABLED:
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_DISABLED),SdlDisconnectedReason.BLUETOOTH_DISABLED);
      break;
case BLUETOOTH_ADAPTER_NULL:
    notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_ADAPTER_NULL),SdlDisconnectedReason.BLUETOOTH_ADAPTER_ERROR);
  break;
default :
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
break;
}
}
catch (Exception e) {
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
}
_cycling=false;
}
}

Fixed version (ground truth):
protected void cycleProxy(SdlDisconnectedReason disconnectedReason){
  if (_cycling)   return;
synchronized (CYCLE_LOCK) {
    try {
      _cycling=true;
      cleanProxy(disconnectedReason);
      initializeProxy();
      if (!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason)) {
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.SDL_PROXY_CYCLED),disconnectedReason);
      }
    }
 catch (    SdlException e) {
      Intent sendIntent=createBroadcastIntent();
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str");
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str" + e.getSdlExceptionCause());
      sendBroadcastIntent(sendIntent);
switch (e.getSdlExceptionCause()) {
case BLUETOOTH_DISABLED:
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_DISABLED),SdlDisconnectedReason.BLUETOOTH_DISABLED);
      break;
case BLUETOOTH_ADAPTER_NULL:
    notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_ADAPTER_NULL),SdlDisconnectedReason.BLUETOOTH_ADAPTER_ERROR);
  break;
default :
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
break;
}
}
catch (Exception e) {
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
}
_cycling=false;
}
}
Program: 32328
Project: 32328
Buggy source:
@Override public void onDestroy(){
  stopClientPings();
  if (versionCheckTimeOutHandler != null) {
    versionCheckTimeOutHandler.removeCallbacks(versionCheckRunable);
  }
  if (altTransportTimerHandler != null) {
    altTransportTimerHandler.removeCallbacks(versionCheckRunable);
    altTransportTimerHandler=null;
    versionCheckRunable=null;
  }
  Log.w(TAG,"String_Node_Str");
  closing=true;
  currentContext=null;
  unregisterAllReceivers();
  closeBluetoothSerialServer();
  if (registeredApps != null) {
synchronized (REGISTERED_APPS_LOCK) {
      registeredApps.clear();
      registeredApps=null;
    }
  }
synchronized (SESSION_LOCK) {
    if (this.sessionMap != null) {
      this.sessionMap.clear();
      this.sessionMap=null;
    }
    if (this.sessionHashIdMap != null) {
      this.sessionHashIdMap.clear();
      this.sessionHashIdMap=null;
    }
  }
  startSequenceComplete=false;
  if (packetExecuter != null) {
    packetExecuter.shutdownNow();
    packetExecuter=null;
  }
  exitForeground();
  if (packetWriteTaskMaster != null) {
    packetWriteTaskMaster.close();
    packetWriteTaskMaster=null;
  }
  super.onDestroy();
  System.gc();
  if (!wrongProcess) {
    try {
      android.os.Process.killProcess(android.os.Process.myPid());
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
@Override public void onDestroy(){
  stopClientPings();
  if (versionCheckTimeOutHandler != null) {
    versionCheckTimeOutHandler.removeCallbacks(versionCheckRunable);
    versionCheckTimeOutHandler=null;
  }
  if (altTransportTimerHandler != null) {
    altTransportTimerHandler.removeCallbacks(versionCheckRunable);
    altTransportTimerHandler=null;
    versionCheckRunable=null;
  }
  Log.w(TAG,"String_Node_Str");
  closing=true;
  currentContext=null;
  unregisterAllReceivers();
  closeBluetoothSerialServer();
  if (registeredApps != null) {
synchronized (REGISTERED_APPS_LOCK) {
      registeredApps.clear();
      registeredApps=null;
    }
  }
synchronized (SESSION_LOCK) {
    if (this.sessionMap != null) {
      this.sessionMap.clear();
      this.sessionMap=null;
    }
    if (this.sessionHashIdMap != null) {
      this.sessionHashIdMap.clear();
      this.sessionHashIdMap=null;
    }
  }
  startSequenceComplete=false;
  if (packetExecuter != null) {
    packetExecuter.shutdownNow();
    packetExecuter=null;
  }
  exitForeground();
  if (packetWriteTaskMaster != null) {
    packetWriteTaskMaster.close();
    packetWriteTaskMaster=null;
  }
  super.onDestroy();
  System.gc();
  if (!wrongProcess) {
    try {
      android.os.Process.killProcess(android.os.Process.myPid());
    }
 catch (    Exception e) {
    }
  }
}
Program: 32330
Project: 32330
Buggy source:
public void handleMessage(int flags,byte[] packet){
  if (flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START) {
    clearBuffer();
    buffer=new ByteAraryMessageAssembler();
    buffer.init();
  }
  if (buffer == null) {
    Log.e(TAG,"String_Node_Str");
  }
  if (!buffer.handleMessage(flags,packet)) {
    Log.e(TAG,"String_Node_Str");
  }
  if (buffer.isFinished()) {
    byte[] bytes=buffer.getBytes();
    if (queue != null) {
      queue.add(new PacketWriteTask(bytes,0,bytes.length,this.prioirtyForBuffingMessage));
      if (packetWriteTaskMaster != null) {
        packetWriteTaskMaster.alert();
      }
    }
    buffer.close();
  }
}

Fixed version (ground truth):
public void handleMessage(int flags,byte[] packet){
  if (flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START) {
    clearBuffer();
    buffer=new ByteAraryMessageAssembler();
    buffer.init();
  }
  if (buffer == null) {
    Log.e(TAG,"String_Node_Str");
  }
 else {
    if (!buffer.handleMessage(flags,packet)) {
      Log.e(TAG,"String_Node_Str");
    }
    if (buffer.isFinished()) {
      byte[] bytes=buffer.getBytes();
      if (queue != null) {
        queue.add(new PacketWriteTask(bytes,0,bytes.length,this.prioirtyForBuffingMessage));
        if (packetWriteTaskMaster != null) {
          packetWriteTaskMaster.alert();
        }
      }
      buffer.close();
    }
  }
}
Program: 32331
Project: 32331
Buggy source:
public void handleInitResult(boolean val){
  setInitSuccess(val);
  session.onSecurityInitialized();
}

Fixed version (ground truth):
public void handleInitResult(boolean val){
  if (session == null)   return;
  setInitSuccess(val);
  session.onSecurityInitialized();
}
Program: 32332
Project: 32332
Buggy source:
protected void cycleProxy(SdlDisconnectedReason disconnectedReason){
  if (_cycling)   return;
synchronized (CYCLE_LOCK) {
    try {
      _cycling=true;
      cleanProxy(disconnectedReason);
      initializeProxy();
      if (!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason) && !_transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.SDL_PROXY_CYCLED),disconnectedReason);
      }
    }
 catch (    SdlException e) {
      Intent sendIntent=createBroadcastIntent();
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str");
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str" + e.getSdlExceptionCause());
      sendBroadcastIntent(sendIntent);
switch (e.getSdlExceptionCause()) {
case BLUETOOTH_DISABLED:
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_DISABLED),SdlDisconnectedReason.BLUETOOTH_DISABLED);
      break;
case BLUETOOTH_ADAPTER_NULL:
    notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_ADAPTER_NULL),SdlDisconnectedReason.BLUETOOTH_ADAPTER_ERROR);
  break;
default :
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
break;
}
}
catch (Exception e) {
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
}
_cycling=false;
}
}

Fixed version (ground truth):
protected void cycleProxy(SdlDisconnectedReason disconnectedReason){
  if (_cycling)   return;
synchronized (CYCLE_LOCK) {
    try {
      _cycling=true;
      cleanProxy(disconnectedReason);
      initializeProxy();
      if (!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason)) {
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.SDL_PROXY_CYCLED),disconnectedReason);
      }
    }
 catch (    SdlException e) {
      Intent sendIntent=createBroadcastIntent();
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str");
      updateBroadcastIntent(sendIntent,"String_Node_Str","String_Node_Str" + e.getSdlExceptionCause());
      sendBroadcastIntent(sendIntent);
switch (e.getSdlExceptionCause()) {
case BLUETOOTH_DISABLED:
        notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_DISABLED),SdlDisconnectedReason.BLUETOOTH_DISABLED);
      break;
case BLUETOOTH_ADAPTER_NULL:
    notifyProxyClosed("String_Node_Str",new SdlException("String_Node_Str",SdlExceptionCause.BLUETOOTH_ADAPTER_NULL),SdlDisconnectedReason.BLUETOOTH_ADAPTER_ERROR);
  break;
default :
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
break;
}
}
catch (Exception e) {
notifyProxyClosed("String_Node_Str",e,SdlDisconnectedReason.GENERIC_ERROR);
}
_cycling=false;
}
}
Program: 32333
Project: 32333
Buggy source:
public void handleMessage(int flags,byte[] packet){
  if (flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START) {
    clearBuffer();
    buffer=new ByteAraryMessageAssembler();
    buffer.init();
  }
  if (buffer == null) {
    Log.e(TAG,"String_Node_Str");
  }
  if (!buffer.handleMessage(flags,packet)) {
    Log.e(TAG,"String_Node_Str");
  }
  if (buffer.isFinished()) {
    byte[] bytes=buffer.getBytes();
    if (queue != null) {
      queue.add(new PacketWriteTask(bytes,0,bytes.length,this.prioirtyForBuffingMessage));
      if (packetWriteTaskMaster != null) {
        packetWriteTaskMaster.alert();
      }
    }
    buffer.close();
  }
}

Fixed version (ground truth):
public void handleMessage(int flags,byte[] packet){
  if (flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START) {
    clearBuffer();
    buffer=new ByteAraryMessageAssembler();
    buffer.init();
  }
  if (buffer != null) {
    if (!buffer.handleMessage(flags,packet)) {
      Log.e(TAG,"String_Node_Str");
    }
    if (buffer.isFinished()) {
      byte[] bytes=buffer.getBytes();
      if (queue != null) {
        queue.add(new PacketWriteTask(bytes,0,bytes.length,this.prioirtyForBuffingMessage));
        if (packetWriteTaskMaster != null) {
          packetWriteTaskMaster.alert();
        }
      }
      buffer.close();
    }
  }
}
Program: 32335
Project: 32335
Buggy source:
/** 
 * Checks if the specified connected USB accessory is what we expect.
 * @param accessory Accessory to check
 * @return true if the accessory is right
 */
private boolean isAccessorySupported(UsbAccessory accessory){
  boolean manufacturerMatches=ACCESSORY_MANUFACTURER.equals(accessory.getManufacturer());
  boolean modelMatches=ACCESSORY_MODEL.equals(accessory.getModel());
  boolean versionMatches=ACCESSORY_VERSION.equals(accessory.getVersion());
  return manufacturerMatches && modelMatches && versionMatches;
}

Fixed version (ground truth):
/** 
 * Checks if the specified connected USB accessory is what we expect.
 * @param accessory Accessory to check
 * @return true if the accessory is right
 */
public static boolean isAccessorySupported(UsbAccessory accessory){
  boolean manufacturerMatches=ACCESSORY_MANUFACTURER.equals(accessory.getManufacturer());
  boolean modelMatches=ACCESSORY_MODEL.equals(accessory.getModel());
  boolean versionMatches=ACCESSORY_VERSION.equals(accessory.getVersion());
  return manufacturerMatches && modelMatches && versionMatches;
}