nus-yam/ex-repair huggingface dataset:
Program: 8420
Project: 8420
Buggy source:
/** 
 * Returns usage selections of keys from the SectionView
 * @param keysView
 * @return
 */
private Vector<Integer> getKeysUsages(SectionView keysView) throws PGPMain.GeneralException {
  Vector<Integer> getKeysUsages=new Vector<Integer>();
  ViewGroup keyEditors=keysView.getEditors();
  if (keyEditors.getChildCount() == 0) {
    throw new PGPMain.GeneralException(getString(R.string.error_keyNeedsMasterKey));
  }
  for (int i=0; i < keyEditors.getChildCount(); ++i) {
    KeyEditor editor=(KeyEditor)keyEditors.getChildAt(i);
    getKeysUsages.add(editor.getUsage());
  }
  return getKeysUsages;
}

Fixed version (ground truth):
/** 
 * Returns usage selections of keys from the SectionView
 * @param keysView
 * @return
 */
private ArrayList<Integer> getKeysUsages(SectionView keysView) throws PGPMain.GeneralException {
  ArrayList<Integer> getKeysUsages=new ArrayList<Integer>();
  ViewGroup keyEditors=keysView.getEditors();
  if (keyEditors.getChildCount() == 0) {
    throw new PGPMain.GeneralException(getString(R.string.error_keyNeedsMasterKey));
  }
  for (int i=0; i < keyEditors.getChildCount(); ++i) {
    KeyEditor editor=(KeyEditor)keyEditors.getChildAt(i);
    getKeysUsages.add(editor.getUsage());
  }
  return getKeysUsages;
}
Program: 8421
Project: 8421
Buggy source:
/** 
 * Returns keys from the SectionView
 * @param keysView
 * @return
 */
private Vector<PGPSecretKey> getKeys(SectionView keysView) throws PGPMain.GeneralException {
  Vector<PGPSecretKey> keys=new Vector<PGPSecretKey>();
  ViewGroup keyEditors=keysView.getEditors();
  if (keyEditors.getChildCount() == 0) {
    throw new PGPMain.GeneralException(getString(R.string.error_keyNeedsMasterKey));
  }
  for (int i=0; i < keyEditors.getChildCount(); ++i) {
    KeyEditor editor=(KeyEditor)keyEditors.getChildAt(i);
    keys.add(editor.getValue());
  }
  return keys;
}

Fixed version (ground truth):
/** 
 * Returns keys from the SectionView
 * @param keysView
 * @return
 */
private ArrayList<PGPSecretKey> getKeys(SectionView keysView) throws PGPMain.GeneralException {
  ArrayList<PGPSecretKey> keys=new ArrayList<PGPSecretKey>();
  ViewGroup keyEditors=keysView.getEditors();
  if (keyEditors.getChildCount() == 0) {
    throw new PGPMain.GeneralException(getString(R.string.error_keyNeedsMasterKey));
  }
  for (int i=0; i < keyEditors.getChildCount(); ++i) {
    KeyEditor editor=(KeyEditor)keyEditors.getChildAt(i);
    keys.add(editor.getValue());
  }
  return keys;
}
Program: 8422
Project: 8422
Buggy source:
/** 
 * Returns user ids from the SectionView
 * @param userIdsView
 * @return
 */
private Vector<String> getUserIds(SectionView userIdsView) throws PGPMain.GeneralException {
  Vector<String> userIds=new Vector<String>();
  ViewGroup userIdEditors=userIdsView.getEditors();
  boolean gotMainUserId=false;
  for (int i=0; i < userIdEditors.getChildCount(); ++i) {
    UserIdEditor editor=(UserIdEditor)userIdEditors.getChildAt(i);
    String userId=null;
    try {
      userId=editor.getValue();
    }
 catch (    UserIdEditor.NoNameException e) {
      throw new PGPMain.GeneralException(this.getString(R.string.error_userIdNeedsAName));
    }
catch (    UserIdEditor.NoEmailException e) {
      throw new PGPMain.GeneralException(this.getString(R.string.error_userIdNeedsAnEmailAddress));
    }
catch (    UserIdEditor.InvalidEmailException e) {
      throw new PGPMain.GeneralException(e.getMessage());
    }
    if (userId.equals("String_Node_Str")) {
      continue;
    }
    if (editor.isMainUserId()) {
      userIds.insertElementAt(userId,0);
      gotMainUserId=true;
    }
 else {
      userIds.add(userId);
    }
  }
  if (userIds.size() == 0) {
    throw new PGPMain.GeneralException(getString(R.string.error_keyNeedsAUserId));
  }
  if (!gotMainUserId) {
    throw new PGPMain.GeneralException(getString(R.string.error_mainUserIdMustNotBeEmpty));
  }
  return userIds;
}

Fixed version (ground truth):
/** 
 * Returns user ids from the SectionView
 * @param userIdsView
 * @return
 */
