nus-yam/ex-repair huggingface dataset:
Program: 187418
Project: 187418
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  Toast.makeText(this,"String_Node_Str",Toast.LENGTH_LONG).show();
  return Service.START_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  return Service.START_STICKY;
}
Program: 187419
Project: 187419
Buggy source:
protected void onDestroy(){
  MessageService.dba.close();
  MessageReceiver.myActivityStarted=false;
  super.onDestroy();
}

Fixed version (ground truth):
protected void onDestroy(){
  MessageService.dba.close();
  stopService(new Intent(this,MessageService.class));
  MessageReceiver.myActivityStarted=false;
  super.onDestroy();
}
Program: 187420
Project: 187420
Buggy source:
/** 
 * Used for updating the shared information, will not delete the default row
 * @param reference
 * @param bookPath
 * @param bookInversePath
 */
public void updateSharedInfo(int reference,String s1,String s2){
  if (s1 != null || s2 != null) {
    resetSharedInfo(reference);
    addSharedInfo(reference,s1,s2);
  }
}

Fixed version (ground truth):
/** 
 * Used for updating the shared information, will not delete the default row
 * @param reference
 * @param bookPath
 * @param bookInversePath
 */
public void updateSharedInfo(int reference,String s1,String s2){
  if ((s1 != null || s2 != null) && (!s1.equalsIgnoreCase(DEFAULT_S1) || !s2.equalsIgnoreCase(DEFAULT_S2))) {
    resetSharedInfo(reference);
    addSharedInfo(reference,s1,s2);
  }
}
Program: 187421
Project: 187421
Buggy source:
/** 
 * Used for updating the book paths, will not delete the default row
 * @param reference
 * @param bookPath
 * @param bookInversePath
 */
public void updateBookPaths(int reference,String bookPath,String bookInversePath){
  if (bookPath != null || bookInversePath != null) {
    resetBookPath(reference);
    addBookPath(reference,bookPath,bookInversePath);
  }
}

Fixed version (ground truth):
/** 
 * Used for updating the book paths, will not delete the default row
 * @param reference
 * @param bookPath
 * @param bookInversePath
 */
public void updateBookPaths(int reference,String bookPath,String bookInversePath){
  if ((bookPath != null || bookInversePath != null) && (!bookPath.equalsIgnoreCase(DEFAULT_BOOK_PATH) || !bookInversePath.equalsIgnoreCase(DEFAULT_BOOK_INVERSE_PATH))) {
    resetBookPath(reference);
    addBookPath(reference,bookPath,bookInversePath);
  }
}
Program: 187423
Project: 187423
Buggy source:
/** 
 * Used to retrieve the book paths
 * @param reference
 * @return : String[2] the book path, and the book inverse path 
 */
public String[] getSharedInfo(int reference){
  open();
  Cursor cur=db.query(SQLitehelper.SHARED_INFO_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_SHARED_INFO_1,KEY_SHARED_INFO_2},KEY_REFERENCE + "String_Node_Str" + reference,null,null,null,null);
  if (cur.moveToFirst()) {
    String sharedInfo[]=new String[]{cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_1)),cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_2))};
    close(cur);
    return sharedInfo;
  }
 else {
    cur.close();
    Cursor dCur=db.query(SQLitehelper.SHARED_INFO_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_SHARED_INFO_1,KEY_SHARED_INFO_2},KEY_REFERENCE + "String_Node_Str" + 0,null,null,null,null);
    if (dCur.moveToFirst()) {
      String sharedInfo[]=new String[]{cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_1)),cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_2))};
      close(dCur);
      return sharedInfo;
    }
    close(dCur);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Used to retrieve the book paths
 * @param reference
 * @return : String[2] the book path, and the book inverse path 
 */
public String[] getSharedInfo(int reference){
  boolean open=true;
  if (!db.isOpen()) {
    open=false;
    open();
  }
  Cursor cur=db.query(SQLitehelper.SHARED_INFO_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_SHARED_INFO_1,KEY_SHARED_INFO_2},KEY_REFERENCE + "String_Node_Str" + reference,null,null,null,null);
  if (cur.moveToFirst()) {
    String sharedInfo[]=new String[]{cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_1)),cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_2))};
    if (open) {
      cur.close();
    }
 else {
      close(cur);
    }
    return sharedInfo;
  }
 else {
    cur.close();
    Cursor dCur=db.query(SQLitehelper.SHARED_INFO_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_SHARED_INFO_1,KEY_SHARED_INFO_2},KEY_REFERENCE + "String_Node_Str" + 0,null,null,null,null);
    if (dCur.moveToFirst()) {
      String sharedInfo[]=new String[]{cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_1)),cur.getString(cur.getColumnIndex(KEY_SHARED_INFO_2))};
      if (open) {
        dCur.close();
      }
 else {
        close(dCur);
      }
      return sharedInfo;
    }
    if (open) {
      dCur.close();
    }
 else {
      close(dCur);
    }
  }
  return null;
}
Program: 187424
Project: 187424
Buggy source:
/** 
 * Used to retrieve the book paths
 * @param reference
 * @return : String[2] the book path, and the book inverse path 
 */
