nus-yam/ex-repair huggingface dataset:
Program: 63780
Project: 63780
Buggy source:
private HashMap<String,String> getWriteDate(OModel model,List<Integer> ids){
  HashMap<String,String> map=new HashMap<>();
  try {
    List<OdooRecord> result;
    if (model.getColumn("String_Node_Str") != null) {
      OdooFields fields=new OdooFields(new String[]{"String_Node_Str"});
      ODomain domain=new ODomain();
      domain.add("String_Node_Str","String_Node_Str",ids);
      OdooResult response=mOdoo.searchRead(model.getModelName(),fields,domain,0,0,null);
      result=response.getRecords();
    }
 else {
      OdooResult response=mOdoo.permRead(model.getModelName(),ids);
      result=response.getRecords();
    }
    if (!result.isEmpty()) {
      for (      OdooRecord record : result) {
        map.put("String_Node_Str" + record.getInt("String_Node_Str"),record.getString("String_Node_Str"));
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return map;
}

Fixed version (ground truth):
private HashMap<String,String> getWriteDate(OModel model,List<Integer> ids){
  HashMap<String,String> map=new HashMap<>();
  try {
    List<OdooRecord> result;
    if (model.getColumn("String_Node_Str") != null) {
      OdooFields fields=new OdooFields(new String[]{"String_Node_Str"});
      ODomain domain=new ODomain();
      domain.add("String_Node_Str","String_Node_Str",ids);
      OdooResult response=mOdoo.searchRead(model.getModelName(),fields,domain,0,0,null);
      result=response.getRecords();
    }
 else {
      Log.i(TAG,"String_Node_Str" + ids);
      OdooResult response=mOdoo.permRead(model.getModelName(),ids);
      result=response.getArray("String_Node_Str");
    }
    if (!result.isEmpty()) {
      for (      OdooRecord record : result) {
        map.put("String_Node_Str" + record.getInt("String_Node_Str"),record.getString("String_Node_Str"));
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return map;
}
Program: 63782
Project: 63782
Buggy source:
public void setLastSyncDateTimeToNow(OModel model){
  Log.i(TAG,"String_Node_Str" + model.getModelName());
  OValues values=new OValues();
  values.put("String_Node_Str",model.getModelName());
  values.put("String_Node_Str",ODateUtils.getUTCDate());
  insertOrUpdate("String_Node_Str",new String[]{model.getModelName()},values);
}

Fixed version (ground truth):
public void setLastSyncDateTimeToNow(OModel model){
  Log.i(TAG,"String_Node_Str" + model.getModelName());
  OValues values=new OValues();
  values.put("String_Node_Str",model.getModelName());
  Date last_sync=ODateUtils.createDateObject(ODateUtils.getUTCDate(),ODateUtils.DEFAULT_FORMAT,true);
  Calendar cal=Calendar.getInstance();
  cal.setTime(last_sync);
  cal.set(Calendar.SECOND,cal.get(Calendar.SECOND) + 2);
  last_sync=cal.getTime();
  values.put("String_Node_Str",ODateUtils.getDate(last_sync,ODateUtils.DEFAULT_FORMAT));
  insertOrUpdate("String_Node_Str",new String[]{model.getModelName()},values);
}
Program: 63783
Project: 63783
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.base_about);
  OActionBarUtils.setActionBar(this,true);
  setTitle("String_Node_Str");
  findViewById(R.id.abtus_header).setOnClickListener(this);
  TextView versionName, aboutLine2, aboutLine3, aboutLine4;
  versionName=(TextView)findViewById(R.id.txvVersionName);
  handler=getWindow().getDecorView().getHandler();
  try {
    PackageManager packageManager=getPackageManager();
    String version=packageManager.getPackageInfo(getPackageName(),0).versionName;
    String versionCode=packageManager.getPackageInfo(getPackageName(),0).versionCode + "String_Node_Str";
    versionName.setText(getResources().getString(R.string.label_version) + "String_Node_Str" + version+ "String_Node_Str"+ versionCode+ "String_Node_Str");
    aboutLine2=(TextView)findViewById(R.id.line2);
    if (aboutLine2 != null) {
      aboutLine2.setMovementMethod(LinkMovementMethod.getInstance());
    }
    aboutLine3=(TextView)findViewById(R.id.line3);
    if (aboutLine3 != null) {
      aboutLine3.setMovementMethod(LinkMovementMethod.getInstance());
    }
    aboutLine4=(TextView)findViewById(R.id.line4);
    if (aboutLine4 != null) {
      aboutLine4.setMovementMethod(LinkMovementMethod.getInstance());
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.base_about);
  OActionBarUtils.setActionBar(this,true);
  setTitle("String_Node_Str");
  findViewById(R.id.abtus_header).setOnClickListener(this);
  TextView versionName, aboutLine2, aboutLine3, aboutLine4;
  versionName=(TextView)findViewById(R.id.txvVersionName);
  handler=new Handler();
  try {
    PackageManager packageManager=getPackageManager();
    String version=packageManager.getPackageInfo(getPackageName(),0).versionName;
    String versionCode=packageManager.getPackageInfo(getPackageName(),0).versionCode + "String_Node_Str";
    versionName.setText(getResources().getString(R.string.label_version) + "String_Node_Str" + version+ "String_Node_Str"+ versionCode+ "String_Node_Str");
    aboutLine2=(TextView)findViewById(R.id.line2);
    if (aboutLine2 != null) {
      aboutLine2.setMovementMethod(LinkMovementMethod.getInstance());
    }
    aboutLine3=(TextView)findViewById(R.id.line3);
    if (aboutLine3 != null) {
      aboutLine3.setMovementMethod(LinkMovementMethod.getInstance());
    }
    aboutLine4=(TextView)findViewById(R.id.line4);
    if (aboutLine4 != null) {
      aboutLine4.setMovementMethod(LinkMovementMethod.getInstance());
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 63784
Project: 63784
Buggy source:
public void exportDB(){
  FileChannel source=null;
  FileChannel destination=null;
  String currentDBPath=getDatabaseLocalPath();
  String backupDBPath=OStorageUtils.getDirectoryPath("String_Node_Str") + "String_Node_Str" + getDatabaseName();
  File currentDB=new File(currentDBPath);
  File backupDB=new File(backupDBPath);
  try {
    source=new FileInputStream(currentDB).getChannel();
    destination=new FileOutputStream(backupDB).getChannel();
    destination.transferFrom(source,0,source.size());
    source.close();
    destination.close();
    String subject="String_Node_Str" + getDatabaseName();
    Uri uri=Uri.fromFile(backupDB);
    Intent intent=new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_STREAM,uri);
    intent.putExtra(Intent.EXTRA_SUBJECT,subject);
    intent.setType("String_Node_Str");
    mContext.startActivity(intent);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void exportDB(){
  FileChannel source;
  FileChannel destination;
  String currentDBPath=getDatabaseLocalPath();
  String backupDBPath=OStorageUtils.getDirectoryPath("String_Node_Str") + "String_Node_Str" + getDatabaseName();
  File currentDB=new File(currentDBPath);
  File backupDB=new File(backupDBPath);
  try {
    source=new FileInputStream(currentDB).getChannel();
    destination=new FileOutputStream(backupDB).getChannel();
    destination.transferFrom(source,0,source.size());
    source.close();
    destination.close();
    String subject="String_Node_Str" + getDatabaseName();
    Uri uri=Uri.fromFile(backupDB);
    Intent intent=new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_STREAM,uri);
    intent.putExtra(Intent.EXTRA_SUBJECT,subject);
    intent.setType("String_Node_Str");
    mContext.startActivity(intent);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 63785
Project: 63785
Buggy source:
public String getLastSyncDateTime(){
  IrModel model=new IrModel(mContext,mUser);
  List<ODataRow> records=model.select(null,"String_Node_Str",new String[]{getModelName()});
  if (records.size() > 0) {
    return records.get(0).getString("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
public String getLastSyncDateTime(){
  IrModel model=new IrModel(mContext,mUser);
  List<ODataRow> records=model.select(null,"String_Node_Str",new String[]{getModelName()});
  if (records.size() > 0) {
    String date=records.get(0).getString("String_Node_Str");
    Date write_date=ODateUtils.createDateObject(date,ODateUtils.DEFAULT_FORMAT,true);
    Calendar cal=Calendar.getInstance();
    cal.setTime(write_date);
    cal.set(Calendar.SECOND,cal.get(Calendar.SECOND) + 2);
    write_date=cal.getTime();
    return ODateUtils.getDate(write_date,ODateUtils.DEFAULT_FORMAT);
  }
  return null;
}
Program: 63787
Project: 63787
Buggy source:
/** 
 * Creates locally created record on server (id with zero)
 * @param model model object
 */
private void createRecordsOnServer(OModel model){
  List<ODataRow> records=model.select(null,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"});
  int counter=0;
  for (  ODataRow record : records) {
    int id=createOnServer(model,JSONUtils.createJSONValues(model,record));
    if (id != OModel.INVALID_ROW_ID) {
      OValues values=new OValues();
      values.put("String_Node_Str",id);
      values.put("String_Node_Str","String_Node_Str");
      values.put("String_Node_Str",ODateUtils.getUTCDate());
      model.update(record.getInt(OColumn.ROW_ID),values);
      counter++;
    }
 else {
      Log.e(TAG,"String_Node_Str");
    }
  }
  if (counter == records.size()) {
    Log.i(TAG,counter + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Creates locally created record on server (id with zero)
 * @param model model object
 */
private void createRecordsOnServer(OModel model){
  List<ODataRow> records=model.select(null,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"});
  int counter=0;
  for (  ODataRow record : records) {
    if (validateRelationRecords(model,record)) {
      if (model.selectServerId(record.getInt(OColumn.ROW_ID)) == 0) {
        int id=createOnServer(model,JSONUtils.createJSONValues(model,record));
        if (id != OModel.INVALID_ROW_ID) {
          OValues values=new OValues();
          values.put("String_Node_Str",id);
          values.put("String_Node_Str","String_Node_Str");
          values.put("String_Node_Str",ODateUtils.getUTCDate());
          model.update(record.getInt(OColumn.ROW_ID),values);
          counter++;
        }
 else {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
  if (counter == records.size()) {
    Log.i(TAG,counter + "String_Node_Str");
  }
}
Program: 63788
Project: 63788
Buggy source:
private void showSignInErrorNotification(OUser user){
  ONotificationBuilder builder=new ONotificationBuilder(mContext,REQUEST_SIGN_IN_ERROR);
  builder.setTitle("String_Node_Str");
  builder.setBigText("String_Node_Str" + "String_Node_Str");
  builder.setIcon(R.drawable.ic_action_alert_warning);
  builder.setText(user.getAndroidName());
  builder.allowVibrate(true);
  builder.withRingTone(false);
  builder.setOngoing(true);
  builder.withLargeIcon(false);
  builder.setColor(R.color.android_orange_dark);
  Bundle extra=user.getAsBundle();
  ONotificationBuilder.NotificationAction actionReset=new ONotificationBuilder.NotificationAction(R.drawable.ic_action_refresh,"String_Node_Str",110,"String_Node_Str",OdooAccountQuickManage.class,extra);
  ONotificationBuilder.NotificationAction deleteAccount=new ONotificationBuilder.NotificationAction(R.drawable.ic_action_navigation_close,"String_Node_Str",111,"String_Node_Str",OdooAccountQuickManage.class,extra);
  builder.addAction(actionReset);
  builder.addAction(deleteAccount);
  builder.build().show();
}

Fixed version (ground truth):
private void showSignInErrorNotification(OUser user){
  ONotificationBuilder builder=new ONotificationBuilder(mContext,REQUEST_SIGN_IN_ERROR);
  builder.setTitle("String_Node_Str");
  builder.setBigText("String_Node_Str" + "String_Node_Str");
  builder.setIcon(R.drawable.ic_action_alert_warning);
  builder.setText(user.getAndroidName());
  builder.allowVibrate(true);
  builder.withRingTone(false);
  builder.setOngoing(true);
  builder.withLargeIcon(false);
  builder.setColor(OResource.color(mContext,R.color.android_orange_dark));
  Bundle extra=user.getAsBundle();
  ONotificationBuilder.NotificationAction actionReset=new ONotificationBuilder.NotificationAction(R.drawable.ic_action_refresh,"String_Node_Str",110,"String_Node_Str",OdooAccountQuickManage.class,extra);
  ONotificationBuilder.NotificationAction deleteAccount=new ONotificationBuilder.NotificationAction(R.drawable.ic_action_navigation_close,"String_Node_Str",111,"String_Node_Str",OdooAccountQuickManage.class,extra);
  builder.addAction(actionReset);
  builder.addAction(deleteAccount);
  builder.build().show();
}
Program: 63789
Project: 63789
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mSavedInstanceState=savedInstanceState;
  Log.i(TAG,"String_Node_Str");
  OPreferenceManager preferenceManager=new OPreferenceManager(this);
  if (!preferenceManager.getBoolean(KEY_FRESH_LOGIN,false)) {
    preferenceManager.setBoolean(KEY_FRESH_LOGIN,true);
    new Handler().postDelayed(new Runnable(){
      @Override public void run(){
        startActivity(new Intent(OdooActivity.this,AppIntro.class));
      }
    }
,1000);
  }
  setContentView(R.layout.odoo_activity);
  OActionBarUtils.setActionBar(this,true);
  setupDrawer();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.i(TAG,"String_Node_Str");
  mSavedInstanceState=savedInstanceState;
  OPreferenceManager preferenceManager=new OPreferenceManager(this);
  if (!preferenceManager.getBoolean(KEY_FRESH_LOGIN,false)) {
    preferenceManager.setBoolean(KEY_FRESH_LOGIN,true);
    new Handler().postDelayed(new Runnable(){
      @Override public void run(){
        startActivity(new Intent(OdooActivity.this,AppIntro.class));
      }
    }
,1000);
  }
  setContentView(R.layout.odoo_activity);
  OActionBarUtils.setActionBar(this,true);
  setupDrawer();
}
Program: 63790
Project: 63790
Buggy source:
private void settingUpdated(){
  OPreferenceManager mPref=new OPreferenceManager(this);
  int sync_interval=mPref.getInt("String_Node_Str",1440);
  List<String> default_authorities=new ArrayList<>();
  default_authorities.add("String_Node_Str");
  default_authorities.add("String_Node_Str");
  SyncAdapterType[] list=ContentResolver.getSyncAdapterTypes();
  Account mAccount=OUser.current(this).getAccount();
  for (  SyncAdapterType lst : list) {
    if (lst.authority.contains("String_Node_Str") && lst.authority.contains("String_Node_Str")) {
      default_authorities.add(lst.authority);
    }
  }
  for (  String authority : default_authorities) {
    boolean isSyncActive=ContentResolver.getSyncAutomatically(mAccount,authority);
    if (isSyncActive) {
      SyncUtils.get(this).setSyncPeriodic(authority,sync_interval,60,1);
    }
  }
  Toast.makeText(this,OResource.string(this,R.string.toast_setting_saved),Toast.LENGTH_LONG).show();
}

Fixed version (ground truth):
private void settingUpdated(){
  OUser user=OUser.current(this);
  if (user == null) {
    Intent loginActivity=new Intent(this,OdooLogin.class);
    loginActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    startActivity(loginActivity);
    finish();
  }
 else {
    Account mAccount=user.getAccount();
    OPreferenceManager mPref=new OPreferenceManager(this);
    int sync_interval=mPref.getInt("String_Node_Str",1440);
    List<String> default_authorities=new ArrayList<>();
    default_authorities.add("String_Node_Str");
    default_authorities.add("String_Node_Str");
    SyncAdapterType[] list=ContentResolver.getSyncAdapterTypes();
    for (    SyncAdapterType lst : list) {
      if (lst.authority.contains("String_Node_Str") && lst.authority.contains("String_Node_Str")) {
        default_authorities.add(lst.authority);
      }
    }
    for (    String authority : default_authorities) {
      boolean isSyncActive=ContentResolver.getSyncAutomatically(mAccount,authority);
      if (isSyncActive) {
        SyncUtils.get(this).setSyncPeriodic(authority,sync_interval,60,1);
      }
    }
    Toast.makeText(this,OResource.string(this,R.string.toast_setting_saved),Toast.LENGTH_LONG).show();
  }
}
Program: 63791
Project: 63791
Buggy source:
@Override protected void onPostExecute(OUser oUser){
  super.onPostExecute(oUser);
  if (oUser != null) {
    OdooAccountManager.updateUserData(OdooAccountQuickManage.this,user);
    finish();
    Intent intent=new Intent(OdooAccountQuickManage.this,OdooActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getApplicationContext().startActivity(intent);
  }
 else {
    edtPassword.setText("String_Node_Str");
    edtPassword.setError("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(OUser oUser){
  super.onPostExecute(oUser);
  progressDialog.dismiss();
  if (oUser != null) {
    OdooAccountManager.updateUserData(OdooAccountQuickManage.this,user);
    finish();
    Intent intent=new Intent(OdooAccountQuickManage.this,OdooActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getApplicationContext().startActivity(intent);
  }
 else {
    edtPassword.setText("String_Node_Str");
    edtPassword.setError("String_Node_Str");
  }
}
Program: 63792
Project: 63792
Buggy source:
private void removeAccount(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(R.string.title_confirm);
  builder.setMessage(R.string.toast_are_you_sure_delete_account);
  builder.setPositiveButton(R.string.label_delete,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      OdooAccountManager.removeAccount(OdooAccountQuickManage.this,user.getAndroidName());
      IntentUtils.startActivity(OdooAccountQuickManage.this,OdooLogin.class,null);
      finish();
    }
  }
);
  builder.setNegativeButton(R.string.label_cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
      finish();
    }
  }
);
  builder.show();
}

Fixed version (ground truth):
private void removeAccount(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(R.string.title_confirm);
  builder.setMessage(R.string.toast_are_you_sure_delete_account);
  builder.setPositiveButton(R.string.label_delete,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (OdooAccountManager.removeAccount(OdooAccountQuickManage.this,user.getAndroidName())) {
        new Handler().postDelayed(new Runnable(){
          @Override public void run(){
            Intent loginActivity=new Intent(OdooAccountQuickManage.this,OdooLogin.class);
            loginActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            startActivity(loginActivity);
            finish();
          }
        }
,500);
      }
    }
  }
);
  builder.setOnCancelListener(new DialogInterface.OnCancelListener(){
    @Override public void onCancel(    DialogInterface dialog){
      dialog.dismiss();
      finish();
    }
  }
);
  builder.setNegativeButton(R.string.label_cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
      finish();
    }
  }
);
  builder.show();
}
Program: 63793
Project: 63793
Buggy source:
@Override public void onPause(){
  super.onPause();
  if (mSyncObserverHandle != null) {
    ContentResolver.removeStatusChangeListener(mSyncObserverHandle);
    mSyncObserverHandle=null;
  }
  parent().unregisterReceiver(syncFinishReceiver);
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  if (mSyncObserverHandle != null) {
    ContentResolver.removeStatusChangeListener(mSyncObserverHandle);
    mSyncObserverHandle=null;
  }
  try {
    parent().unregisterReceiver(syncFinishReceiver);
  }
 catch (  Exception e) {
  }
}
Program: 63794
Project: 63794
Buggy source:
public Odoo createInstance(){
  Odoo odoo=null;
  OUser user=OUser.current(getApplicationContext());
  if (user != null) {
    try {
      if (user.isOAauthLogin()) {
        odoo=new Odoo(user.getInstanceUrl(),user.isAllowSelfSignedSSL());
        OdooInstance instance=new OdooInstance();
        instance.setInstanceUrl(user.getInstanceUrl());
        instance.setDatabaseName(user.getInstanceDatabase());
        instance.setClientId(user.getClientId());
        odoo.oauth_authenticate(instance,user.getUsername(),user.getPassword());
      }
 else {
        odoo=new Odoo(user.getHost(),user.isAllowSelfSignedSSL());
        odoo.authenticate(user.getUsername(),user.getPassword(),user.getDatabase());
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return odoo;
}

Fixed version (ground truth):
public Odoo createInstance(){
  Odoo odoo=null;
  OUser user=OUser.current(getApplicationContext());
  if (user != null) {
    try {
      if (user.isOAauthLogin()) {
        odoo=new Odoo(user.getInstanceUrl(),user.isAllowSelfSignedSSL());
        OdooInstance instance=new OdooInstance();
        instance.setInstanceUrl(user.getInstanceUrl());
        instance.setDatabaseName(user.getInstanceDatabase());
        instance.setClientId(user.getClientId());
        odoo.oauth_authenticate(instance,user.getUsername(),user.getPassword());
      }
 else {
        odoo=new Odoo(user.getHost(),user.isAllowSelfSignedSSL());
        odoo.authenticate(user.getUsername(),user.getPassword(),user.getDatabase());
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  mOdooInstance=odoo;
  return odoo;
}
Program: 63795
Project: 63795
Buggy source:
/** 
 * Removes the account.
 * @param context the context
 * @param username the username
 */
public static void removeAccount(Context context,String username){
  AccountManager accMgr=AccountManager.get(context);
  accMgr.removeAccount(OpenERPAccountManager.getAccount(context,username),null,null);
  App app=(App)context.getApplicationContext();
  app.setOEInstance(null);
  current_user=null;
}

Fixed version (ground truth):
/** 
 * Removes the account.
 * @param context the context
 * @param username the username 
 */
public static void removeAccount(Context context,String username){
  AccountManager accMgr=AccountManager.get(context);
  accMgr.removeAccount(OpenERPAccountManager.getAccount(context,username),null,null);
  App app=(App)context.getApplicationContext();
  app.setOEInstance(null);
  current_user=null;
}
Program: 63796
Project: 63796
Buggy source:
private static boolean cancelAllSync(Account account){
  SyncWizardValues syncVals=new SyncWizardValues();
  boolean flag=false;
  for (  SyncValue sync : syncVals.syncValues()) {
    ContentResolver.cancelSync(account,sync.getAuthority());
    flag=true;
  }
  return flag;
}

Fixed version (ground truth):
private static boolean cancelAllSync(Account account){
  SyncWizardValues syncVals=new SyncWizardValues();
  for (  SyncValue sync : syncVals.syncValues()) {
    ContentResolver.cancelSync(account,sync.getAuthority());
  }
  return true;
}
Program: 63797
Project: 63797
Buggy source:
private void updateSyncSettings(){
  Log.d(TAG,"String_Node_Str");
  PreferenceManager mPref=new PreferenceManager(mContext);
  int sync_interval=mPref.getInt("String_Node_Str",1440);
  List<String> default_authorities=new ArrayList<String>();
  default_authorities.add("String_Node_Str");
  default_authorities.add("String_Node_Str");
  SyncAdapterType[] list=ContentResolver.getSyncAdapterTypes();
  Account mAccount=OpenERPAccountManager.getAccount(mContext,OEUser.current(mContext).getAndroidName());
  for (  SyncAdapterType lst : list) {
    if (lst.authority.contains("String_Node_Str")) {
      default_authorities.add(lst.authority);
    }
  }
  for (  String authority : default_authorities) {
    boolean isSyncActive=ContentResolver.getSyncAutomatically(mAccount,authority);
    if (isSyncActive) {
      setSyncPeriodic(authority,sync_interval,1,1);
    }
  }
  Toast.makeText(this,R.string.toast_setting_saved,Toast.LENGTH_LONG).show();
}

Fixed version (ground truth):
private void updateSyncSettings(){
  Log.d(TAG,"String_Node_Str");
  PreferenceManager mPref=new PreferenceManager(mContext);
  int sync_interval=mPref.getInt("String_Node_Str",1440);
  List<String> default_authorities=new ArrayList<String>();
  default_authorities.add("String_Node_Str");
  default_authorities.add("String_Node_Str");
  SyncAdapterType[] list=ContentResolver.getSyncAdapterTypes();
  Account mAccount=OpenERPAccountManager.getAccount(mContext,OEUser.current(mContext).getAndroidName());
  for (  SyncAdapterType lst : list) {
    if (lst.authority.contains("String_Node_Str") && lst.authority.contains("String_Node_Str")) {
      default_authorities.add(lst.authority);
    }
  }
  for (  String authority : default_authorities) {
    boolean isSyncActive=ContentResolver.getSyncAutomatically(mAccount,authority);
    if (isSyncActive) {
      setSyncPeriodic(authority,sync_interval,60,1);
    }
  }
  Toast.makeText(this,R.string.toast_setting_saved,Toast.LENGTH_LONG).show();
}
Program: 63798
Project: 63798
Buggy source:
private void initDrawer(List<DrawerItem> drawerItems){
  Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
  Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
  String user_name="String_Node_Str";
  if (obj instanceof Boolean) {
    user_name=OEUser.current(context).getUsername();
  }
 else {
    user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
  }
  mDrawerTitle=user_name;
  mDrawerSubtitle=OEUser.current(context).getHost();
  getActionBar().setHomeButtonEnabled(true);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setDrawerItems(drawerItems);
  if (mDrawerItemSelectedPosition > 0) {
    mAppTitle=mDrawerListItems.get(mDrawerItemSelectedPosition).getTitle();
    setTitle(mAppTitle);
  }
}

Fixed version (ground truth):
private void initDrawer(List<DrawerItem> drawerItems){
  if (OEUser.current(context) != null) {
    Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
    Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
    String user_name="String_Node_Str";
    if (obj instanceof Boolean) {
      user_name=OEUser.current(context).getUsername();
    }
 else {
      user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
    }
    mDrawerTitle=user_name;
    mDrawerSubtitle=OEUser.current(context).getHost();
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setDrawerItems(drawerItems);
    if (mDrawerItemSelectedPosition > 0) {
      mAppTitle=mDrawerListItems.get(mDrawerItemSelectedPosition).getTitle();
      setTitle(mAppTitle);
    }
  }
}
Program: 63799
Project: 63799
Buggy source:
private void initDrawer(List<DrawerItem> drawerItems){
  Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
  Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
  String user_name="String_Node_Str";
  if (obj instanceof Boolean) {
    user_name=OEUser.current(context).getUsername();
  }
 else {
    user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
  }
  mDrawerTitle=user_name;
  mDrawerSubtitle=OEUser.current(context).getHost();
  getActionBar().setHomeButtonEnabled(true);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setDrawerItems(drawerItems);
}

Fixed version (ground truth):
private void initDrawer(List<DrawerItem> drawerItems){
  Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
  Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
  String user_name="String_Node_Str";
  if (obj instanceof Boolean) {
    user_name=OEUser.current(context).getUsername();
  }
 else {
    user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
  }
  mDrawerTitle=user_name;
  mDrawerSubtitle=OEUser.current(context).getHost();
  getActionBar().setHomeButtonEnabled(true);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setDrawerItems(drawerItems);
  if (mDrawerItemSelectedPosition > 0) {
    mAppTitle=mDrawerListItems.get(mDrawerItemSelectedPosition).getTitle();
    setTitle(mAppTitle);
  }
}
Program: 63800
Project: 63800
Buggy source:
@Override public void onStart(){
  super.onStart();
  mDrawerListView.setOnItemClickListener(this);
  int position=-1;
  if (mDrawerListItems.size() > 0) {
    if (!mDrawerListItems.get(0).isGroupTitle()) {
      mDrawerListView.setItemChecked(0,true);
      position=0;
    }
 else {
      mDrawerListView.setItemChecked(1,true);
      position=1;
    }
  }
  if (mDrawerItemSelectedPosition >= 0) {
    position=mDrawerItemSelectedPosition;
  }
  if (getIntent().getAction() != null && !getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,MessageComposeActivty.class));
    }
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,ComposeNoteActivity.class));
    }
  }
 else {
    if (position > 0) {
      loadFragment(mDrawerListItems.get(position));
    }
  }
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  mDrawerListView.setOnItemClickListener(this);
  int position=-1;
  if (mDrawerListItems.size() > 0) {
    if (!mDrawerListItems.get(0).isGroupTitle()) {
      mDrawerListView.setItemChecked(0,true);
      position=0;
    }
 else {
      mDrawerListView.setItemChecked(1,true);
      position=1;
    }
  }
  if (mDrawerItemSelectedPosition >= 0) {
    position=mDrawerItemSelectedPosition;
  }
  if (getIntent().getAction() != null && !getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,MessageComposeActivty.class));
    }
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,ComposeNoteActivity.class));
    }
  }
 else {
    if (position > 0) {
      if (position != mDrawerItemSelectedPosition) {
        loadFragment(mDrawerListItems.get(position));
      }
    }
  }
}
Program: 63802
Project: 63802
Buggy source:
@Override public OEMenu menuHelper(Context context){
  OEMenu menu=new OEMenu();
  menu.setId(1);
  menu.setMenuTitle("String_Node_Str");
  setNoteStages(context);
  List<OEMenuItems> items=new ArrayList<OEMenuItems>();
  items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),getCount("String_Node_Str",context)));
  items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),0));
  if (stages != null) {
    int i=0;
    for (    String key : stages.keySet()) {
      if (i > tag_colors.length - 1) {
        i=0;
      }
      OEMenuItems stageMenu=new OEMenuItems(stages.get(key).toString(),getFragBundle("String_Node_Str",key),getCount(key,context));
      stageMenu.setAutoMenuTagColor(true);
      stageMenu.setMenuTagColor(Color.parseColor(tag_colors[i]));
      stage_colors.put("String_Node_Str" + key,stageMenu.getMenuTagColor());
      items.add(stageMenu);
      i++;
    }
  }
  menu.setMenuItems(items);
  return menu;
}

Fixed version (ground truth):
@Override public OEMenu menuHelper(Context context){
  db=(NoteDBHelper)databaseHelper(context);
  if (db.getOEInstance().isInstalled("String_Node_Str")) {
    OEMenu menu=new OEMenu();
    menu.setId(1);
    menu.setMenuTitle("String_Node_Str");
    setNoteStages(context);
    List<OEMenuItems> items=new ArrayList<OEMenuItems>();
    items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),getCount("String_Node_Str",context)));
    items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),0));
    if (stages != null) {
      int i=0;
      for (      String key : stages.keySet()) {
        if (i > tag_colors.length - 1) {
          i=0;
        }
        OEMenuItems stageMenu=new OEMenuItems(stages.get(key).toString(),getFragBundle("String_Node_Str",key),getCount(key,context));
        stageMenu.setAutoMenuTagColor(true);
        stageMenu.setMenuTagColor(Color.parseColor(tag_colors[i]));
        stage_colors.put("String_Node_Str" + key,stageMenu.getMenuTagColor());
        items.add(stageMenu);
        i++;
      }
    }
    menu.setMenuItems(items);
    return menu;
  }
 else {
    return null;
  }
}
Program: 63803
Project: 63803
Buggy source:
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  setHasOptionsMenu(true);
  scope=new AppScope(MainActivity.userContext,(MainActivity)getActivity());
  db=(NoteDBHelper)getModel();
  rootView=inflater.inflate(R.layout.fragment_note,container,false);
  lstNotes=(ListView)rootView.findViewById(R.id.lstNotes);
  emptyNotesText=(TextView)rootView.findViewById(R.id.txvNoteAllArchive);
  handleArguments((Bundle)getArguments());
  return rootView;
}