private ArrayList<String> getUserIds(SectionView userIdsView) throws PGPMain.GeneralException {
  ArrayList<String> userIds=new ArrayList<String>();
  ViewGroup userIdEditors=userIdsView.getEditors();
  boolean gotMainUserId=false;
  for (int i=0; i < userIdEditors.getChildCount(); ++i) {
    UserIdEditor editor=(UserIdEditor)userIdEditors.getChildAt(i);
    String userId=null;
    try {
      userId=editor.getValue();
    }
 catch (    UserIdEditor.NoNameException e) {
      throw new PGPMain.GeneralException(this.getString(R.string.error_userIdNeedsAName));
    }
catch (    UserIdEditor.NoEmailException e) {
      throw new PGPMain.GeneralException(this.getString(R.string.error_userIdNeedsAnEmailAddress));
    }
catch (    UserIdEditor.InvalidEmailException e) {
      throw new PGPMain.GeneralException(e.getMessage());
    }
    if (userId.equals("String_Node_Str")) {
      continue;
    }
    if (editor.isMainUserId()) {
      userIds.add(0,userId);
      gotMainUserId=true;
    }
 else {
      userIds.add(userId);
    }
  }
  if (userIds.size() == 0) {
    throw new PGPMain.GeneralException(getString(R.string.error_keyNeedsAUserId));
  }
  if (!gotMainUserId) {
    throw new PGPMain.GeneralException(getString(R.string.error_mainUserIdMustNotBeEmpty));
  }
  return userIds;
}
Program: 8423
Project: 8423
Buggy source:
private void saveClicked(){
  try {
    if (!isPassphraseSet()) {
      throw new PGPMain.GeneralException(this.getString(R.string.setAPassPhrase));
    }
    Intent intent=new Intent(this,ApgService.class);
    intent.putExtra(ApgService.EXTRA_ACTION,ApgService.ACTION_SAVE_KEYRING);
    Bundle data=new Bundle();
    data.putString(ApgService.CURRENT_PASSPHRASE,mCurrentPassPhrase);
    data.putString(ApgService.NEW_PASSPHRASE,mNewPassPhrase);
    data.putSerializable(ApgService.USER_IDS,getUserIds(mUserIdsView));
    Vector<PGPSecretKey> keys=getKeys(mKeysView);
    data.putByteArray(ApgService.KEYS,PGPConversionHelper.PGPSecretKeyListToBytes(keys));
    data.putSerializable(ApgService.KEYS_USAGES,getKeysUsages(mKeysView));
    data.putLong(ApgService.MASTER_KEY_ID,getMasterKeyId());
    intent.putExtra(ApgService.EXTRA_DATA,data);
    ApgServiceHandler saveHandler=new ApgServiceHandler(this,R.string.progress_saving,ProgressDialog.STYLE_HORIZONTAL){
      public void handleMessage(      Message message){
        super.handleMessage(message);
        if (message.arg1 == ApgServiceHandler.MESSAGE_OKAY) {
          finish();
        }
      }
    }
;
    Messenger messenger=new Messenger(saveHandler);
    intent.putExtra(ApgService.EXTRA_MESSENGER,messenger);
    saveHandler.showProgressDialog(this);
    startService(intent);
  }
 catch (  PGPMain.GeneralException e) {
    Toast.makeText(this,getString(R.string.errorMessage,e.getMessage()),Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
private void saveClicked(){
  try {
    if (!isPassphraseSet()) {
      throw new PGPMain.GeneralException(this.getString(R.string.setAPassPhrase));
    }
    Intent intent=new Intent(this,ApgService.class);
    intent.putExtra(ApgService.EXTRA_ACTION,ApgService.ACTION_SAVE_KEYRING);
    Bundle data=new Bundle();
    data.putString(ApgService.CURRENT_PASSPHRASE,mCurrentPassPhrase);
    data.putString(ApgService.NEW_PASSPHRASE,mNewPassPhrase);
    data.putStringArrayList(ApgService.USER_IDS,getUserIds(mUserIdsView));
    ArrayList<PGPSecretKey> keys=getKeys(mKeysView);
    data.putByteArray(ApgService.KEYS,PGPConversionHelper.PGPSecretKeyListToBytes(keys));
    data.putIntegerArrayList(ApgService.KEYS_USAGES,getKeysUsages(mKeysView));
    data.putLong(ApgService.MASTER_KEY_ID,getMasterKeyId());
    intent.putExtra(ApgService.EXTRA_DATA,data);
    ApgServiceHandler saveHandler=new ApgServiceHandler(this,R.string.progress_saving,ProgressDialog.STYLE_HORIZONTAL){
      public void handleMessage(      Message message){
        super.handleMessage(message);
        if (message.arg1 == ApgServiceHandler.MESSAGE_OKAY) {
          finish();
        }
      }
    }
;
    Messenger messenger=new Messenger(saveHandler);
    intent.putExtra(ApgService.EXTRA_MESSENGER,messenger);
    saveHandler.showProgressDialog(this);
    startService(intent);
  }
 catch (  PGPMain.GeneralException e) {
    Toast.makeText(this,getString(R.string.errorMessage,e.getMessage()),Toast.LENGTH_SHORT).show();
  }
}
Program: 8427
Project: 8427
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case Id.menu.option.key_server:
{
      startActivity(new Intent(this,KeyServerQueryActivity.class));
      return true;
    }
case Id.menu.option.scanQRCode:
{
    Intent intent=new Intent(this,ImportFromQRCodeActivity.class);
    intent.setAction(ImportFromQRCodeActivity.IMPORT_FROM_QR_CODE);
    startActivityForResult(intent,Id.request.import_from_qr_code);
    return true;
  }
default :
{
  return super.onOptionsItemSelected(item);
}
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case Id.menu.option.key_server:
{
      startActivityForResult(new Intent(this,KeyServerQueryActivity.class),0);
      return true;
    }
case Id.menu.option.scanQRCode:
{
    Intent intent=new Intent(this,ImportFromQRCodeActivity.class);
    intent.setAction(ImportFromQRCodeActivity.IMPORT_FROM_QR_CODE);
    startActivityForResult(intent,Id.request.import_from_qr_code);
    return true;
  }
default :
{
  return super.onOptionsItemSelected(item);
}
}
}
Program: 8428
Project: 8428
Buggy source:
private void editKey(long keyId){
  Intent intent=new Intent(EditKeyActivity.ACTION_EDIT_KEY);
  intent.putExtra(EditKeyActivity.EXTRA_KEY_ID,keyId);
  startActivityForResult(intent,Id.message.edit_key);
}

Fixed version (ground truth):
private void editKey(long keyId){
  Intent intent=new Intent(EditKeyActivity.ACTION_EDIT_KEY);
  intent.putExtra(EditKeyActivity.EXTRA_KEY_ID,keyId);
  startActivityForResult(intent,0);
}
Program: 8429
Project: 8429
Buggy source:
private void createKey(){
  PGPMain.setEditPassPhrase("String_Node_Str");
  Intent intent=new Intent(EditKeyActivity.ACTION_CREATE_KEY);
  startActivityForResult(intent,Id.message.create_key);
}

Fixed version (ground truth):
private void createKey(){
  PGPMain.setEditPassPhrase("String_Node_Str");
  Intent intent=new Intent(EditKeyActivity.ACTION_CREATE_KEY);
  startActivityForResult(intent,0);
}
Program: 8431
Project: 8431
Buggy source:
private long insertOrUpdateKey(ContentValues values){
  Cursor c=mDb.query(Keys.TABLE_NAME,new String[]{Keys._ID},Keys.KEY_ID + "String_Node_Str" + Keys.TYPE+ "String_Node_Str",new String[]{values.getAsString(Keys.KEY_ID),values.getAsString(Keys.TYPE)},null,null,null);
  long rowId=-1;
  if (c != null && c.moveToFirst()) {
    rowId=c.getLong(0);
    mDb.update(Keys.TABLE_NAME,values,Keys._ID + "String_Node_Str",new String[]{"String_Node_Str" + rowId});
  }
 else {
    rowId=mDb.insert(Keys.TABLE_NAME,Keys.KEY_DATA,values);
  }
  c.close();
  return rowId;
}

Fixed version (ground truth):
private long insertOrUpdateKey(ContentValues values){
  Cursor c=mDb.query(Keys.TABLE_NAME,new String[]{Keys._ID},Keys.KEY_ID + "String_Node_Str" + Keys.TYPE+ "String_Node_Str",new String[]{values.getAsString(Keys.KEY_ID),values.getAsString(Keys.TYPE)},null,null,null);
  long rowId=-1;
  if (c != null && c.moveToFirst()) {
    rowId=c.getLong(0);
    mDb.update(Keys.TABLE_NAME,values,Keys._ID + "String_Node_Str",new String[]{"String_Node_Str" + rowId});
  }
 else {
    rowId=mDb.insert(Keys.TABLE_NAME,Keys.KEY_DATA,values);
  }
  if (c != null) {
    c.close();
  }
  return rowId;
}
Program: 8435
Project: 8435
Buggy source:
public static Vector<Integer> getKeyRingIds(int type){
  SQLiteDatabase db=mDatabase.db();
  Vector<Integer> keyIds=new Vector<Integer>();
  Cursor c=db.query(KeyRings.TABLE_NAME,new String[]{KeyRings._ID},KeyRings.TYPE + "String_Node_Str",new String[]{"String_Node_Str" + type},null,null,null);
  if (c != null && c.moveToFirst()) {
    do {
      keyIds.add(c.getInt(0));
    }
 while (c.moveToNext());
  }
  c.close();
  return keyIds;
}

Fixed version (ground truth):
public static Vector<Integer> getKeyRingIds(int type){
  SQLiteDatabase db=mDatabase.db();
  Vector<Integer> keyIds=new Vector<Integer>();
  Cursor c=db.query(KeyRings.TABLE_NAME,new String[]{KeyRings._ID},KeyRings.TYPE + "String_Node_Str",new String[]{"String_Node_Str" + type},null,null,null);
  if (c != null && c.moveToFirst()) {
    do {
      keyIds.add(c.getInt(0));
    }
 while (c.moveToNext());
  }
  if (c != null) {
    c.close();
  }
  return keyIds;
}
Program: 8438
Project: 8438
Buggy source:
private long insertOrUpdateKeyRing(ContentValues values){
  Cursor c=mDb.query(KeyRings.TABLE_NAME,new String[]{KeyRings._ID},KeyRings.MASTER_KEY_ID + "String_Node_Str" + KeyRings.TYPE+ "String_Node_Str",new String[]{values.getAsString(KeyRings.MASTER_KEY_ID),values.getAsString(KeyRings.TYPE)},null,null,null);
  long rowId=-1;
  if (c != null && c.moveToFirst()) {
    rowId=c.getLong(0);
    mDb.update(KeyRings.TABLE_NAME,values,KeyRings._ID + "String_Node_Str",new String[]{"String_Node_Str" + rowId});
    mStatus=Id.return_value.updated;
  }
 else {
    rowId=mDb.insert(KeyRings.TABLE_NAME,KeyRings.WHO_ID,values);
    mStatus=Id.return_value.ok;
  }
  c.close();
  return rowId;
}

Fixed version (ground truth):
private long insertOrUpdateKeyRing(ContentValues values){
  Cursor c=mDb.query(KeyRings.TABLE_NAME,new String[]{KeyRings._ID},KeyRings.MASTER_KEY_ID + "String_Node_Str" + KeyRings.TYPE+ "String_Node_Str",new String[]{values.getAsString(KeyRings.MASTER_KEY_ID),values.getAsString(KeyRings.TYPE)},null,null,null);
  long rowId=-1;
  if (c != null && c.moveToFirst()) {
    rowId=c.getLong(0);
    mDb.update(KeyRings.TABLE_NAME,values,KeyRings._ID + "String_Node_Str",new String[]{"String_Node_Str" + rowId});
    mStatus=Id.return_value.updated;
  }
 else {
    rowId=mDb.insert(KeyRings.TABLE_NAME,KeyRings.WHO_ID,values);
    mStatus=Id.return_value.ok;
  }
  if (c != null) {
    c.close();
  }
  return rowId;
}
Program: 8439
Project: 8439
Buggy source:
public Object getKeyRing(int keyRingId){
  Cursor c=mDb.query(KeyRings.TABLE_NAME,new String[]{KeyRings.KEY_RING_DATA,KeyRings.TYPE},KeyRings._ID + "String_Node_Str",new String[]{"String_Node_Str" + keyRingId},null,null,null);
  byte[] data=null;
  Object keyRing=null;
  if (c != null && c.moveToFirst()) {
    data=c.getBlob(0);
    if (data != null) {
      try {
        if (c.getInt(1) == Id.database.type_public) {
          keyRing=new PGPPublicKeyRing(data);
        }
 else {
          keyRing=new PGPSecretKeyRing(data);
        }
      }
 catch (      IOException e) {
      }
catch (      PGPException e) {
      }
    }
  }
  c.close();
  return keyRing;
}

Fixed version (ground truth):
public Object getKeyRing(int keyRingId){
  Cursor c=mDb.query(KeyRings.TABLE_NAME,new String[]{KeyRings.KEY_RING_DATA,KeyRings.TYPE},KeyRings._ID + "String_Node_Str",new String[]{"String_Node_Str" + keyRingId},null,null,null);
  byte[] data=null;
  Object keyRing=null;
  if (c != null && c.moveToFirst()) {
    data=c.getBlob(0);
    if (data != null) {
      try {
        if (c.getInt(1) == Id.database.type_public) {
          keyRing=new PGPPublicKeyRing(data);
        }
 else {
          keyRing=new PGPSecretKeyRing(data);
        }
      }
 catch (      IOException e) {
      }
catch (      PGPException e) {
      }
    }
  }
  if (c != null) {
    c.close();
  }
  return keyRing;
}
Program: 8440
Project: 8440
Buggy source:
public void deleteKeyRing(int keyRingId){
  mDb.beginTransaction();
  mDb.delete(KeyRings.TABLE_NAME,KeyRings._ID + "String_Node_Str",new String[]{"String_Node_Str" + keyRingId});
  Cursor c=mDb.query(Keys.TABLE_NAME,new String[]{Keys._ID},Keys.KEY_RING_ID + "String_Node_Str",new String[]{"String_Node_Str" + keyRingId},null,null,null);
  if (c != null && c.moveToFirst()) {
    do {
      int keyId=c.getInt(0);
      deleteKey(keyId);
    }
 while (c.moveToNext());
  }
  c.close();
  mDb.setTransactionSuccessful();
  mDb.endTransaction();
}

Fixed version (ground truth):
public void deleteKeyRing(int keyRingId){
  mDb.beginTransaction();
  mDb.delete(KeyRings.TABLE_NAME,KeyRings._ID + "String_Node_Str",new String[]{"String_Node_Str" + keyRingId});
  Cursor c=mDb.query(Keys.TABLE_NAME,new String[]{Keys._ID},Keys.KEY_RING_ID + "String_Node_Str",new String[]{"String_Node_Str" + keyRingId},null,null,null);
  if (c != null && c.moveToFirst()) {
    do {
      int keyId=c.getInt(0);
      deleteKey(keyId);
    }
 while (c.moveToNext());
  }
  if (c != null) {
    c.close();
  }
  mDb.setTransactionSuccessful();
  mDb.endTransaction();
}
Program: 8441
Project: 8441
Buggy source:
private long insertOrUpdateUserId(ContentValues values){
  Cursor c=mDb.query(UserIds.TABLE_NAME,new String[]{UserIds._ID},UserIds.KEY_ID + "String_Node_Str" + UserIds.USER_ID+ "String_Node_Str",new String[]{values.getAsString(UserIds.KEY_ID),values.getAsString(UserIds.USER_ID)},null,null,null);
  long rowId=-1;
  if (c != null && c.moveToFirst()) {
    rowId=c.getLong(0);
    mDb.update(UserIds.TABLE_NAME,values,UserIds._ID + "String_Node_Str",new String[]{"String_Node_Str" + rowId});
  }
 else {
    rowId=mDb.insert(UserIds.TABLE_NAME,UserIds.USER_ID,values);
  }
  c.close();
  return rowId;
}

Fixed version (ground truth):
private long insertOrUpdateUserId(ContentValues values){
  Cursor c=mDb.query(UserIds.TABLE_NAME,new String[]{UserIds._ID},UserIds.KEY_ID + "String_Node_Str" + UserIds.USER_ID+ "String_Node_Str",new String[]{values.getAsString(UserIds.KEY_ID),values.getAsString(UserIds.USER_ID)},null,null,null);
  long rowId=-1;
  if (c != null && c.moveToFirst()) {
    rowId=c.getLong(0);
    mDb.update(UserIds.TABLE_NAME,values,UserIds._ID + "String_Node_Str",new String[]{"String_Node_Str" + rowId});
  }
 else {
    rowId=mDb.insert(UserIds.TABLE_NAME,UserIds.USER_ID,values);
  }
  if (c != null) {
    c.close();
  }
  return rowId;
}
Program: 8442
Project: 8442
Buggy source:
public byte[] getKeyDataFromKeyId(int type,long keyId){
  Cursor c=mDb.query(Keys.TABLE_NAME,new String[]{Keys.KEY_DATA},Keys.KEY_ID + "String_Node_Str" + Keys.TYPE+ "String_Node_Str",new String[]{"String_Node_Str" + keyId,"String_Node_Str" + type},null,null,null);
  byte[] data=null;
  if (c != null && c.moveToFirst()) {
    data=c.getBlob(0);
  }
  c.close();
  return data;
}

Fixed version (ground truth):
public byte[] getKeyDataFromKeyId(int type,long keyId){
  Cursor c=mDb.query(Keys.TABLE_NAME,new String[]{Keys.KEY_DATA},Keys.KEY_ID + "String_Node_Str" + Keys.TYPE+ "String_Node_Str",new String[]{"String_Node_Str" + keyId,"String_Node_Str" + type},null,null,null);
  byte[] data=null;
  if (c != null && c.moveToFirst()) {
    data=c.getBlob(0);
  }
  if (c != null) {
    c.close();
  }
  return data;
}
Program: 8443
Project: 8443
Buggy source:
public byte[] getKeyRingDataFromKeyId(int type,long keyId){
  Cursor c=mDb.query(Keys.TABLE_NAME + "String_Node_Str" + KeyRings.TABLE_NAME+ "String_Node_Str"+ KeyRings.TABLE_NAME+ "String_Node_Str"+ KeyRings._ID+ "String_Node_Str"+ Keys.TABLE_NAME+ "String_Node_Str"+ Keys.KEY_RING_ID+ "String_Node_Str",new String[]{KeyRings.TABLE_NAME + "String_Node_Str" + KeyRings.KEY_RING_DATA},Keys.TABLE_NAME + "String_Node_Str" + Keys.KEY_ID+ "String_Node_Str"+ KeyRings.TABLE_NAME+ "String_Node_Str"+ KeyRings.TYPE+ "String_Node_Str",new String[]{"String_Node_Str" + keyId,"String_Node_Str" + type},null,null,null);
  byte[] data=null;
  if (c != null && c.moveToFirst()) {
    data=c.getBlob(0);
  }
  c.close();
  return data;
}

Fixed version (ground truth):
public byte[] getKeyRingDataFromKeyId(int type,long keyId){
  Cursor c=mDb.query(Keys.TABLE_NAME + "String_Node_Str" + KeyRings.TABLE_NAME+ "String_Node_Str"+ KeyRings.TABLE_NAME+ "String_Node_Str"+ KeyRings._ID+ "String_Node_Str"+ Keys.TABLE_NAME+ "String_Node_Str"+ Keys.KEY_RING_ID+ "String_Node_Str",new String[]{KeyRings.TABLE_NAME + "String_Node_Str" + KeyRings.KEY_RING_DATA},Keys.TABLE_NAME + "String_Node_Str" + Keys.KEY_ID+ "String_Node_Str"+ KeyRings.TABLE_NAME+ "String_Node_Str"+ KeyRings.TYPE+ "String_Node_Str",new String[]{"String_Node_Str" + keyId,"String_Node_Str" + type},null,null,null);
  byte[] data=null;
  if (c != null && c.moveToFirst()) {
    data=c.getBlob(0);
  }
  if (c != null) {
    c.close();
  }
  return data;
}
Program: 8449
Project: 8449
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
switch (requestCode) {
case Id.request.public_keys:
{
      if (resultCode == RESULT_OK) {
        Bundle bundle=data.getExtras();
        mEncryptionKeyIds=bundle.getLongArray("String_Node_Str");
        updateView();
      }
      break;
    }
default :
{
    break;
  }
}
super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
switch (requestCode) {
case Id.request.secret_keys:
{
      if (resultCode == RESULT_OK) {
        super.onActivityResult(requestCode,resultCode,data);
        updateView();
      }
      break;
    }
case Id.request.public_keys:
{
    if (resultCode == RESULT_OK) {
      Bundle bundle=data.getExtras();
      mEncryptionKeyIds=bundle.getLongArray("String_Node_Str");
      updateView();
    }
    break;
  }
default :
{
  break;
}
}
super.onActivityResult(requestCode,resultCode,data);
}
Program: 8451
Project: 8451
Buggy source:
public ValidationErrors(String name,Object entity,PersistentEntity<?,?> persistentEntity){
  this.name=name;
  this.entity=entity;
  this.persistentEntity=persistentEntity;
}