public String[] getBookPath(int reference){
  open();
  Cursor cur=db.query(SQLitehelper.BOOK_PATHS_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_BOOK_PATH,KEY_BOOK_INVERSE_PATH},KEY_REFERENCE + "String_Node_Str" + reference,null,null,null,null);
  if (cur.moveToFirst()) {
    String bookPaths[]=new String[]{cur.getString(cur.getColumnIndex(KEY_BOOK_PATH)),cur.getString(cur.getColumnIndex(KEY_BOOK_INVERSE_PATH))};
    close(cur);
    return bookPaths;
  }
 else {
    cur.close();
    Cursor dCur=db.query(SQLitehelper.BOOK_PATHS_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_BOOK_PATH,KEY_BOOK_INVERSE_PATH},KEY_REFERENCE + "String_Node_Str" + 0,null,null,null,null);
    if (dCur.moveToFirst()) {
      String bookPaths[]=new String[]{cur.getString(cur.getColumnIndex(KEY_BOOK_PATH)),cur.getString(cur.getColumnIndex(KEY_BOOK_INVERSE_PATH))};
      close(dCur);
      return bookPaths;
    }
    close(dCur);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Used to retrieve the book paths
 * @param reference
 * @return : String[2] the book path, and the book inverse path 
 */
public String[] getBookPath(int reference){
  boolean open=true;
  if (!db.isOpen()) {
    open=false;
    open();
  }
  Cursor cur=db.query(SQLitehelper.BOOK_PATHS_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_BOOK_PATH,KEY_BOOK_INVERSE_PATH},KEY_REFERENCE + "String_Node_Str" + reference,null,null,null,null);
  if (cur.moveToFirst()) {
    String bookPaths[]=new String[]{cur.getString(cur.getColumnIndex(KEY_BOOK_PATH)),cur.getString(cur.getColumnIndex(KEY_BOOK_INVERSE_PATH))};
    if (open) {
      cur.close();
    }
 else {
      close(cur);
    }
    return bookPaths;
  }
 else {
    cur.close();
    Cursor dCur=db.query(SQLitehelper.BOOK_PATHS_TABLE_NAME,new String[]{KEY_REFERENCE,KEY_BOOK_PATH,KEY_BOOK_INVERSE_PATH},KEY_REFERENCE + "String_Node_Str" + 0,null,null,null,null);
    if (dCur.moveToFirst()) {
      String bookPaths[]=new String[]{cur.getString(cur.getColumnIndex(KEY_BOOK_PATH)),cur.getString(cur.getColumnIndex(KEY_BOOK_INVERSE_PATH))};
      if (open) {
        dCur.close();
      }
 else {
        close(dCur);
      }
      return bookPaths;
    }
    if (open) {
      dCur.close();
    }
 else {
      close(dCur);
    }
  }
  return null;
}
Program: 187426
Project: 187426
Buggy source:
protected void onDestroy(){
  dba.close();
  super.onDestroy();
}

Fixed version (ground truth):
protected void onDestroy(){
  dba.close();
  unregisterReceiver(SMSbr);
  super.onDestroy();
}
Program: 187428
Project: 187428
Buggy source:
public void onClick(DialogInterface dialog,int whichButton){
}

Fixed version (ground truth):
public void onClick(DialogInterface dialog,int whichButton){
  dialog.cancel();
}
Program: 187429
Project: 187429
Buggy source:
public void onItemClick(AdapterView<?> parent,View view,final int position,long id){
  if (contactEdit != null) {
    final EditText input=new EditText(getBaseContext());
    input.setText(contactEdit.getNumber(position));
    input.setInputType(InputType.TYPE_CLASS_PHONE);
    AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
    builder.setMessage("String_Node_Str").setCancelable(true).setView(input).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        contactEdit.setNumber(position,input.getText().toString());
        update(null);
        input.setText("String_Node_Str");
      }
    }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
      }
    }
);
    AlertDialog alert=builder.create();
    alert.show();
  }
}

Fixed version (ground truth):
public void onItemClick(AdapterView<?> parent,View view,final int position,long id){
  if (contactEdit != null) {
    final EditText input=new EditText(getBaseContext());
    input.setText(contactEdit.getNumber(position));
    input.setInputType(InputType.TYPE_CLASS_PHONE);
    AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
    builder.setMessage("String_Node_Str").setCancelable(true).setView(input).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        contactEdit.setNumber(position,input.getText().toString());
        update(null);
        input.setText("String_Node_Str");
      }
    }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        dialog.cancel();
      }
    }
);
    AlertDialog alert=builder.create();
    alert.show();
  }
}
Program: 187430
Project: 187430
Buggy source:
private int getId(String number){
  open();
  Cursor cur=db.query(SQLitehelper.NUMBERS_TABLE_NAME,new String[]{KEY_REFERENCE},KEY_NUMBER + "String_Node_Str" + number,null,null,null,null);
  if (cur.moveToFirst()) {
    int id=cur.getInt(cur.getColumnIndex((KEY_REFERENCE)));
    close(cur);
    return id;
  }
  close(cur);
  return 0;
}

Fixed version (ground truth):
private int getId(String number){
  open();
  Cursor cur=db.rawQuery("String_Node_Str" + KEY_REFERENCE + "String_Node_Str"+ SQLitehelper.NUMBERS_TABLE_NAME+ "String_Node_Str"+ KEY_NUMBER+ "String_Node_Str",new String[]{number});
  if (cur.moveToFirst()) {
    int id=cur.getInt(cur.getColumnIndex((KEY_REFERENCE)));
    close(cur);
    return id;
  }
  close(cur);
  return 0;
}
Program: 187432
Project: 187432
Buggy source:
protected void onDestroy(){
  dba.close();
  unregisterReceiver(SMSbr);
  super.onDestroy();
}

Fixed version (ground truth):
protected void onDestroy(){
  dba.close();
  super.onDestroy();
}
Program: 187434
Project: 187434
Buggy source:
public void onClick(View v){
  String name=contactName.getText().toString();
  if (name.length() > 0 && contactEdit.getPrimaryNumber().length() > 0) {
    Prephase2Activity.dba.updateRow(contactEdit,contactEdit.getPrimaryNumber());
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    contactEdit=null;
    finish();
  }
}