Fixed version (ground truth):
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  scope=new AppScope(MainActivity.userContext,(MainActivity)getActivity());
  db=(NoteDBHelper)getModel();
  setHasOptionsMenu(true);
  rootView=inflater.inflate(R.layout.fragment_note,container,false);
  lstNotes=(ListView)rootView.findViewById(R.id.lstNotes);
  emptyNotesText=(TextView)rootView.findViewById(R.id.txvNoteAllArchive);
  handleArguments((Bundle)getArguments());
  return rootView;
}
Program: 63804
Project: 63804
Buggy source:
/** 
 * Load base modules.
 */
private void loadBaseModules(){
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new ResFragment(),0));
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new AttachmentFragment(),0));
}

Fixed version (ground truth):
/** 
 * Load base modules.
 */
private void loadBaseModules(){
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new ResFragment(),0));
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new AttachmentFragment(),0));
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new Ir_modelFragment(),0));
}
Program: 63806
Project: 63806
Buggy source:
@Override public void run(){
  int currentItem=((MainActivity2)getActivity()).mViewPager.getCurrentItem();
  if (currentItem == sectionNumber) {
    mFloatingMenu.show(false);
  }
}

Fixed version (ground truth):
@Override public void run(){
  int currentItem=((MainActivity2)getActivity()).mViewPager.getCurrentItem();
  if (currentItem == sectionNumber) {
    mFloatingMenu.show(true,true);
  }
}
Program: 63807
Project: 63807
Buggy source:
@Override public void onViewCreated(final View view,final Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  Log.i(TAG,"String_Node_Str" + sectionNumber);
  initFloatingMenu(sectionNumber,savedInstanceState);
  if (null != mFloatingMenu) {
    view.postDelayed(new Runnable(){
      @Override public void run(){
        int currentItem=((MainActivity2)getActivity()).mViewPager.getCurrentItem();
        if (currentItem == sectionNumber) {
          mFloatingMenu.show(false);
        }
      }
    }
,20);
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(final View view,final Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  Log.i(TAG,"String_Node_Str" + sectionNumber);
  initFloatingMenu(sectionNumber,savedInstanceState);
  if (null != mFloatingMenu) {
    view.postDelayed(new Runnable(){
      @Override public void run(){
        int currentItem=((MainActivity2)getActivity()).mViewPager.getCurrentItem();
        if (currentItem == sectionNumber) {
          mFloatingMenu.show(true,true);
        }
      }
    }
,100);
  }
}
Program: 63808
Project: 63808
Buggy source:
public static void setTypeface(Context ctx,AttributeSet attrs,TextView view){
  TypedArray a=ctx.obtainStyledAttributes(attrs,R.styleable.MagicTextView);
  String fontStyle=a.getString(R.styleable.MagicTextView_typeFace);
  view.setTypeface(MagicViews.getTypeface(ctx,fontStyle));
  a.recycle();
}

Fixed version (ground truth):
public static void setTypeface(Context ctx,AttributeSet attrs,TextView view){
  TypedArray a=ctx.obtainStyledAttributes(attrs,R.styleable.MagicTextView);
  String fontStyle=a.getString(R.styleable.MagicTextView_typeFace);
  if (fontStyle != null) {
    view.setTypeface(MagicViews.getTypeface(ctx,fontStyle));
  }
  a.recycle();
}
Program: 63809
Project: 63809
Buggy source:
@Override public void computeScroll(){
  if (mDragHelper.continueSettling(true)) {
    if (!mCanSlide) {
      mDragHelper.abort();
      return;
    }
    ViewCompat.postInvalidateOnAnimation(this);
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mDragHelper != null && mDragHelper.continueSettling(true)) {
    if (!mCanSlide) {
      mDragHelper.abort();
      return;
    }
    ViewCompat.postInvalidateOnAnimation(this);
  }
}
Program: 63810
Project: 63810
Buggy source:
public final int read(ByteBuffer dst) throws IOException {
  int available=this.buf.remaining();
  int size=dst.remaining();
  ByteBuffer slice=this.buf.slice();
  slice.limit(size);
  dst.put(slice);
  this.buf.position(this.buf.position() + size);
  return size;
}

Fixed version (ground truth):
public final int read(ByteBuffer dst) throws IOException {
  int available=this.buf.remaining();
  int size=java.lang.Math.min(dst.remaining(),available);
  ByteBuffer slice=this.buf.slice();
  slice.limit(size);
  dst.put(slice);
  this.buf.position(this.buf.position() + size);
  return size;
}
Program: 63813
Project: 63813
Buggy source:
public static void writeAddressBook() throws java.io.IOException {
  MessageBuilder message=new MessageBuilder();
  AddressBook.Builder addressbook=message.initRoot(AddressBook.factory);
  StructList.Builder<Person.Builder> people=addressbook.initPeople(2);
  Person.Builder alice=people.get(0);
  alice.setId(123);
  alice.setName(new Text.Reader("String_Node_Str"));
  alice.setEmail(new Text.Reader("String_Node_Str"));
  StructList.Builder<Person.PhoneNumber.Builder> alicePhones=alice.initPhones(1);
  alicePhones.get(0).setNumber(new Text.Reader("String_Node_Str"));
  alicePhones.get(0).setType(Person.PhoneNumber.Type.MOBILE);
  alice.getEmployment().setSchool(new Text.Reader("String_Node_Str"));
  Person.Builder bob=people.get(1);
  bob.setId(456);
  bob.setName(new Text.Reader("String_Node_Str"));
  bob.setEmail(new Text.Reader("String_Node_Str"));
  StructList.Builder<Person.PhoneNumber.Builder> bobPhones=bob.initPhones(2);
  bobPhones.get(0).setNumber(new Text.Reader("String_Node_Str"));
  bobPhones.get(0).setType(Person.PhoneNumber.Type.HOME);
  bobPhones.get(1).setNumber(new Text.Reader("String_Node_Str"));
  bobPhones.get(1).setType(Person.PhoneNumber.Type.WORK);
  bob.getEmployment().setUnemployed(org.capnproto.Void.VOID);
  Serialize.writeMessage((new FileOutputStream(FileDescriptor.out)).getChannel(),message);
}

Fixed version (ground truth):
public static void writeAddressBook() throws java.io.IOException {
  MessageBuilder message=new MessageBuilder();
  AddressBook.Builder addressbook=message.initRoot(AddressBook.factory);
  StructList.Builder<Person.Builder> people=addressbook.initPeople(2);
  Person.Builder alice=people.get(0);
  alice.setId(123);
  alice.setName(new Text.Reader("String_Node_Str"));
  alice.setEmail(new Text.Reader("String_Node_Str"));
  StructList.Builder<Person.PhoneNumber.Builder> alicePhones=alice.initPhones(1);
  alicePhones.get(0).setNumber(new Text.Reader("String_Node_Str"));
  alicePhones.get(0).setType(Person.PhoneNumber.Type.MOBILE);
  alice.getEmployment().setSchool(new Text.Reader("String_Node_Str"));
  Person.Builder bob=people.get(1);
  bob.setId(456);
  bob.setName(new Text.Reader("String_Node_Str"));
  bob.setEmail(new Text.Reader("String_Node_Str"));
  StructList.Builder<Person.PhoneNumber.Builder> bobPhones=bob.initPhones(2);
  bobPhones.get(0).setNumber(new Text.Reader("String_Node_Str"));
  bobPhones.get(0).setType(Person.PhoneNumber.Type.HOME);
  bobPhones.get(1).setNumber(new Text.Reader("String_Node_Str"));
  bobPhones.get(1).setType(Person.PhoneNumber.Type.WORK);
  bob.getEmployment().setUnemployed(org.capnproto.Void.VOID);
  SerializePacked.writeMessageUnbuffered((new FileOutputStream(FileDescriptor.out)).getChannel(),message);
}
Program: 63815
Project: 63815
Buggy source:
public final int read(ByteBuffer dst) throws IOException {
  int numBytes=dst.remaining();
  if (numBytes < this.buf.remaining()) {
    ByteBuffer slice=this.buf.slice();
    slice.limit(numBytes);
    dst.put(slice);
    this.buf.position(this.buf.position() + numBytes);
    return numBytes;
  }
 else {
    int fromFirstBuffer=this.buf.remaining();
{
      ByteBuffer slice=this.buf.slice();
      slice.limit(fromFirstBuffer);
      dst.put(slice);
    }
    numBytes-=fromFirstBuffer;
    if (numBytes <= this.buf.capacity()) {
      this.buf.clear();
      int n=readAtLeast(this.inner,this.buf,numBytes);
      this.buf.rewind();
      ByteBuffer slice=this.buf.slice();
      slice.limit(numBytes);
      dst.put(slice);
      this.buf.limit(n);
      this.buf.position(numBytes);
      return fromFirstBuffer + numBytes;
    }
 else {
      this.buf.clear();
      return fromFirstBuffer + readAtLeast(this.inner,dst,numBytes);
    }
  }
}

Fixed version (ground truth):
public final int read(ByteBuffer dst) throws IOException {
  int numBytes=dst.remaining();
  if (numBytes < this.buf.remaining()) {
    ByteBuffer slice=this.buf.slice();
    slice.limit(numBytes);
    dst.put(slice);
    this.buf.position(this.buf.position() + numBytes);
    return numBytes;
  }
 else {
    int fromFirstBuffer=this.buf.remaining();
{
      ByteBuffer slice=this.buf.slice();
      slice.limit(fromFirstBuffer);
      dst.put(slice);
    }
    numBytes-=fromFirstBuffer;
    if (numBytes <= this.buf.capacity()) {
      this.buf.clear();
      int n=readAtLeast(this.inner,this.buf,numBytes);
      this.buf.rewind();
      ByteBuffer slice=this.buf.slice();
      slice.limit(numBytes);
      dst.put(slice);
      this.buf.limit(n);
      this.buf.position(numBytes);
      return fromFirstBuffer + numBytes;
    }
 else {
      this.buf.clear();
      this.buf.limit(0);
      return fromFirstBuffer + readAtLeast(this.inner,dst,numBytes);
    }
  }
}
Program: 63816
Project: 63816
Buggy source:
public static MessageReader create(InputStream is) throws IOException {
  ByteBuffer firstWord=makeByteBuffer(readExact(is,8));
  int segmentCount=1 + firstWord.getInt(0);
  int segment0Size=0;
  if (segmentCount > 0) {
    segment0Size=firstWord.getInt(4);
  }
  int totalWords=segment0Size;
  if (segmentCount > 512) {
    throw new IOException("String_Node_Str");
  }
  Vector<Integer> moreSizes=new Vector<Integer>();
  if (segmentCount > 1) {
    ByteBuffer moreSizesRaw=makeByteBuffer(readExact(is,4 * (segmentCount & ~1)));
    for (int ii=0; ii < segmentCount - 1; ++ii) {
      int size=moreSizesRaw.getInt(ii * 4);
      moreSizes.add(size);
      totalWords+=size;
    }
  }
  byte[] allSegments=readExact(is,totalWords * 8);
  ByteBuffer[] segmentSlices=new ByteBuffer[segmentCount];
  segmentSlices[0]=ByteBuffer.wrap(allSegments,0,segment0Size);
  int offset=segment0Size;
  for (int ii=1; ii < segmentCount; ++ii) {
    segmentSlices[ii]=ByteBuffer.wrap(allSegments,offset,moreSizes.get(ii - 1));
    offset+=moreSizes.get(ii - 1);
  }
  return new MessageReader(segmentSlices);
}

Fixed version (ground truth):
public static MessageReader create(InputStream is) throws IOException {
  ByteBuffer firstWord=makeByteBuffer(readExact(is,8));
  int segmentCount=1 + firstWord.getInt(0);
  int segment0Size=0;
  if (segmentCount > 0) {
    segment0Size=firstWord.getInt(4);
  }
  int totalWords=segment0Size;
  if (segmentCount > 512) {
    throw new IOException("String_Node_Str");
  }
  Vector<Integer> moreSizes=new Vector<Integer>();
  if (segmentCount > 1) {
    ByteBuffer moreSizesRaw=makeByteBuffer(readExact(is,4 * (segmentCount & ~1)));
    for (int ii=0; ii < segmentCount - 1; ++ii) {
      int size=moreSizesRaw.getInt(ii * 4);
      moreSizes.add(size);
      totalWords+=size;
    }
  }
  byte[] allSegments=readExact(is,totalWords * 8);
  ByteBuffer[] segmentSlices=new ByteBuffer[segmentCount];
  segmentSlices[0]=ByteBuffer.wrap(allSegments,0,segment0Size);
  segmentSlices[0].order(ByteOrder.LITTLE_ENDIAN);
  int offset=segment0Size;
  for (int ii=1; ii < segmentCount; ++ii) {
    segmentSlices[ii]=ByteBuffer.wrap(allSegments,offset,moreSizes.get(ii - 1));
    segmentSlices[ii].order(ByteOrder.LITTLE_ENDIAN);
    offset+=moreSizes.get(ii - 1);
  }
  return new MessageReader(segmentSlices);
}
Program: 63817
Project: 63817
Buggy source:
public PointerReader getPointerField(int ptrIndex){
  if (ptrIndex < this.pointerCount) {
    return new PointerReader(this.segment,this.pointers + ptrIndex,this.nestingLimit);
  }
 else {
    System.out.println("String_Node_Str" + this.pointerCount);
    return new PointerReader();
  }
}

Fixed version (ground truth):
public PointerReader getPointerField(int ptrIndex){
  if (ptrIndex < this.pointerCount) {
    return new PointerReader(this.segment,this.pointers + ptrIndex,this.nestingLimit);
  }
 else {
    return new PointerReader();
  }
}
Program: 63818
Project: 63818
Buggy source:
public static StructReader readStructPointer(SegmentReader segment,WirePointer ref,int nestingLimit){
  WordPointer ptr=ref.target();
  StructPointer structPtr=new StructPointer(ref);
  int dataSizeWords=structPtr.dataSize();
  return new StructReader(segment,ptr.offset * 8,(ptr.offset + dataSizeWords) * 8,dataSizeWords * 64,structPtr.ptrCount(),(byte)0,nestingLimit - 1);
}

Fixed version (ground truth):
public static StructReader readStructPointer(SegmentReader segment,WirePointer ref,int nestingLimit){
  WordPointer ptr=ref.target();
  StructPointer structPtr=new StructPointer(ref);
  int dataSizeWords=structPtr.dataSize();
  return new StructReader(segment,ptr.offset * 8,(ptr.offset + dataSizeWords),dataSizeWords * 64,structPtr.ptrCount(),(byte)0,nestingLimit - 1);
}