Fixed version (ground truth):
/** 
 * Creates a new   {@link ValidationErrors} instance for the given source object and {@link PersistentEntity}.
 * @param source the source object to gather validation errors on, must not be {@literal null}.
 * @param entity the {@link PersistentEntity} for the given source instance, must not be {@literal null}.
 */
public ValidationErrors(Object source,PersistentEntity<?,?> entity){
  super(source.getClass().getSimpleName());
  Assert.notNull(source,"String_Node_Str");
  Assert.notNull(entity,"String_Node_Str");
  Assert.isTrue(entity.getType().isInstance(source),"String_Node_Str");
  this.entity=entity;
  this.accessor=entity.getPropertyAccessor(source);
}
Program: 8452
Project: 8452
Buggy source:
@Override public Object getFieldValue(String field){
  PersistentProperty<?> prop=persistentEntity != null ? persistentEntity.getPersistentProperty(field) : null;
  if (null == prop) {
    return null;
  }
  Method getter=prop.getGetter();
  if (null != getter) {
    return invokeMethod(getter,entity);
  }
  Field fld=prop.getField();
  if (null != fld) {
    return getField(fld,entity);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getFieldValue(String field){
  if (field.contains("String_Node_Str")) {
    return super.getFieldValue(field);
  }
  return accessor.getProperty(entity.getPersistentProperty(field));
}
Program: 8453
Project: 8453
Buggy source:
private Errors validate(String event,Object entity){
  if (entity == null) {
    return null;
  }
  Class<?> domainType=entity.getClass();
  PersistentEntities persistentEntities=persistentEntitiesFactory.getObject();
  Errors errors=new ValidationErrors(domainType.getSimpleName(),entity,persistentEntities.getPersistentEntity(domainType));
  for (  Validator v : getValidatorsForEvent(event)) {
    if (v.supports(domainType)) {
      LOGGER.debug("String_Node_Str",event,entity,v);
      ValidationUtils.invokeValidator(v,entity,errors);
    }
  }
  if (errors.hasErrors()) {
    throw new RepositoryConstraintViolationException(errors);
  }
  return errors;
}

Fixed version (ground truth):
private Errors validate(String event,Object entity){
  if (entity == null) {
    return null;
  }
  Class<?> domainType=entity.getClass();
  PersistentEntities persistentEntities=persistentEntitiesFactory.getObject();
  PersistentEntity<?,?> persistentEntity=persistentEntities.getPersistentEntity(domainType);
  Errors errors=persistentEntity == null ? new DirectFieldBindingResult(entity,domainType.getSimpleName()) : new ValidationErrors(entity,persistentEntity);
  for (  Validator v : getValidatorsForEvent(event)) {
    if (v.supports(domainType)) {
      LOGGER.debug("String_Node_Str",event,entity,v);
      ValidationUtils.invokeValidator(v,entity,errors);
    }
  }
  if (errors.hasErrors()) {
    throw new RepositoryConstraintViolationException(errors);
  }
  return errors;
}
Program: 8454
Project: 8454
Buggy source:
@Test(expected=RepositoryConstraintViolationException.class) public void shouldValidateLastName() throws Exception {
  context.publishEvent(new BeforeSaveEvent(new Person("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
@Test(expected=RepositoryConstraintViolationException.class) public void shouldValidateLastName() throws Exception {
  mappingContext.getPersistentEntity(Person.class);
  context.publishEvent(new BeforeSaveEvent(new Person("String_Node_Str","String_Node_Str")));
}
Program: 8455
Project: 8455
Buggy source:
public <T extends Throwable>ResponseEntity<ExceptionMessage> errorResponse(HttpHeaders headers,T throwable,HttpStatus status){
  LOG.error(throwable.getMessage(),throwable);
  return response(headers,new ExceptionMessage(throwable),status);
}

Fixed version (ground truth):
public <T extends Throwable>ResponseEntity<ExceptionMessage> errorResponse(HttpHeaders headers,T throwable,HttpStatus status){
  if (null != throwable && null != throwable.getMessage()) {
    LOG.error(throwable.getMessage(),throwable);
    return response(headers,new ExceptionMessage(throwable),status);
  }
 else {
    return response(headers,null,status);
  }
}
Program: 8459
Project: 8459
Buggy source:
@SuppressWarnings({"String_Node_Str"}) private Resource<?> doWithReferencedProperty(RepositoryRestRequest repoRequest,String id,String propertyPath,Function<ReferencedProperty,Resource<?>> handler) throws ResourceNotFoundException, NoSuchMethodException {
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (!repoMethodInvoker.hasFindOne()) {
    throw new NoSuchMethodException();
  }
  Object domainObj=domainClassConverter.convert(id,STRING_TYPE,TypeDescriptor.valueOf(repoRequest.getPersistentEntity().getType()));
  if (null == domainObj) {
    throw new ResourceNotFoundException();
  }
  String propertyName=repoRequest.getPersistentEntityResourceMapping().getNameForPath(propertyPath);
  PersistentProperty prop=repoRequest.getPersistentEntity().getPersistentProperty(propertyName);
  if (null == prop) {
    throw new ResourceNotFoundException();
  }
  BeanWrapper wrapper=BeanWrapper.create(domainObj,conversionService);
  Object propVal=wrapper.getProperty(prop);
  if (null == propVal) {
    throw new ResourceNotFoundException();
  }
  return handler.apply(new ReferencedProperty(prop,propVal,wrapper));
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) private Resource<?> doWithReferencedProperty(RepositoryRestRequest repoRequest,String id,String propertyPath,Function<ReferencedProperty,Resource<?>> handler) throws ResourceNotFoundException, NoSuchMethodException {
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (!repoMethodInvoker.hasFindOne()) {
    throw new NoSuchMethodException();
  }
  Object domainObj=domainClassConverter.convert(id,STRING_TYPE,TypeDescriptor.valueOf(repoRequest.getPersistentEntity().getType()));
  if (null == domainObj) {
    throw new ResourceNotFoundException();
  }
  String propertyName=repoRequest.getPersistentEntityResourceMapping().getNameForPath(propertyPath);
  PersistentProperty prop=repoRequest.getPersistentEntity().getPersistentProperty(propertyName);
  if (null == prop) {
    throw new ResourceNotFoundException();
  }
  BeanWrapper wrapper=BeanWrapper.create(domainObj,conversionService);
  Object propVal=wrapper.getProperty(prop);
  return handler.apply(new ReferencedProperty(prop,propVal,wrapper));
}
Program: 8465
Project: 8465
Buggy source:
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(method=RequestMethod.GET,produces={"String_Node_Str","String_Node_Str"}) @ResponseBody public Resources<Resource<?>> listEntitiesCompact(RepositoryRestRequest repoRequest) throws ResourceNotFoundException {
  Resources<Resource<?>> resources=listEntities(repoRequest);
  List<Link> links=new ArrayList<Link>(resources.getLinks());
  for (  Resource<?> resource : resources.getContent()) {
    PersistentEntityResource<?> persistentEntityResource=(PersistentEntityResource<?>)resource;
    links.add(resourceLink(repoRequest,persistentEntityResource));
  }
  return new Resources<Resource<?>>(EMPTY_RESOURCE_LIST,links);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(method=RequestMethod.GET,produces={"String_Node_Str","String_Node_Str"}) @ResponseBody public Resources<Resource<?>> listEntitiesCompact(RepositoryRestRequest repoRequest) throws ResourceNotFoundException {
  Resources<Resource<?>> resources=listEntities(repoRequest);
  List<Link> links=new ArrayList<Link>(resources.getLinks());
  for (  Resource<?> resource : resources.getContent()) {
    PersistentEntityResource<?> persistentEntityResource=(PersistentEntityResource<?>)resource;
    links.add(resourceLink(repoRequest,persistentEntityResource));
  }
  boolean hasPagingParams=(null != repoRequest.getRequest().getParameter(config.getPageParamName()));
  boolean hasSortParams=(null != repoRequest.getRequest().getParameter(config.getSortParamName()));
  if (hasPagingParams || hasSortParams) {
    return new PageableResources<Resource<?>>(EMPTY_RESOURCE_LIST,repoRequest.getPagingAndSorting(),links);
  }
 else {
    return new Resources<Resource<?>>(EMPTY_RESOURCE_LIST,links);
  }
}
Program: 8466
Project: 8466
Buggy source:
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(method=RequestMethod.POST,consumes={"String_Node_Str"},produces={"String_Node_Str","String_Node_Str"}) @ResponseBody public ResponseEntity<Resource<?>> createNewEntity(RepositoryRestRequest repoRequest,PersistentEntityResource<?> incoming){
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (null == repoMethodInvoker || !repoMethodInvoker.hasSaveOne()) {
    throw new NoSuchMethodError();
  }
  applicationContext.publishEvent(new BeforeCreateEvent(incoming.getContent()));
  Object obj=repoMethodInvoker.save(incoming.getContent());
  applicationContext.publishEvent(new AfterCreateEvent(obj));
  BeanWrapper wrapper=BeanWrapper.create(obj,conversionService);
  Link selfLink=entityLinks.linkForSingleResource(repoRequest.getPersistentEntity().getType(),wrapper.getProperty(repoRequest.getPersistentEntity().getIdProperty())).withSelfRel();
  HttpHeaders headers=new HttpHeaders();
  headers.setLocation(URI.create(selfLink.getHref()));
  if (config.isReturnBodyOnCreate()) {
    return resourceResponse(headers,new PersistentEntityResource<Object>(repoRequest.getPersistentEntity(),obj,selfLink).setBaseUri(repoRequest.getBaseUri()),HttpStatus.CREATED);
  }
 else {
    return resourceResponse(headers,null,HttpStatus.CREATED);
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(method=RequestMethod.POST,consumes={"String_Node_Str"},produces={"String_Node_Str","String_Node_Str"}) @ResponseBody @Transactional public ResponseEntity<Resource<?>> createNewEntity(RepositoryRestRequest repoRequest,PersistentEntityResource<?> incoming){
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (null == repoMethodInvoker || !repoMethodInvoker.hasSaveOne()) {
    throw new NoSuchMethodError();
  }
  applicationContext.publishEvent(new BeforeCreateEvent(incoming.getContent()));
  Object obj=repoMethodInvoker.save(incoming.getContent());
  applicationContext.publishEvent(new AfterCreateEvent(obj));
  BeanWrapper wrapper=BeanWrapper.create(obj,conversionService);
  Link selfLink=entityLinks.linkForSingleResource(repoRequest.getPersistentEntity().getType(),wrapper.getProperty(repoRequest.getPersistentEntity().getIdProperty())).withSelfRel();
  HttpHeaders headers=new HttpHeaders();
  headers.setLocation(URI.create(selfLink.getHref()));
  if (config.isReturnBodyOnCreate()) {
    return resourceResponse(headers,new PersistentEntityResource<Object>(repoRequest.getPersistentEntity(),obj,selfLink).setBaseUri(repoRequest.getBaseUri()),HttpStatus.CREATED);
  }
 else {
    return resourceResponse(headers,null,HttpStatus.CREATED);
  }
}
Program: 8467
Project: 8467
Buggy source:
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE) @ResponseBody public ResponseEntity<?> deleteEntity(RepositoryRestRequest repoRequest,@PathVariable String id) throws ResourceNotFoundException {
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (null == repoMethodInvoker || (!repoMethodInvoker.hasFindOne() && !(repoMethodInvoker.hasDeleteOne() || repoMethodInvoker.hasDeleteOneById()))) {
    throw new NoSuchMethodError();
  }
  Object domainObj=domainClassConverter.convert(id,STRING_TYPE,TypeDescriptor.valueOf(repoRequest.getPersistentEntity().getType()));
  if (null == domainObj) {
    throw new ResourceNotFoundException();
  }
  applicationContext.publishEvent(new BeforeDeleteEvent(domainObj));
  if (repoMethodInvoker.hasDeleteOneById()) {
    Class<? extends Serializable> idType=(Class<? extends Serializable>)repoRequest.getPersistentEntity().getIdProperty().getType();
    Object idVal=conversionService.convert(id,idType);
    repoMethodInvoker.delete((Serializable)idVal);
  }
 else   if (repoMethodInvoker.hasDeleteOne()) {
    repoMethodInvoker.delete(domainObj);
  }
  applicationContext.publishEvent(new AfterDeleteEvent(domainObj));
  return new ResponseEntity<Object>(HttpStatus.NO_CONTENT);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE) @ResponseBody @Transactional public ResponseEntity<?> deleteEntity(RepositoryRestRequest repoRequest,@PathVariable String id) throws ResourceNotFoundException {
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (null == repoMethodInvoker || (!repoMethodInvoker.hasFindOne() && !(repoMethodInvoker.hasDeleteOne() || repoMethodInvoker.hasDeleteOneById()))) {
    throw new NoSuchMethodError();
  }
  Object domainObj=domainClassConverter.convert(id,STRING_TYPE,TypeDescriptor.valueOf(repoRequest.getPersistentEntity().getType()));
  if (null == domainObj) {
    throw new ResourceNotFoundException();
  }
  applicationContext.publishEvent(new BeforeDeleteEvent(domainObj));
  if (repoMethodInvoker.hasDeleteOneById()) {
    Class<? extends Serializable> idType=(Class<? extends Serializable>)repoRequest.getPersistentEntity().getIdProperty().getType();
    Object idVal=conversionService.convert(id,idType);
    repoMethodInvoker.delete((Serializable)idVal);
  }
 else   if (repoMethodInvoker.hasDeleteOne()) {
    repoMethodInvoker.delete(domainObj);
  }
  applicationContext.publishEvent(new AfterDeleteEvent(domainObj));
  return new ResponseEntity<Object>(HttpStatus.NO_CONTENT);
}
Program: 8472
Project: 8472
Buggy source:
@SuppressWarnings({"String_Node_Str"}) private ResourceDeserializer(PersistentEntity persistentEntity){
  super(persistentEntity.getType());
  this.persistentEntity=persistentEntity;
  this.defaultObject=instantiateClass(getValueClass());
  final BeanWrapper wrapper=BeanWrapper.create(defaultObject,conversionService);
  persistentEntity.doWithProperties(new PropertyHandler(){
    @Override public void doWithPersistentProperty(    PersistentProperty prop){
      Object defaultValue=wrapper.getProperty(prop);
      if (null != defaultValue) {
        defaultValues.put(prop.getName(),defaultValue);
      }
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) private ResourceDeserializer(final PersistentEntity persistentEntity){
  super(persistentEntity.getType());
  this.persistentEntity=persistentEntity;
}
Program: 8474
Project: 8474
Buggy source:
@SuppressWarnings({"String_Node_Str"}) public void merge(Object from,Object target){
  if (null == from || null == target) {
    return;
  }
  final BeanWrapper fromWrapper=BeanWrapper.create(from,conversionService);
  final BeanWrapper targetWrapper=BeanWrapper.create(target,conversionService);
  PersistentEntity entity=getPerisistentEntity(target.getClass());
  Class<?> clazz=entity.getType();
  final String clazzName=clazz.getSimpleName();
  entity.doWithProperties(new PropertyHandler(){
    @Override public void doWithPersistentProperty(    PersistentProperty persistentProperty){
      String mapKey=clazzName + "String_Node_Str" + persistentProperty.getName();
      Object fromVal=fromWrapper.getProperty(persistentProperty);
      Object defaultVal=defaultValues.get(mapKey);
      if (null != fromVal && !fromVal.equals(defaultVal)) {
        targetWrapper.setProperty(persistentProperty,fromVal);
      }
    }
  }
);
  entity.doWithAssociations(new AssociationHandler(){
    @Override public void doWithAssociation(    Association association){
      PersistentProperty persistentProperty=association.getInverse();
      String mapKey=clazzName + "String_Node_Str" + persistentProperty.getName();
      Object fromVal=fromWrapper.getProperty(persistentProperty);
      Object defaultVal=defaultValues.get(mapKey);
      if (null != fromVal && !fromVal.equals(defaultVal)) {
        targetWrapper.setProperty(persistentProperty,fromVal);
      }
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) public void merge(Object from,Object target){
  if (null == from || null == target) {
    return;
  }
  final BeanWrapper fromWrapper=BeanWrapper.create(from,conversionService);
  final BeanWrapper targetWrapper=BeanWrapper.create(target,conversionService);
  PersistentEntity entity=repositories.getPersistentEntity(target.getClass());
  entity.doWithProperties(new PropertyHandler(){
    @Override public void doWithPersistentProperty(    PersistentProperty persistentProperty){
      Object fromVal=fromWrapper.getProperty(persistentProperty);
      if (null != fromVal && !fromVal.equals(targetWrapper.getProperty(persistentProperty))) {
        targetWrapper.setProperty(persistentProperty,fromVal);
      }
    }
  }
);
  entity.doWithAssociations(new AssociationHandler(){
    @Override public void doWithAssociation(    Association association){
      PersistentProperty persistentProperty=association.getInverse();
      Object fromVal=fromWrapper.getProperty(persistentProperty);
      if (null != fromVal && !fromVal.equals(targetWrapper.getProperty(persistentProperty))) {
        targetWrapper.setProperty(persistentProperty,fromVal);
      }
    }
  }
);
}
Program: 8475
Project: 8475
Buggy source:
@Override public void doWithPersistentProperty(PersistentProperty persistentProperty){
  Object val=wrapper.getProperty(persistentProperty);
  if (null != val) {
    defaultValues.put(clazzName + "String_Node_Str" + persistentProperty.getName(),val);
  }
}

Fixed version (ground truth):
@Override public void doWithPersistentProperty(PersistentProperty persistentProperty){
  Object fromVal=fromWrapper.getProperty(persistentProperty);
  if (null != fromVal && !fromVal.equals(targetWrapper.getProperty(persistentProperty))) {
    targetWrapper.setProperty(persistentProperty,fromVal);
  }
}
Program: 8476
Project: 8476
Buggy source:
@Override public void doWithAssociation(Association association){
  PersistentProperty persistentProperty=association.getInverse();
  Object val=wrapper.getProperty(persistentProperty);
  if (null != val) {
    defaultValues.put(clazzName + "String_Node_Str" + persistentProperty.getName(),val);
  }
}

Fixed version (ground truth):
@Override public void doWithAssociation(Association association){
  PersistentProperty persistentProperty=association.getInverse();
  Object fromVal=fromWrapper.getProperty(persistentProperty);
  if (null != fromVal && !fromVal.equals(targetWrapper.getProperty(persistentProperty))) {
    targetWrapper.setProperty(persistentProperty,fromVal);
  }
}
Program: 8477
Project: 8477
Buggy source:
@Override protected boolean supportsInternal(HandlerMethod handlerMethod){
  Class<?> controllerType=handlerMethod.getBeanType();
  return super.supportsInternal(handlerMethod) && (RepositoryController.class.isAssignableFrom(controllerType) || RepositoryEntityController.class.isAssignableFrom(controllerType) || RepositoryPropertyReferenceController.class.isAssignableFrom(controllerType)|| RepositorySearchController.class.isAssignableFrom(controllerType));
}

Fixed version (ground truth):
@Override protected boolean supportsInternal(HandlerMethod handlerMethod){
  Class<?> controllerType=handlerMethod.getBeanType();
  return (RepositoryController.class.isAssignableFrom(controllerType) || RepositoryEntityController.class.isAssignableFrom(controllerType) || RepositoryPropertyReferenceController.class.isAssignableFrom(controllerType)|| RepositorySearchController.class.isAssignableFrom(controllerType));
}
Program: 8479
Project: 8479
Buggy source:
@SuppressWarnings({"String_Node_Str"}) @Override public Resource convert(Object source){
  if (null == repositoryMetadata || null == source) {
    return new Resource<Object>(source);
  }
  Serializable id=(Serializable)repositoryMetadata.entityMetadata().idAttribute().get(source);
  URI selfUri=buildUri(config.getBaseUri(),repositoryMetadata.name(),id.toString());
  Set<Link> links=new HashSet<Link>();
  for (  Object attrName : entityMetadata.linkedAttributes().keySet()) {
    URI uri=buildUri(selfUri,attrName.toString());
    String rel=repositoryMetadata.rel() + "String_Node_Str" + source.getClass().getSimpleName()+ "String_Node_Str"+ attrName;
    links.add(new Link(uri.toString(),rel));
  }
  links.add(new Link(selfUri.toString(),"String_Node_Str"));
  Map<String,Object> entityDto=new HashMap<String,Object>();
  for (  Map.Entry<String,AttributeMetadata> attrMeta : ((Map<String,AttributeMetadata>)entityMetadata.embeddedAttributes()).entrySet()) {
    String name=attrMeta.getKey();
    Object val;
    if (null != (val=attrMeta.getValue().get(source))) {
      entityDto.put(name,val);
    }
  }
  return new EntityResource(entityDto,links);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) @Override public Resource convert(Object source){
  if (null == repositoryMetadata || null == source) {
    return new Resource<Object>(source);
  }
  Serializable id=(Serializable)repositoryMetadata.entityMetadata().idAttribute().get(source);
  URI selfUri=buildUri(config.getBaseUri(),repositoryMetadata.name(),String.format("String_Node_Str",id));
  Set<Link> links=new HashSet<Link>();
  for (  Object attrName : entityMetadata.linkedAttributes().keySet()) {
    URI uri=buildUri(selfUri,attrName.toString());
    String rel=repositoryMetadata.rel() + "String_Node_Str" + source.getClass().getSimpleName()+ "String_Node_Str"+ attrName;
    links.add(new Link(uri.toString(),rel));
  }
  links.add(new Link(selfUri.toString(),"String_Node_Str"));
  Map<String,Object> entityDto=new HashMap<String,Object>();
  for (  Map.Entry<String,AttributeMetadata> attrMeta : ((Map<String,AttributeMetadata>)entityMetadata.embeddedAttributes()).entrySet()) {
    String name=attrMeta.getKey();
    Object val;
    if (null != (val=attrMeta.getValue().get(source))) {
      entityDto.put(name,val);
    }
  }
  return new EntityResource(entityDto,links);
}
Program: 8480
Project: 8480
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public ResponseEntity<?> schemaForRepository(ServletServerHttpRequest request,URI baseUri,@PathVariable String repository) throws IOException {
  RepositoryMetadata repoMeta=repositoryMetadataFor(repository);
  if (null == repoMeta) {
    throw new IllegalArgumentException("String_Node_Str" + repository + "String_Node_Str");
  }
  JsonSchema schema=mapper.generateJsonSchema(repoMeta.domainType());
  URI requestUri=UriComponentsBuilder.fromUri(baseUri).path(repository).build().toUri();
  Resource<JsonSchema> resource=new Resource<JsonSchema>(schema,new Link(request.getURI().toString(),"String_Node_Str"),new Link(requestUri.toString(),repoMeta.rel()));
  String output=mapper.writeValueAsString(resource);
  return new ResponseEntity<String>(output,HttpStatus.OK);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public ResponseEntity<?> schemaForRepository(URI baseUri,@PathVariable String repository) throws IOException {
  RepositoryMetadata repoMeta=repositoryMetadataFor(repository);
  if (null == repoMeta) {
    return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
  }
  JsonSchema schema=mapper.generateJsonSchema(repoMeta.domainType());
  URI schemaUri=UriComponentsBuilder.fromUri(baseUri).pathSegment(repository,"String_Node_Str").build().toUri();
  URI requestUri=UriComponentsBuilder.fromUri(baseUri).pathSegment(repository).build().toUri();
  Resource<JsonSchema> resource=new Resource<JsonSchema>(schema,new Link(schemaUri.toString(),"String_Node_Str"),new Link(requestUri.toString(),repoMeta.rel()));
  String output=mapper.writeValueAsString(resource);
  return new ResponseEntity<String>(output,HttpStatus.OK);
}
Program: 8481
Project: 8481
Buggy source:
private Errors validate(String event,Object o){
  Errors errors=null;
  if (null != o) {
    Class<?> domainType=o.getClass();
    errors=new ValidationErrors(domainType.getSimpleName(),o,repositoryMetadataFor(domainType).entityMetadata());
    String eventName=null;
    if ("String_Node_Str".equals(event)) {
      eventName="String_Node_Str" + domainType.getSimpleName() + "String_Node_Str";
    }
 else     if ("String_Node_Str".equals(event)) {
      eventName="String_Node_Str" + domainType.getSimpleName() + "String_Node_Str";
    }
 else     if ("String_Node_Str".equals(event)) {
      eventName="String_Node_Str" + domainType.getSimpleName() + "String_Node_Str";
    }
 else     if ("String_Node_Str".equals(event)) {
      eventName="String_Node_Str" + domainType.getSimpleName() + "String_Node_Str";
    }
 else     if ("String_Node_Str".equals(event)) {
      eventName="String_Node_Str" + domainType.getSimpleName() + "String_Node_Str";
    }
 else     if ("String_Node_Str".equals(event)) {
      eventName="String_Node_Str" + domainType.getSimpleName() + "String_Node_Str";
    }
    if (null == eventName) {
      return errors;
    }
    Collection<Validator> validators=this.validators.get(eventName);
    if (null != validators) {
      for (      Validator v : validators) {
        if (v.supports(o.getClass())) {
          LOG.debug(event + "String_Node_Str" + o+ "String_Node_Str"+ v);
          ValidationUtils.invokeValidator(v,o,errors);
        }
      }
    }
    if (errors.getErrorCount() > 0) {
      throw new RepositoryConstraintViolationException(errors);
    }
  }
  return errors;
}

Fixed version (ground truth):
private Errors validate(String event,Object o){
  Errors errors=null;
  if (null != o) {
    Class<?> domainType=o.getClass();
    errors=new ValidationErrors(domainType.getSimpleName(),o,repositoryMetadataFor(domainType).entityMetadata());
    Collection<Validator> validators=this.validators.get(event);
    if (null != validators) {
      for (      Validator v : validators) {
        if (v.supports(o.getClass())) {
          LOG.debug(event + "String_Node_Str" + o+ "String_Node_Str"+ v);
          ValidationUtils.invokeValidator(v,o,errors);
        }
      }
    }
    if (errors.getErrorCount() > 0) {
      throw new RepositoryConstraintViolationException(errors);
    }
  }
  return errors;
}