Fixed version (ground truth):
public void onClick(View v){
  String name=contactName.getText().toString();
  if (name.length() > 0 && !contactEdit.isNumbersEmpty()) {
    Prephase2Activity.dba.updateRow(contactEdit,contactEdit.getNumber(0));
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    contactEdit=null;
    finish();
  }
}
Program: 187435
Project: 187435
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  View row=convertView;
  ContactHolder holder=null;
  if (row == null) {
    LayoutInflater inflater=((Activity)context).getLayoutInflater();
    row=inflater.inflate(layoutResourceId,parent,false);
    holder=new ContactHolder();
    holder.number=(TextView)row.findViewById(R.id.stored_number);
    holder.primary=(TextView)row.findViewById(R.id.primary_number);
    row.setTag(holder);
  }
 else {
    holder=(ContactHolder)row.getTag();
  }
  String number=data.getNumber(position);
  if (number != null) {
    holder.number.setText(number);
    if (data.getPrimaryNumber().equalsIgnoreCase(number)) {
      holder.primary.setText("String_Node_Str");
    }
 else {
      holder.primary.setText("String_Node_Str");
    }
  }
  return row;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  View row=convertView;
  ContactHolder holder=null;
  if (row == null) {
    LayoutInflater inflater=((Activity)context).getLayoutInflater();
    row=inflater.inflate(layoutResourceId,parent,false);
    holder=new ContactHolder();
    holder.number=(TextView)row.findViewById(R.id.stored_number);
    holder.primary=(TextView)row.findViewById(R.id.primary_number);
    row.setTag(holder);
  }
 else {
    holder=(ContactHolder)row.getTag();
  }
  String number=data.getNumber(position);
  if (number != null) {
    holder.number.setText(number);
    holder.primary.setText("String_Node_Str");
  }
  return row;
}
Program: 187436
Project: 187436
Buggy source:
/** 
 * Get all of the rows in the database with the columns name, number, key, verified.	
 * @return : ArrayList<TrustedContact>, a list of all thecontacts in the database
 */
public ArrayList<TrustedContact> getAllRows(){
  open();
  Cursor cur=db.query("String_Node_Str",null,null,null,null,null,KEY_ID);
  ArrayList<TrustedContact> tc=new ArrayList<TrustedContact>();
  if (cur.moveToFirst()) {
    int i=0;
    do {
      tc.add(new TrustedContact(cur.getString(cur.getColumnIndex(KEY_NAME)),cur.getString(cur.getColumnIndex(KEY_NUMBER)),cur.getString(cur.getColumnIndex(KEY_KEY)),cur.getInt(cur.getColumnIndex(KEY_VERIFIED))));
      int id=cur.getInt(cur.getColumnIndex(KEY_ID));
      Cursor pCur=db.query(SQLitehelper.TRUSTED_TABLE_NAME + "String_Node_Str" + SQLitehelper.NUMBERS_TABLE_NAME,new String[]{SQLitehelper.NUMBERS_TABLE_NAME + "String_Node_Str" + KEY_NUMBER},SQLitehelper.TRUSTED_TABLE_NAME + "String_Node_Str" + KEY_ID+ "String_Node_Str"+ SQLitehelper.NUMBERS_TABLE_NAME+ "String_Node_Str"+ KEY_REFERENCE+ "String_Node_Str"+ SQLitehelper.TRUSTED_TABLE_NAME+ "String_Node_Str"+ KEY_ID+ "String_Node_Str"+ id,null,null,null,null);
      if (pCur.moveToFirst()) {
        do {
          tc.get(i).addNumber(pCur.getString(pCur.getColumnIndex(KEY_NUMBER)));
        }
 while (pCur.moveToNext());
        pCur.close();
        return tc;
      }
      i++;
    }
 while (cur.moveToNext());
    close(cur);
    return tc;
  }
  close(cur);
  return null;
}

Fixed version (ground truth):
/** 
 * Get all of the rows in the database with the columns name, number, key, verified.	
 * @return : ArrayList<TrustedContact>, a list of all thecontacts in the database
 */
public ArrayList<TrustedContact> getAllRows(){
  open();
  Cursor cur=db.query(SQLitehelper.TRUSTED_TABLE_NAME,null,null,null,null,null,KEY_ID);
  ArrayList<TrustedContact> tc=new ArrayList<TrustedContact>();
  if (cur.moveToFirst()) {
    int i=0;
    do {
      tc.add(new TrustedContact(cur.getString(cur.getColumnIndex(KEY_NAME)),cur.getString(cur.getColumnIndex(KEY_NUMBER)),cur.getString(cur.getColumnIndex(KEY_KEY)),cur.getInt(cur.getColumnIndex(KEY_VERIFIED))));
      int id=cur.getInt(cur.getColumnIndex(KEY_ID));
      Cursor pCur=db.query(SQLitehelper.TRUSTED_TABLE_NAME + "String_Node_Str" + SQLitehelper.NUMBERS_TABLE_NAME,new String[]{SQLitehelper.NUMBERS_TABLE_NAME + "String_Node_Str" + KEY_NUMBER},SQLitehelper.TRUSTED_TABLE_NAME + "String_Node_Str" + KEY_ID+ "String_Node_Str"+ SQLitehelper.NUMBERS_TABLE_NAME+ "String_Node_Str"+ KEY_REFERENCE+ "String_Node_Str"+ SQLitehelper.TRUSTED_TABLE_NAME+ "String_Node_Str"+ KEY_ID+ "String_Node_Str"+ id,null,null,null,null);
      if (pCur.moveToFirst()) {
        do {
          tc.get(i).addNumber(pCur.getString(pCur.getColumnIndex(KEY_NUMBER)));
        }
 while (pCur.moveToNext());
        pCur.close();
      }
      i++;
    }
 while (cur.moveToNext());
    close(cur);
    return tc;
  }
  close(cur);
  return null;
}
Program: 187438
Project: 187438
Buggy source:
/** 
 * Called when the activity is first created. 
 */
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.contact);
  listView=(ListView)findViewById(R.id.contact_list);
  update();
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (tc != null) {
        if (Prephase2Activity.dba.isTrustedContact(tc.get(position).getPrimaryNumber())) {
          change(position,false);
          Toast.makeText(getApplicationContext(),"String_Node_Str" + tc.get(position).getPrimaryNumber(),Toast.LENGTH_SHORT).show();
        }
 else {
          change(position,true);
          Toast.makeText(getApplicationContext(),"String_Node_Str" + tc.get(position).getPrimaryNumber(),Toast.LENGTH_SHORT).show();
        }
      }
 else {
        startActivity(new Intent(getBaseContext(),AddContact.class));
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.contact);
  listView=(ListView)findViewById(R.id.contact_list);
  update();
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (tc != null) {
        if (Prephase2Activity.dba.isTrustedContact(tc.get(position).getANumber())) {
          change(position,false);
          Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
 else {
          change(position,true);
          Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
      }
 else {
        startActivity(new Intent(getBaseContext(),AddContact.class));
      }
    }
  }
);
}
Program: 187439
Project: 187439
Buggy source:
/** 
 * Reinitialises the list to ensure contacts that are trusted are selected.
 */
private void initList(){
  for (int i=0; i < tc.size(); i++) {
    if (Prephase2Activity.dba.isTrustedContact(tc.get(i).getPrimaryNumber())) {
      listView.setItemChecked(i,true);
    }
 else {
      listView.setItemChecked(i,false);
    }
  }
}

Fixed version (ground truth):
/** 
 * Reinitialises the list to ensure contacts that are trusted are selected.
 */
private void initList(){
  for (int i=0; i < tc.size(); i++) {
    if (Prephase2Activity.dba.isTrustedContact(tc.get(i).getANumber())) {
      listView.setItemChecked(i,true);
    }
 else {
      listView.setItemChecked(i,false);
    }
  }
}
Program: 187440
Project: 187440
Buggy source:
/** 
 * Used to toggle the contact from being in or out of the trusted state.
 * @param position : int, the position on the list ofcontacts.
 * @param add : boolean, if true the contact will beadded. If false the contact will be removed.
 */
public void change(int position,boolean add){
  if (add) {
    add(position);
  }
 else {
    remove(position);
  }
  Prephase2Activity.dba.updateRow(tc.get(position),tc.get(position).getPrimaryNumber());
}

Fixed version (ground truth):
/** 
 * Used to toggle the contact from being in or out of the trusted state.
 * @param position : int, the position on the list ofcontacts.
 * @param add : boolean, if true the contact will beadded. If false the contact will be removed.
 */
public void change(int position,boolean add){
  if (add) {
    add(position);
  }
 else {
    remove(position);
  }
  Prephase2Activity.dba.updateRow(tc.get(position),tc.get(position).getANumber());
}
Program: 187441
Project: 187441
Buggy source:
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  if (tc != null) {
    if (Prephase2Activity.dba.isTrustedContact(tc.get(position).getPrimaryNumber())) {
      change(position,false);
      Toast.makeText(getApplicationContext(),"String_Node_Str" + tc.get(position).getPrimaryNumber(),Toast.LENGTH_SHORT).show();
    }
 else {
      change(position,true);
      Toast.makeText(getApplicationContext(),"String_Node_Str" + tc.get(position).getPrimaryNumber(),Toast.LENGTH_SHORT).show();
    }
  }
 else {
    startActivity(new Intent(getBaseContext(),AddContact.class));
  }
}

Fixed version (ground truth):
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  if (tc != null) {
    if (Prephase2Activity.dba.isTrustedContact(tc.get(position).getANumber())) {
      change(position,false);
      Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
 else {
      change(position,true);
      Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
  }
 else {
    startActivity(new Intent(getBaseContext(),AddContact.class));
  }
}
Program: 187442
Project: 187442
Buggy source:
/** 
 * Called when the activity is first created. 
 */
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.remove_contacts);
  delete=(Button)findViewById(R.id.delete_cont);
  listView=(ListView)findViewById(R.id.removeable_contact_list);
  update();
  contact=new boolean[tc.size()];
  for (int i=0; i < tc.size(); i++) {
    contact[i]=false;
  }
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      toggle(position);
    }
  }
);
  delete.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      if (tc != null) {
        for (int i=0; i < tc.size(); i++) {
          Toast.makeText(getBaseContext(),"String_Node_Str" + tc.get(i).getPrimaryNumber(),Toast.LENGTH_LONG);
          if (contact[i]) {
            Prephase2Activity.dba.removeRow(tc.get(i).getPrimaryNumber());
          }
        }
        update();
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.remove_contacts);
  delete=(Button)findViewById(R.id.delete_cont);
  listView=(ListView)findViewById(R.id.removeable_contact_list);
  update();
  contact=new boolean[tc.size()];
  for (int i=0; i < tc.size(); i++) {
    contact[i]=false;
  }
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      toggle(position);
    }
  }
);
  delete.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      if (tc != null) {
        for (int i=0; i < tc.size(); i++) {
          if (contact[i]) {
            Prephase2Activity.dba.removeRow(tc.get(i).getPrimaryNumber());
          }
        }
        update();
      }
    }
  }
);
}
Program: 187443
Project: 187443
Buggy source:
public void onClick(View v){
  if (tc != null) {
    for (int i=0; i < tc.size(); i++) {
      Toast.makeText(getBaseContext(),"String_Node_Str" + tc.get(i).getPrimaryNumber(),Toast.LENGTH_LONG);
      if (contact[i]) {
        Prephase2Activity.dba.removeRow(tc.get(i).getPrimaryNumber());
      }
    }
    update();
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (tc != null) {
    for (int i=0; i < tc.size(); i++) {
      if (contact[i]) {
        Prephase2Activity.dba.removeRow(tc.get(i).getPrimaryNumber());
      }
    }
    update();
  }
}
Program: 187444
Project: 187444
Buggy source:
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL(TRUSTED_TABLE_CREATE);
  db.execSQL(NUMBERS_TABLE_CREATE);
}

Fixed version (ground truth):
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL(TRUSTED_TABLE_CREATE);
  db.execSQL(NUMBERS_TABLE_CREATE);
  db.execSQL(USER_TABLE_CREATE);
}
Program: 187445
Project: 187445
Buggy source:
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  db.execSQL("String_Node_Str" + TRUSTED_TABLE_CREATE);
  db.execSQL("String_Node_Str" + NUMBERS_TABLE_CREATE);
  onCreate(db);
}

Fixed version (ground truth):
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  db.execSQL("String_Node_Str" + USER_TABLE_CREATE);
  db.execSQL("String_Node_Str" + TRUSTED_TABLE_CREATE);
  db.execSQL("String_Node_Str" + NUMBERS_TABLE_CREATE);
  onCreate(db);
}
Program: 187447
Project: 187447
Buggy source:
public boolean isNumbersEmpty(){
  if (numbers != null && numbers.size() <= 1) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean isNumbersEmpty(){
  if (numbers == null) {
    return true;
  }
  return false;
}
Program: 187448
Project: 187448
Buggy source:
/** 
 * Access the information stored in the database of a contact who has a certain number with the columns: name, number, key, verified.
 * @param number : String the number of the contact to retrieve 
 * @return TrustedContact, the row of data.
 */
public TrustedContact getRow(String number){
  open();
  Cursor cur=db.query(SQLitehelper.TRUSTED_TABLE_NAME,null,"String_Node_Str" + number,null,null,null,null);
  if (cur.moveToFirst()) {
    TrustedContact tc=new TrustedContact(cur.getString(cur.getColumnIndex(KEY_NAME)),cur.getString(cur.getColumnIndex(KEY_NUMBER)),cur.getString(cur.getColumnIndex(KEY_KEY)),cur.getInt(cur.getColumnIndex(KEY_VERIFIED)));
    int id=cur.getInt(cur.getColumnIndex(KEY_ID));
    close(cur);
    tc=getNumbers(tc,id);
    return tc;
  }
  close(cur);
  return null;
}

Fixed version (ground truth):
/** 
 * Access the information stored in the database of a contact who has a certain number with the columns: name, number, key, verified.
 * @param number : String the number of the contact to retrieve 
 * @return TrustedContact, the row of data.
 */
public TrustedContact getRow(String number){
  open();
  Cursor cur=db.query(SQLitehelper.TRUSTED_TABLE_NAME,null,"String_Node_Str" + number,null,null,null,null);
  if (cur.moveToFirst()) {
    TrustedContact tc=new TrustedContact(cur.getString(cur.getColumnIndex(KEY_NAME)),cur.getString(cur.getColumnIndex(KEY_NUMBER)),cur.getString(cur.getColumnIndex(KEY_KEY)),cur.getInt(cur.getColumnIndex(KEY_VERIFIED)));
    int id=cur.getInt(cur.getColumnIndex(KEY_ID));
    Cursor pCur=db.query(SQLitehelper.TRUSTED_TABLE_NAME + "String_Node_Str" + SQLitehelper.NUMBERS_TABLE_NAME,new String[]{SQLitehelper.NUMBERS_TABLE_NAME + "String_Node_Str" + KEY_NUMBER},SQLitehelper.TRUSTED_TABLE_NAME + "String_Node_Str" + KEY_ID+ "String_Node_Str"+ SQLitehelper.NUMBERS_TABLE_NAME+ "String_Node_Str"+ KEY_REFERNECE+ "String_Node_Str"+ SQLitehelper.TRUSTED_TABLE_NAME+ "String_Node_Str"+ KEY_ID+ "String_Node_Str"+ id,null,null,null,null);
    if (pCur.moveToFirst()) {
      do {
        tc.addNumber(pCur.getString(pCur.getColumnIndex(KEY_NUMBER)));
      }
 while (pCur.moveToNext());
      pCur.close();
    }
    close(cur);
    return tc;
  }
  close(cur);
  return null;
}
Program: 187449
Project: 187449
Buggy source:
/** 
 * Update the verified of the contact
 * @param number : String the contact's number
 * @param verified : int the contacts new state
 */
public boolean isTrustedContact(String number){
  TrustedContact tc=getRow(number);
  if (tc == null) {
    tc=getRow(number.substring(1));
  }
  if (tc != null) {
    if (!tc.isKeyNull() && tc.getVerified() == 2) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Update the verified of the contact
 * @param number : String the contact's number
 * @param verified : int the contacts new state
 */
public boolean isTrustedContact(String number){
  TrustedContact tc=getRow(number);
  if (tc == null) {
    tc=getRow(format(number));
  }
  if (tc != null) {
    if (!tc.isKeyNull() && tc.getVerified() == 2) {
      return true;
    }
  }
  return false;
}
Program: 187450
Project: 187450
Buggy source:
public String nameHelper(String number){
  String num=findNameByAddress(number);
  if (num.equalsIgnoreCase(number)) {
    return findNameByAddress(format(number));
  }
  return num;
}

Fixed version (ground truth):
public String nameHelper(String number){
  String num=findNameByAddress(number);
  if (num.equalsIgnoreCase(number)) {
    return findNameByAddress(DBAccessor.format(number));
  }
  return num;
}
Program: 187453
Project: 187453
Buggy source:
/** 
 * Updates the list of contacts
 */
private void update(){
  String[] names;
  tc=Prephase2Activity.dba.getAllRows();
  names=new String[tc.size()];
  for (int i=0; i < tc.size(); i++) {
    names[i]=tc.get(i).getName();
  }
  listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice,names));
  listView.setItemsCanFocus(false);
  listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}

Fixed version (ground truth):
/** 
 * Updates the list of contacts
 */
private void update(){
  String[] names;
  tc=Prephase2Activity.dba.getAllRows();
  if (tc != null) {
    names=new String[tc.size()];
    for (int i=0; i < tc.size(); i++) {
      names[i]=tc.get(i).getName();
    }
    listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice,names));
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
  }
 else {
    names=new String[]{"String_Node_Str"};
    listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,names));
  }
  listView.setItemsCanFocus(false);
}
Program: 187454
Project: 187454
Buggy source:
/** 
 * Update the verified of the contact
 * @param number : String the contact's number
 * @param verified : int the contacts new state
 */
public boolean isTrustedContact(String number){
  TrustedContact tc=getRow(number);
  if (tc != null) {
    if (!tc.isKeyNull() && tc.getVerified() == 2) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Update the verified of the contact
 * @param number : String the contact's number
 * @param verified : int the contacts new state
 */
public boolean isTrustedContact(String number){
  TrustedContact tc=getRow(number);
  if (tc == null) {
    tc=getRow(number.substring(1));
  }
  if (tc != null) {
    if (!tc.isKeyNull() && tc.getVerified() == 2) {
      return true;
    }
  }
  return false;
}
Program: 187455
Project: 187455
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.messageviewer);
  ListView list=(ListView)findViewById(R.id.listView1);
  List<String[]> msgList=getSMS();
  list.setAdapter(new ArrayAdapter<String>(this,android.R.layout.test_list_item,messageMaker(msgList)));
  list.setItemsCanFocus(false);
  list.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.messageviewer);
  Prephase2Activity.dba=new DBAccessor(this);
  Prephase2Activity.sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  ListView list=(ListView)findViewById(R.id.listView1);
  List<String[]> msgList=getSMS();
  list.setAdapter(new ArrayAdapter<String>(this,android.R.layout.test_list_item,messageMaker(msgList)));
  list.setItemsCanFocus(false);
  list.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
  sendSMS=(Button)findViewById(R.id.send);
  messageBox=(EditText)findViewById(R.id.message);
  sendSMS.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String text=messageBox.getText().toString();
      if (Prephase2Activity.selectedNumber.length() > 0 && text.length() > 0) {
        Toast.makeText(getBaseContext(),"String_Node_Str" + Prephase2Activity.selectedNumber,Toast.LENGTH_SHORT).show();
        try {
          if (Prephase2Activity.dba.isTrustedContact(Prephase2Activity.selectedNumber) && Prephase2Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
            sendSMS(Prephase2Activity.selectedNumber,Encryption.aes_encrypt(PASSWORD,text));
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
 else {
            sendSMS(Prephase2Activity.selectedNumber,text);
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
          messageBox.setText("String_Node_Str");
        }
 catch (        Exception e) {
          Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
          e.printStackTrace();
        }
      }
 else {
        Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
      }
    }
  }
);
}
Program: 187456
Project: 187456
Buggy source:
public List<String> messageMaker(List<String[]> sms){
  List<String> messageList=new ArrayList<String>();
  for (int i=0; i < sms.size(); i++) {
    messageList.add(sms.get(i)[1] + "String_Node_Str" + sms.get(i)[2]);
  }
  return messageList;
}

Fixed version (ground truth):
public List<String> messageMaker(List<String[]> sms){
  List<String> messageList=new ArrayList<String>();
  for (int i=0; i < sms.size(); i++) {
    messageList.add(sms.get(i)[1] + "String_Node_Str" + sms.get(i)[0]+ "String_Node_Str"+ sms.get(i)[2]);
  }
  return messageList;
}
Program: 187460
Project: 187460
Buggy source:
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  final String key="String_Node_Str";
  final int verify=2;
  Toast.makeText(getApplicationContext(),tc.get(position).getKey(),Toast.LENGTH_SHORT).show();
  if (Prephase1Activity.dba.isTrustedContact(tc.get(position).getNumber())) {
    tc.get(position).setKey(null);
    tc.get(position).setVerified(0);
    Prephase1Activity.dba.removeRow(tc.get(position).getNumber());
    Prephase1Activity.dba.addRow(tc.get(position));
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
 else {
    tc.get(position).setKey(key);
    tc.get(position).setVerified(verify);
    Prephase1Activity.dba.removeRow(tc.get(position).getNumber());
    Prephase1Activity.dba.addRow(tc.get(position));
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  final String key="String_Node_Str";
  final int verify=2;
  if (tc != null) {
    if (Prephase1Activity.dba.isTrustedContact(tc.get(position).getNumber())) {
      tc.get(position).setKey(null);
      tc.get(position).setVerified(0);
      Prephase1Activity.dba.removeRow(tc.get(position).getNumber());
      Prephase1Activity.dba.addRow(tc.get(position));
      Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
 else {
      tc.get(position).setKey(key);
      tc.get(position).setVerified(verify);
      Prephase1Activity.dba.removeRow(tc.get(position).getNumber());
      Prephase1Activity.dba.addRow(tc.get(position));
      Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
  }
 else {
  }
}
Program: 187461
Project: 187461
Buggy source:
public static void startTimer(){
  stopTimer();
  timerIDs.add(Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),new Runnable(){
    public void run(){
      for (      MyPet myPet : MyPetApi.getMyPetManager().getAllActiveMyPets()) {
        myPet.schedule();
      }
    }
  }
,0L,20L));
  timerIDs.add(Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),new Runnable(){
    public void run(){
      for (      Scheduler task : tasksToSchedule) {
        task.schedule();
      }
    }
  }
,5L,20L));
  timerIDs.add(Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),new Runnable(){
    public void run(){
      for (      MyPetPlayer player : MyPetApi.getPlayerManager().getMyPetPlayers()) {
        player.schedule();
      }
    }
  }
,10L,20L));
}

Fixed version (ground truth):
public static void startTimer(){
  stopTimer();
  timerIDs.add(Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),() -> {
    for (    MyPet myPet : MyPetApi.getMyPetManager().getAllActiveMyPets()) {
      myPet.schedule();
    }
  }
,0L,20L));
  timerIDs.add(Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),() -> {
    for (    Scheduler task : tasksToSchedule) {
      task.schedule();
    }
  }
,5L,20L));
  timerIDs.add(Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),() -> {
    for (    MyPetPlayer player : MyPetApi.getPlayerManager().getMyPetPlayers()) {
      player.schedule();
    }
  }
,10L,20L));
}
Program: 187462
Project: 187462
Buggy source:
public void once(){
  if (!running()) {
    taskID=Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),new Runnable(){
      @Override public void run(){
        if (locationHolder.isValid()) {
          for (int i=0; i < framesPerTick; i++) {
            tick(frame,locationHolder.getLocation());
            if (++frame >= length) {
              stop();
              break;
            }
          }
        }
 else {
          stop();
        }
      }
    }
,0,tickRate);
  }
}

Fixed version (ground truth):
public void once(){
  if (!running()) {
    taskID=Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),() -> {
      if (locationHolder.isValid()) {
        for (int i=0; i < framesPerTick; i++) {
          tick(frame,locationHolder.getLocation());
          if (++frame >= length) {
            stop();
            break;
          }
        }
      }
 else {
        stop();
      }
    }
,0,tickRate);
  }
}
Program: 187463
Project: 187463
Buggy source:
public void loop(int quantity){
  if (!running()) {
    this.loops=quantity;
    taskID=Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),new Runnable(){
      @Override public void run(){
        if (locationHolder.isValid()) {
          for (int i=0; i < framesPerTick; i++) {
            tick(frame,locationHolder.getLocation());
            if (++frame >= length) {
              if (--Animation.this.loops > 0) {
                reset();
              }
 else {
                stop();
              }
              break;
            }
          }
        }
 else {
          stop();
        }
      }
    }
,0,tickRate);
  }
}

Fixed version (ground truth):
public void loop(int quantity){
  if (!running()) {
    this.loops=quantity;
    taskID=Bukkit.getScheduler().scheduleSyncRepeatingTask(MyPetApi.getPlugin(),() -> {
      if (locationHolder.isValid()) {
        for (int i=0; i < framesPerTick; i++) {
          tick(frame,locationHolder.getLocation());
          if (++frame >= length) {
            if (--Animation.this.loops > 0) {
              reset();
            }
 else {
              stop();
            }
            break;
          }
        }
      }
 else {
        stop();
      }
    }
,0,tickRate);
  }
}
Program: 187464
Project: 187464
Buggy source:
public boolean load(){
  config=new JSONObject();
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new FileReader(jsonFile));
    JSONParser parser=new JSONParser();
    Object obj=parser.parse(reader);
    config=(JSONObject)obj;
  }
 catch (  ParseException e) {
    MyPetApi.getLogger().warning("String_Node_Str" + jsonFile.getName());
    return false;
  }
catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException ignored) {
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean load(){
  config=new JSONObject();
  try (BufferedReader reader=new BufferedReader(new FileReader(jsonFile))){
    JSONParser parser=new JSONParser();
    Object obj=parser.parse(reader);
    config=(JSONObject)obj;
  }
 catch (  ParseException e) {
    MyPetApi.getLogger().warning("String_Node_Str" + jsonFile.getName());
    return false;
  }
catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
  return true;
}
Program: 187465
Project: 187465
Buggy source:
public boolean load(){
  if (!NBTFile.exists()) {
    return false;
  }
  try {
    InputStream is=new FileInputStream(NBTFile);
    TagBase tag=TagStream.readTag(is,true);
    if (tag != null) {
      nbtTagCompound=(TagCompound)tag;
      return true;
    }
    tag=TagStream.readTag(is,false);
    if (tag != null) {
      nbtTagCompound=(TagCompound)tag;
      return true;
    }
 else {
      MyPetApi.getLogger().warning("String_Node_Str" + NBTFile.getName());
      return false;
    }
  }
 catch (  FileNotFoundException e) {
    return false;
  }
catch (  IOException e) {
    return false;
  }
}

Fixed version (ground truth):
public boolean load(){
  if (!NBTFile.exists()) {
    return false;
  }
  try {
    InputStream is=new FileInputStream(NBTFile);
    TagBase tag=TagStream.readTag(is,true);
    if (tag != null) {
      nbtTagCompound=(TagCompound)tag;
      return true;
    }
    tag=TagStream.readTag(is,false);
    if (tag != null) {
      nbtTagCompound=(TagCompound)tag;
      return true;
    }
 else {
      MyPetApi.getLogger().warning("String_Node_Str" + NBTFile.getName());
      return false;
    }
  }
 catch (  IOException e) {
    return false;
  }
}
Program: 187466
Project: 187466
Buggy source:
@Override public boolean equals(Object obj){
  if (obj == null || !(obj instanceof Interval)) {
    return false;
  }
  Interval<T,S> other=(Interval<T,S>)obj;
  if (start == null ^ other.start == null) {
    return false;
  }
  if (value == null ^ other.value == null) {
    return false;
  }
  if (!value.equals(other.value)) {
    return false;
  }
  if (end == null ^ other.end == null) {
    return false;
  }
  if (isEndInclusive ^ other.isEndInclusive) {
    return false;
  }
  if (isStartInclusive ^ other.isStartInclusive) {
    return false;
  }
  if (start != null && !start.equals(other.start)) {
    return false;
  }
  if (end != null && !end.equals(other.end)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (!(obj instanceof Interval)) {
    return false;
  }
  Interval<T,S> other=(Interval<T,S>)obj;
  if (start == null ^ other.start == null) {
    return false;
  }
  if (value == null ^ other.value == null) {
    return false;
  }
  if (!value.equals(other.value)) {
    return false;
  }
  if (end == null ^ other.end == null) {
    return false;
  }
  if (isEndInclusive ^ other.isEndInclusive) {
    return false;
  }
  if (isStartInclusive ^ other.isStartInclusive) {
    return false;
  }
  if (start != null && !start.equals(other.start)) {
    return false;
  }
  if (end != null && !end.equals(other.end)) {
    return false;
  }
  return true;
}
Program: 187467
Project: 187467
Buggy source:
public void applyTo(TagCompound tag){
  if (hasOwner()) {
    TagCompound ownerTag=new TagCompound();
    ownerTag.put("String_Node_Str",new TagString(getOwner()));
    if (hasTexture()) {
      TagCompound propertiesTag=new TagCompound();
      TagList textureList=new TagList();
      TagCompound textureTag=new TagCompound();
      JSONObject jsonObject=new JSONObject();
      JSONObject texturesObject=new JSONObject();
      JSONObject skinObject=new JSONObject();
      jsonObject.put("String_Node_Str",texturesObject);
      texturesObject.put("String_Node_Str",skinObject);
      skinObject.put("String_Node_Str",getTexture());
      String base64=BaseEncoding.base64Url().encode(jsonObject.toJSONString().getBytes());
      textureTag.put("String_Node_Str",new TagString(base64));
      textureList.addTag(textureTag);
      propertiesTag.put("String_Node_Str",textureList);
      ownerTag.put("String_Node_Str",propertiesTag);
    }
    tag.put("String_Node_Str",ownerTag);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void applyTo(TagCompound tag){
  if (hasOwner()) {
    TagCompound ownerTag=new TagCompound();
    ownerTag.put("String_Node_Str",new TagString(getOwner()));
    if (hasTexture()) {
      TagCompound propertiesTag=new TagCompound();
      TagList textureList=new TagList();
      TagCompound textureTag=new TagCompound();
      JSONObject jsonObject=new JSONObject();
      JSONObject texturesObject=new JSONObject();
      JSONObject skinObject=new JSONObject();
      jsonObject.put("String_Node_Str",texturesObject);
      texturesObject.put("String_Node_Str",skinObject);
      skinObject.put("String_Node_Str",getTexture());
      String base64=BaseEncoding.base64Url().encode(jsonObject.toJSONString().getBytes());
      textureTag.put("String_Node_Str",new TagString(base64));
      textureList.addTag(textureTag);
      propertiesTag.put("String_Node_Str",textureList);
      ownerTag.put("String_Node_Str",propertiesTag);
    }
    tag.put("String_Node_Str",ownerTag);
  }
}
Program: 187469
Project: 187469
Buggy source:
/** 
 * Entity AI tick method -> updateAITasks()
 */
protected void doMyPetTick(){
  try {
    ++this.ticksFarFromPlayer;
    if (isAlive()) {
      getEntitySenses().a();
      Player p=getOwner().getPlayer();
      if (p == null || !p.isOnline()) {
        MyPetApi.getLogger().warning("String_Node_Str");
        MyPetApi.getLogger().warning("String_Node_Str");
        MyPetApi.getLogger().warning("String_Node_Str" + getMyPet());
        MyPetApi.getLogger().warning("String_Node_Str" + getOwner());
        MyPetApi.getLogger().warning("String_Node_Str" + (getOwner() != null ? getOwner().isOnline() : "String_Node_Str"));
        MyPetApi.getLogger().warning("String_Node_Str");
        this.die();
        return;
      }
      if (!hasRider()) {
        petTargetSelector.tick();
        petPathfinderSelector.tick();
        petNavigation.tick();
      }
      Ride rideSkill=myPet.getSkills().get(RideImpl.class);
      if (this.onGround && rideSkill.getFlyLimit().getValue().doubleValue() > 0) {
        limitCounter+=rideSkill.getFlyRegenRate().getValue().doubleValue();
        if (limitCounter > rideSkill.getFlyLimit().getValue().doubleValue()) {
          limitCounter=rideSkill.getFlyLimit().getValue().floatValue();
        }
      }
    }
    M();
    getControllerMove().a();
    getControllerLook().a();
    getControllerJump().b();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Entity AI tick method -> updateAITasks()
 */
protected void doMyPetTick(){
  try {
    ++this.ticksFarFromPlayer;
    if (isAlive()) {
      getEntitySenses().a();
      Player p=getOwner().getPlayer();
      if (p == null || !p.isOnline()) {
        MyPetApi.getLogger().warning("String_Node_Str");
        MyPetApi.getLogger().warning("String_Node_Str");
        MyPetApi.getLogger().warning("String_Node_Str" + getMyPet());
        MyPetApi.getLogger().warning("String_Node_Str" + getOwner());
        MyPetApi.getLogger().warning("String_Node_Str" + (getOwner() != null ? getOwner().isOnline() : "String_Node_Str"));
        MyPetApi.getLogger().warning("String_Node_Str");
        this.die();
        return;
      }
      if (!hasRider()) {
        petTargetSelector.tick();
        petPathfinderSelector.tick();
        petNavigation.tick();
      }
    }
    M();
    getControllerMove().a();
    getControllerLook().a();
    getControllerJump().b();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}