nus-yam/ex-repair huggingface dataset:
Program: 8033
Project: 8033
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8034
Project: 8034
Buggy source:
@Override protected void onHandleIntent(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void onHandleIntent(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8035
Project: 8035
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8036
Project: 8036
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8037
Project: 8037
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8038
Project: 8038
Buggy source:
@Override public void onAttach(Activity host){
  super.onAttach(host);
  router=MediaRouter.getInstance(host);
  router.addProvider(new DemoRouteProvider(getActivity()));
}

Fixed version (ground truth):
@Override public void onAttach(Activity host){
  super.onAttach(host);
  router=MediaRouter.getInstance(host);
  provider=new DemoRouteProvider(getActivity());
  router.addProvider(provider);
}
Program: 8039
Project: 8039
Buggy source:
@Override public void run(){
  super.run();
  client.release();
  client=null;
  getActivity().supportInvalidateOptionsMenu();
  logToTranscript(getActivity().getString(R.string.session_ended));
}

Fixed version (ground truth):
@Override public void run(){
  super.run();
  client.release();
  client=null;
  if (getActivity() != null) {
    getActivity().supportInvalidateOptionsMenu();
    logToTranscript(getActivity().getString(R.string.session_ended));
  }
}
Program: 8040
Project: 8040
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setRetainInstance(true);
  if (model == null) {
    model=new ArrayList<String>();
    new AddStringTask().execute();
  }
  adapter=new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,model);
  getListView().setScrollbarFadingEnabled(false);
  setListAdapter(adapter);
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setRetainInstance(true);
  if (model == null) {
    model=new ArrayList<String>();
    task=new AddStringTask();
    task.execute();
  }
  adapter=new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,model);
  getListView().setScrollbarFadingEnabled(false);
  setListAdapter(adapter);
}
Program: 8041
Project: 8041
Buggy source:
@Override protected Void doInBackground(Void... unused){
  for (  String item : items) {
    publishProgress(item);
    SystemClock.sleep(400);
  }
  return (null);
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... unused){
  for (  String item : items) {
    if (!isCancelled()) {
      publishProgress(item);
      SystemClock.sleep(400);
    }
  }
  return (null);
}
Program: 8042
Project: 8042
Buggy source:
@Override protected void onPostExecute(Void unused){
  Toast.makeText(getActivity(),R.string.done,Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
@Override protected void onPostExecute(Void unused){
  if (!isCancelled()) {
    Toast.makeText(getActivity(),R.string.done,Toast.LENGTH_SHORT).show();
  }
  task=null;
}
Program: 8043
Project: 8043
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  if (getFragmentManager().findFragmentById(R.id.content) == null) {
    showLorem();
  }
  getFragmentManager().addOnBackStackChangedListener(this);
  drawer=(ListView)findViewById(R.id.drawer);
  drawer.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  String[] rows=getResources().getStringArray(R.array.drawer_rows);
  drawer.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_row,rows));
  if (savedInstanceState == null) {
    drawer.setItemChecked(0,true);
  }
  drawer.setOnItemClickListener(this);
  drawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  toggle=new ActionBarDrawerToggle(this,drawerLayout,R.drawable.ic_drawer,R.string.drawer_open,R.string.drawer_close);
  drawerLayout.setDrawerListener(toggle);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  getActionBar().setHomeButtonEnabled(true);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  drawer=(ListView)findViewById(R.id.drawer);
  drawer.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  String[] rows=getResources().getStringArray(R.array.drawer_rows);
  drawer.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_row,rows));
  drawer.setOnItemClickListener(this);
  drawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  toggle=new ActionBarDrawerToggle(this,drawerLayout,R.drawable.ic_drawer,R.string.drawer_open,R.string.drawer_close);
  drawerLayout.setDrawerListener(toggle);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  getActionBar().setHomeButtonEnabled(true);
  getFragmentManager().addOnBackStackChangedListener(this);
  if (getFragmentManager().findFragmentById(R.id.content) == null) {
    showLorem();
  }
}
Program: 8044
Project: 8044
Buggy source:
@Override public void wordClicked(){
  int toClear=drawer.getCheckedItemPosition();
  if (toClear >= 0) {
    drawer.setItemChecked(toClear,false);
  }
  if (stuff == null) {
    stuff=new StuffFragment();
  }
  getFragmentManager().beginTransaction().replace(R.id.content,stuff).addToBackStack(null).commit();
}

Fixed version (ground truth):
@Override public void wordClicked(){
  if (stuff == null) {
    stuff=new StuffFragment();
  }
  getFragmentManager().beginTransaction().replace(R.id.content,stuff).addToBackStack(null).commit();
  drawer.post(onNavChange);
}
Program: 8045
Project: 8045
Buggy source:
private void showLorem(){
  if (lorem == null) {
    lorem=new LoremFragment();
  }
  if (!lorem.isVisible()) {
    getFragmentManager().popBackStack();
    getFragmentManager().beginTransaction().replace(R.id.content,lorem).commit();
  }
}

Fixed version (ground truth):
private void showLorem(){
  if (lorem == null) {
    lorem=new LoremFragment();
  }
  if (!lorem.isVisible()) {
    getFragmentManager().popBackStack();
    getFragmentManager().beginTransaction().replace(R.id.content,lorem).commit();
    drawer.post(onNavChange);
  }
}
Program: 8046
Project: 8046
Buggy source:
private void showContent(){
  if (content == null) {
    content=new ContentFragment();
  }
  if (!content.isVisible()) {
    getFragmentManager().popBackStack();
    getFragmentManager().beginTransaction().replace(R.id.content,content).commit();
  }
}

Fixed version (ground truth):
private void showContent(){
  if (content == null) {
    content=new ContentFragment();
  }
  if (!content.isVisible()) {
    getFragmentManager().popBackStack();
    getFragmentManager().beginTransaction().replace(R.id.content,content).commit();
    drawer.post(onNavChange);
  }
}
Program: 8047
Project: 8047
Buggy source:
@Override public void onBackStackChanged(){
  if (lorem.isVisible()) {
    drawer.setItemChecked(0,true);
  }
 else   if (content != null && content.isVisible()) {
    drawer.setItemChecked(1,true);
  }
}

Fixed version (ground truth):
@Override public void onBackStackChanged(){
  drawer.post(onNavChange);
}
Program: 8048
Project: 8048
Buggy source:
@Override public void onSaveInstanceState(Bundle state){
  super.onSaveInstanceState(state);
  state.putCharSequence(STATE_QUERY,sv.getQuery());
  state.putStringArrayList(STATE_MODEL,words);
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle state){
  super.onSaveInstanceState(state);
  if (!sv.isIconified()) {
    state.putCharSequence(STATE_QUERY,sv.getQuery());
  }
  state.putStringArrayList(STATE_MODEL,words);
}
Program: 8049
Project: 8049
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.passphrase_setup);
  SQLiteDatabase.loadLibs(this);
  dbState=DatabaseHelper.getDatabaseState(AuthActivity.this);
  passphrase=(EditText)findViewById(R.id.passphrase);
  confirm=(EditText)findViewById(R.id.confirm);
  passphrase.addTextChangedListener(this);
  confirm.addTextChangedListener(this);
  if (dbState == State.ENCRYPTED) {
    confirm.setVisibility(View.GONE);
  }
  CompoundButton cb=(CompoundButton)findViewById(R.id.show_passphrase);
  cb.setOnCheckedChangeListener(this);
  ok=findViewById(R.id.ok);
  ok.setOnClickListener(this);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.passphrase_setup);
  SQLiteDatabase.loadLibs(this);
  if (DatabaseHelper.getDatabase() != null) {
    startActivity(new Intent(this,MainActivity.class));
    finish();
  }
  dbState=DatabaseHelper.getDatabaseState(AuthActivity.this);
  passphrase=(EditText)findViewById(R.id.passphrase);
  confirm=(EditText)findViewById(R.id.confirm);
  passphrase.addTextChangedListener(this);
  confirm.addTextChangedListener(this);
  if (dbState == State.ENCRYPTED) {
    confirm.setVisibility(View.GONE);
  }
  CompoundButton cb=(CompoundButton)findViewById(R.id.show_passphrase);
  cb.setOnCheckedChangeListener(this);
  ok=findViewById(R.id.ok);
  ok.setOnClickListener(this);
}
Program: 8050
Project: 8050
Buggy source:
@Override protected void onRestoreInstanceState(Bundle state){
  String contactUri=state.getString("String_Node_Str");
  if (contactUri != null) {
    contact=Uri.parse(contactUri);
    viewButton.setEnabled(true);
  }
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Bundle state){
  super.onRestoreInstanceState(state);
  String contactUri=state.getString("String_Node_Str");
  if (contactUri != null) {
    contact=Uri.parse(contactUri);
    viewButton.setEnabled(true);
  }
}
Program: 8051
Project: 8051
Buggy source:
public void save(View v){
  Intent shortcut=new Intent(Intent.ACTION_SEND);
  TextView addr=(TextView)findViewById(R.id.addr);
  TextView subject=(TextView)findViewById(R.id.subject);
  TextView body=(TextView)findViewById(R.id.body);
  TextView name=(TextView)findViewById(R.id.name);
  if (!TextUtils.isEmpty(addr.getText())) {
    shortcut.putExtra(Intent.EXTRA_EMAIL,addr.getText().toString());
  }
  if (!TextUtils.isEmpty(subject.getText())) {
    shortcut.putExtra(Intent.EXTRA_SUBJECT,subject.getText().toString());
  }
  if (!TextUtils.isEmpty(body.getText())) {
    shortcut.putExtra(Intent.EXTRA_TEXT,body.getText().toString());
  }
  shortcut.setType("String_Node_Str");
  Intent result=new Intent();
  result.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcut);
  result.putExtra(Intent.EXTRA_SHORTCUT_NAME,name.getText().toString());
  result.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(this,R.drawable.icon));
  setResult(RESULT_OK,result);
  finish();
}

Fixed version (ground truth):
public void save(View v){
  Intent shortcut=new Intent(Intent.ACTION_SEND);
  TextView addr=(TextView)findViewById(R.id.addr);
  TextView subject=(TextView)findViewById(R.id.subject);
  TextView body=(TextView)findViewById(R.id.body);
  TextView name=(TextView)findViewById(R.id.name);
  if (!TextUtils.isEmpty(addr.getText())) {
    shortcut.putExtra(Intent.EXTRA_EMAIL,new String[]{addr.getText().toString()});
  }
  if (!TextUtils.isEmpty(subject.getText())) {
    shortcut.putExtra(Intent.EXTRA_SUBJECT,subject.getText().toString());
  }
  if (!TextUtils.isEmpty(body.getText())) {
    shortcut.putExtra(Intent.EXTRA_TEXT,body.getText().toString());
  }
  shortcut.setType("String_Node_Str");
  Intent result=new Intent();
  result.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcut);
  result.putExtra(Intent.EXTRA_SHORTCUT_NAME,name.getText().toString());
  result.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(this,R.drawable.icon));
  setResult(RESULT_OK,result);
  finish();
}
Program: 8052
Project: 8052
Buggy source:
private File getTarget(){
  File root=null;
  if (external.isChecked()) {
    root=getActivity().getExternalFilesDir(null);
  }
 else {
    root=getActivity().getFilesDir();
  }
  return (new File(root,FILENAME));
}

Fixed version (ground truth):
private File getTarget(){
  File root=null;
  if (external != null && external.isChecked()) {
    root=getActivity().getExternalFilesDir(null);
  }
 else {
    root=getActivity().getFilesDir();
  }
  return (new File(root,FILENAME));
}
Program: 8053
Project: 8053
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  root=(ThreePaneLayout)findViewById(R.id.root);
  if (getFragmentManager().findFragmentById(R.id.left) == null) {
    getFragmentManager().beginTransaction().add(R.id.left,SimpleListFragment.newInstance(items)).commit();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  root=(ThreePaneLayout)findViewById(R.id.root);
  if (getFragmentManager().findFragmentById(R.id.left) == null) {
    getFragmentManager().beginTransaction().add(R.id.left,SimpleListFragment.newInstance(items)).commit();
  }
  middleFragment=(SimpleListFragment)getFragmentManager().findFragmentById(R.id.middle);
}
Program: 8054
Project: 8054
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  root=(ThreePaneLayout)findViewById(R.id.root);
  if (getSupportFragmentManager().findFragmentById(R.id.left) == null) {
    getSupportFragmentManager().beginTransaction().add(R.id.left,SimpleListFragment.newInstance(items)).commit();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  root=(ThreePaneLayout)findViewById(R.id.root);
  if (getSupportFragmentManager().findFragmentById(R.id.left) == null) {
    getSupportFragmentManager().beginTransaction().add(R.id.left,SimpleListFragment.newInstance(items)).commit();
  }
  middleFragment=(SimpleListFragment)getSupportFragmentManager().findFragmentById(R.id.middle);
}
Program: 8055
Project: 8055
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  root=findViewById(android.R.id.content);
}
Program: 8056
Project: 8056
Buggy source:
@Override public void onResume(){
  super.onResume();
  root=findViewById(android.R.id.content);
  everyFiveSeconds.run();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  everyFiveSeconds.run();
}
Program: 8057
Project: 8057
Buggy source:
void onListItemClick(SimpleListFragment fragment,int position){
  if (fragment == middleFragment) {
    ((Button)root.getRightView()).setText(middleContents.get(position));
    root.hideLeft();
    isLeftShowing=false;
  }
 else {
    middleContents=new ArrayList<String>();
    for (int i=0; i < 20; i++) {
      middleContents.add(items[position] + "String_Node_Str" + i);
    }
    if (getFragmentManager().findFragmentById(R.id.middle) == null) {
      middleFragment=SimpleListFragment.newInstance(middleContents);
      getFragmentManager().beginTransaction().add(R.id.middle,middleFragment).commit();
    }
 else {
      middleFragment.setContents(middleContents);
    }
  }
}

Fixed version (ground truth):
void onListItemClick(SimpleListFragment fragment,int position){
  if (fragment == middleFragment) {
    ((Button)root.getRightView()).setText(middleContents.get(position));
    if (isLeftShowing) {
      root.hideLeft();
      isLeftShowing=false;
    }
  }
 else {
    middleContents=new ArrayList<String>();
    for (int i=0; i < 20; i++) {
      middleContents.add(items[position] + "String_Node_Str" + i);
    }
    if (getFragmentManager().findFragmentById(R.id.middle) == null) {
      middleFragment=SimpleListFragment.newInstance(middleContents);
      getFragmentManager().beginTransaction().add(R.id.middle,middleFragment).commit();
    }
 else {
      middleFragment.setContents(middleContents);
    }
  }
}
Program: 8058
Project: 8058
Buggy source:
void onListItemClick(SimpleListFragment fragment,int position){
  if (fragment == middleFragment) {
    ((Button)root.getRightView()).setText(middleContents.get(position));
    root.hideLeft();
    isLeftShowing=false;
  }
 else {
    middleContents=new ArrayList<String>();
    for (int i=0; i < 20; i++) {
      middleContents.add(items[position] + "String_Node_Str" + i);
    }
    if (getSupportFragmentManager().findFragmentById(R.id.middle) == null) {
      middleFragment=SimpleListFragment.newInstance(middleContents);
      getSupportFragmentManager().beginTransaction().add(R.id.middle,middleFragment).commit();
    }
 else {
      middleFragment.setContents(middleContents);
    }
  }
}

Fixed version (ground truth):
void onListItemClick(SimpleListFragment fragment,int position){
  if (fragment == middleFragment) {
    ((Button)root.getRightView()).setText(middleContents.get(position));
    if (isLeftShowing) {
      root.hideLeft();
      isLeftShowing=false;
    }
  }
 else {
    middleContents=new ArrayList<String>();
    for (int i=0; i < 20; i++) {
      middleContents.add(items[position] + "String_Node_Str" + i);
    }
    if (getSupportFragmentManager().findFragmentById(R.id.middle) == null) {
      middleFragment=SimpleListFragment.newInstance(middleContents);
      getSupportFragmentManager().beginTransaction().add(R.id.middle,middleFragment).commit();
    }
 else {
      middleFragment.setContents(middleContents);
    }
  }
}
Program: 8059
Project: 8059
Buggy source:
@Override public void onReceive(Context ctxt,Intent i){
  File update=new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),DownloadCheckService.UPDATE_FILENAME);
  if (update.exists()) {
    ctxt.startService(new Intent(ctxt,DownloadInstallService.class));
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context ctxt,Intent i){
  File update=new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),DownloadCheckService.UPDATE_FILENAME);
  if (update.exists()) {
    WakefulIntentService.sendWakefulWork(ctxt,DownloadInstallService.class);
  }
}
Program: 8060
Project: 8060
Buggy source:
@Override public void onReceive(Context ctxt,Intent i){
  File update=new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),DownloadCheckService.UPDATE_FILENAME);
  if (update.exists()) {
    ctxt.startService(new Intent(ctxt,DownloadInstallService.class));
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context ctxt,Intent i){
  File update=new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),DownloadCheckService.UPDATE_FILENAME);
  if (update.exists()) {
    WakefulIntentService.sendWakefulWork(ctxt,DownloadInstallService.class);
  }
}
Program: 8061
Project: 8061
Buggy source:
@Override public void onCountrySelected(Country c){
  String url=getString(c.url);
  if (details != null) {
    details.loadUrl(url);
  }
 else {
    Intent i=new Intent(this,DetailsActivity.class);
    i.putExtra(DetailsActivity.EXTRA_URL,url);
    startActivity(i);
  }
}

Fixed version (ground truth):
@Override public void onCountrySelected(Country c){
  String url=getString(c.url);
  if (details != null && details.isVisible()) {
    details.loadUrl(url);
  }
 else {
    Intent i=new Intent(this,DetailsActivity.class);
    i.putExtra(DetailsActivity.EXTRA_URL,url);
    startActivity(i);
  }
}
Program: 8062
Project: 8062
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (details != null) {
    countries.enablePersistentSelection();
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  countries.setPersistentSelection(details != null && details.isVisible());
}
Program: 8063
Project: 8063
Buggy source:
@Override public void onTabUnselected(android.app.ActionBar.Tab tab,android.app.FragmentTransaction ft){
  mTabListener.onTabUnselected(this,ft != null ? getActiveTransaction() : null);
}

Fixed version (ground truth):
@Override public void onTabUnselected(android.app.ActionBar.Tab tab,android.app.FragmentTransaction ft){
  mTabListener.onTabUnselected(this,ft != null ? getActiveTransaction() : null);
  commitActiveTransaction();
}
Program: 8064
Project: 8064
Buggy source:
@Override public void onDestroyActionMode(ActionMode mode){
  mWrapped.onDestroyActionMode(mode);
  mChoiceActionMode=null;
  clearChoices();
  updateOnScreenCheckedViews();
  setLongClickable(true);
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onDestroyActionMode(ActionMode mode){
  mWrapped.onDestroyActionMode(mode);
  mChoiceActionMode=null;
  clearChoices();
  updateOnScreenCheckedViews();
  setLongClickable(true);
}
Program: 8065
Project: 8065
Buggy source:
@SuppressLint("String_Node_Str") public GridView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (context instanceof Activity) {
    setActivity((Activity)context);
  }
  if (HoloEverywhere.DISABLE_OVERSCROLL_EFFECT && VERSION.SDK_INT >= 9) {
    setOverScrollMode(OVER_SCROLL_NEVER);
  }
  mOnItemLongClickListenerWrapper=new OnItemLongClickListenerWrapper();
  super.setOnItemLongClickListener(mOnItemLongClickListenerWrapper);
  setLongClickable(false);
  if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
    super.setFastScrollAlwaysVisible(false);
  }
  super.setFastScrollEnabled(false);
  super.setChoiceMode(CHOICE_MODE_NONE);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.AbsListView,defStyle,R.style.Holo_ListView);
  setFastScrollEnabled(a.getBoolean(R.styleable.AbsListView_android_fastScrollEnabled,false));
  setFastScrollAlwaysVisible(a.getBoolean(R.styleable.AbsListView_android_fastScrollAlwaysVisible,false));
  setChoiceMode(a.getInt(R.styleable.AbsListView_android_choiceMode,CHOICE_MODE_NONE));
  a.recycle();
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") public GridView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (context instanceof Activity) {
    setActivity((Activity)context);
  }
  if (HoloEverywhere.DISABLE_OVERSCROLL_EFFECT && VERSION.SDK_INT >= 9) {
    setOverScrollMode(OVER_SCROLL_NEVER);
  }
  mOnItemLongClickListenerWrapper=new OnItemLongClickListenerWrapper();
  super.setOnItemLongClickListener(mOnItemLongClickListenerWrapper);
  setLongClickable(false);
  if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
    super.setFastScrollAlwaysVisible(false);
    super.setChoiceMode(CHOICE_MODE_NONE);
  }
  super.setFastScrollEnabled(false);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.AbsListView,defStyle,R.style.Holo_ListView);
  setFastScrollEnabled(a.getBoolean(R.styleable.AbsListView_android_fastScrollEnabled,false));
  setFastScrollAlwaysVisible(a.getBoolean(R.styleable.AbsListView_android_fastScrollAlwaysVisible,false));
  setChoiceMode(a.getInt(R.styleable.AbsListView_android_choiceMode,CHOICE_MODE_NONE));
  a.recycle();
}
Program: 8066
Project: 8066
Buggy source:
@SuppressWarnings("String_Node_Str") public static final <T extends DialogFragment>T findInstance(Activity activity,Class<T> clazz,boolean makeIfNeed){
  if (activity == null || clazz == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FragmentManager ft=activity.getSupportFragmentManager();
  T fragment;
  final String tag=makeTag(clazz);
  try {
    fragment=(T)ft.findFragmentByTag(tag);
    if (fragment == null && makeIfNeed) {
      fragment=Fragment.instantiate(clazz);
      ft.putFragment(fragment.getArguments(),tag,fragment);
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  return fragment;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static final <T extends DialogFragment>T findInstance(FragmentManager fm,Class<T> clazz,boolean makeIfNeed){
  T fragment;
  final String tag=makeTag(clazz);
  try {
    fragment=(T)fm.findFragmentByTag(tag);
    if (fragment == null && makeIfNeed) {
      fragment=Fragment.instantiate(clazz);
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  return fragment;
}
Program: 8067
Project: 8067
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  mEventManager.fire(new OnCreateEvent(savedInstanceState));
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  RoboGuice.getInjector(getFragment().getActivity()).injectMembersWithoutViews(getFragment());
}
Program: 8069
Project: 8069
Buggy source:
@Override public void setFactory(Factory factory){
  if (factorySet) {
    throw new IllegalStateException("String_Node_Str");
  }
  addFactory(factory);
  factorySet=true;
}

Fixed version (ground truth):
@Override public void setFactory(Factory factory){
  if (factorySet) {
    throw new IllegalStateException("String_Node_Str");
  }
  addFactory(factory,0);
  factorySet=true;
}
Program: 8070
Project: 8070
Buggy source:
@Override public View prepareDecorView(View v){
  v=FontLoader.apply(v);
  if (!getConfig().isDisableContextMenu() && v != null) {
    v=new ContextMenuDecorView(this,v,this);
  }
  return v;
}

Fixed version (ground truth):
@Override public View prepareDecorView(View v){
  return ContextMenuDecorView.prepareDecorView(this,v,this,0);
}
Program: 8071
Project: 8071
Buggy source:
@Override public void setContentView(View view,LayoutParams params){
  super.setContentView(FontLoader.apply(view),params);
}

Fixed version (ground truth):
@Override public void setContentView(View view,LayoutParams params){
  super.setContentView(prepareDecorView(view),params);
}
Program: 8072
Project: 8072
Buggy source:
@Override public void addContentView(View view,LayoutParams params){
  super.addContentView(FontLoader.apply(view),params);
}

Fixed version (ground truth):
@Override public void addContentView(View view,LayoutParams params){
  super.addContentView(prepareDecorView(view),params);
}
Program: 8073
Project: 8073
Buggy source:
protected View prepareDecorView(View v){
  v=FontLoader.apply(v);
  if (!mBase.getConfig().isDisableContextMenu() && v != null) {
    v=new ContextMenuDecorView(getSupportActivity(),v,this);
    v.setId(INTERNAL_DECOR_VIEW_ID);
  }
  return v;
}

Fixed version (ground truth):
protected View prepareDecorView(View v){
  return ContextMenuDecorView.prepareDecorView(getSupportActivity(),v,this,INTERNAL_DECOR_VIEW_ID);
}
Program: 8074
Project: 8074
Buggy source:
public final void reset(){
  this.lineBufferIdx=0;
}

Fixed version (ground truth):
public final void reset(){
  this.lineBufferIdx=0;
  this.readCR=false;
}
Program: 8075
Project: 8075
Buggy source:
public String readLine(ByteBuffer buffer) throws LineTooLargeException {
  byte b;
  boolean more=true;
  while (buffer.hasRemaining() && more) {
    b=buffer.get();
    if (b == CR) {
      if (buffer.hasRemaining() && buffer.get() == LF) {
        more=false;
      }
    }
 else     if (b == LF) {
      more=false;
    }
 else {
      if (lineBufferIdx == maxLine - 2) {
        throw new LineTooLargeException("String_Node_Str" + maxLine);
      }
      if (lineBufferIdx == lineBuffer.length) {
        lineBuffer=Arrays.copyOf(lineBuffer,lineBuffer.length * 2);
      }
      lineBuffer[lineBufferIdx]=b;
      ++lineBufferIdx;
    }
  }
  String line=null;
  if (!more) {
    line=new String(lineBuffer,0,lineBufferIdx);
    lineBufferIdx=0;
  }
  return line;
}

Fixed version (ground truth):
public String readLine(ByteBuffer buffer) throws LineTooLargeException, ProtocolException {
  byte b;
  boolean more=true;
  while (buffer.hasRemaining() && more) {
    b=buffer.get();
    if (readCR && b != LF) {
      throw new ProtocolException("String_Node_Str" + b);
    }
    if (b == CR) {
      readCR=true;
    }
 else     if (b == LF) {
      more=false;
    }
 else {
      if (lineBufferIdx == maxLine - 2) {
        throw new LineTooLargeException("String_Node_Str" + maxLine);
      }
      if (lineBufferIdx == lineBuffer.length) {
        lineBuffer=Arrays.copyOf(lineBuffer,lineBuffer.length * 2);
      }
      lineBuffer[lineBufferIdx]=b;
      ++lineBufferIdx;
    }
  }
  String line=null;
  if (!more) {
    line=new String(lineBuffer,0,lineBufferIdx);
    reset();
  }
  return line;
}
Program: 8076
Project: 8076
Buggy source:
private void readHeaders(ByteBuffer buffer) throws LineTooLargeException, AbortException {
  String line=lineReader.readLine(buffer);
  while (line != null && !line.isEmpty()) {
    HttpUtils.splitAndAddHeader(line,headers);
    line=lineReader.readLine(buffer);
  }
  if (line == null)   return;
  listener.onHeadersReceived(headers);
  if (method == HttpMethod.HEAD) {
    state=ALL_READ;
    return;
  }
  String te=HttpUtils.getStringValue(headers,TRANSFER_ENCODING);
  if (CHUNKED.equals(te)) {
    state=READ_CHUNK_SIZE;
  }
 else {
    String cl=HttpUtils.getStringValue(headers,CONTENT_LENGTH);
    if (cl != null) {
      readRemaining=Integer.parseInt(cl);
      if (readRemaining == 0) {
        state=ALL_READ;
      }
 else {
        state=READ_FIXED_LENGTH_CONTENT;
      }
    }
 else     if (emptyBodyExpected) {
      state=ALL_READ;
    }
 else {
      state=READ_VARIABLE_LENGTH_CONTENT;
      readRemaining=Integer.MAX_VALUE;
    }
  }
}

Fixed version (ground truth):
private void readHeaders(ByteBuffer buffer) throws LineTooLargeException, AbortException, ProtocolException {
  String line=lineReader.readLine(buffer);
  while (line != null && !line.isEmpty()) {
    HttpUtils.splitAndAddHeader(line,headers);
    line=lineReader.readLine(buffer);
  }
  if (line == null)   return;
  listener.onHeadersReceived(headers);
  if (method == HttpMethod.HEAD) {
    state=ALL_READ;
    return;
  }
  String te=HttpUtils.getStringValue(headers,TRANSFER_ENCODING);
  if (CHUNKED.equals(te)) {
    state=READ_CHUNK_SIZE;
  }
 else {
    String cl=HttpUtils.getStringValue(headers,CONTENT_LENGTH);
    if (cl != null) {
      readRemaining=Integer.parseInt(cl);
      if (readRemaining == 0) {
        state=ALL_READ;
      }
 else {
        state=READ_FIXED_LENGTH_CONTENT;
      }
    }
 else     if (emptyBodyExpected) {
      state=ALL_READ;
    }
 else {
      state=READ_VARIABLE_LENGTH_CONTENT;
      readRemaining=Integer.MAX_VALUE;
    }
  }
}
Program: 8077
Project: 8077
Buggy source:
void readEmptyLine(ByteBuffer buffer){
  byte b=buffer.get();
  if (b == CR && buffer.hasRemaining()) {
    buffer.get();
  }
}

Fixed version (ground truth):
private void readEmptyLine(ByteBuffer buffer,State nextState) throws ProtocolException, LineTooLargeException {
  String line=lineReader.readLine(buffer);
  if (line != null) {
    if (line.isEmpty()) {
      state=nextState;
    }
 else {
      throw new ProtocolException("String_Node_Str" + line);
    }
  }
}
Program: 8078
Project: 8078
Buggy source:
public State decode(ByteBuffer buffer) throws LineTooLargeException, ProtocolException, AbortException {
  String line;
  while (buffer.hasRemaining() && state != State.ALL_READ) {
switch (state) {
case READ_INITIAL:
      if ((line=lineReader.readLine(buffer)) != null) {
        parseInitialLine(line);
      }
    break;
case READ_HEADER:
  readHeaders(buffer);
break;
case READ_CHUNK_SIZE:
line=lineReader.readLine(buffer);
if (line != null && !line.isEmpty()) {
readRemaining=getChunkSize(line);
if (readRemaining == 0) {
state=READ_CHUNK_FOOTER;
}
 else {
state=READ_CHUNKED_CONTENT;
}
}
break;
case READ_FIXED_LENGTH_CONTENT:
readBody(buffer,ALL_READ);
break;
case READ_CHUNKED_CONTENT:
readBody(buffer,READ_CHUNK_DELIMITER);
break;
case READ_CHUNK_FOOTER:
readEmptyLine(buffer);
state=ALL_READ;
break;
case READ_CHUNK_DELIMITER:
readEmptyLine(buffer);
state=READ_CHUNK_SIZE;
break;
case READ_VARIABLE_LENGTH_CONTENT:
readBody(buffer,null);
break;
}
}
return state;
}

Fixed version (ground truth):
public State decode(ByteBuffer buffer) throws LineTooLargeException, ProtocolException, AbortException {
  String line;
  while (buffer.hasRemaining() && state != State.ALL_READ) {
switch (state) {
case READ_INITIAL:
      if ((line=lineReader.readLine(buffer)) != null) {
        parseInitialLine(line);
      }
    break;
case READ_HEADER:
  readHeaders(buffer);
break;
case READ_CHUNK_SIZE:
line=lineReader.readLine(buffer);
if (line != null && !line.isEmpty()) {
readRemaining=getChunkSize(line);
if (readRemaining == 0) {
state=READ_CHUNK_FOOTER;
}
 else {
state=READ_CHUNKED_CONTENT;
}
}
break;
case READ_FIXED_LENGTH_CONTENT:
readBody(buffer,ALL_READ);
break;
case READ_CHUNKED_CONTENT:
readBody(buffer,READ_CHUNK_DELIMITER);
break;
case READ_CHUNK_FOOTER:
readEmptyLine(buffer,ALL_READ);
break;
case READ_CHUNK_DELIMITER:
readEmptyLine(buffer,READ_CHUNK_SIZE);
break;
case READ_VARIABLE_LENGTH_CONTENT:
readBody(buffer,null);
break;
}
}
return state;
}
Program: 8079
Project: 8079
Buggy source:
private void doRead(SelectionKey key,long now){
  Request req=(Request)key.attachment();
  SocketChannel ch=(SocketChannel)key.channel();
  int read=0;
  try {
    buffer.clear();
    if (req instanceof HttpsRequest) {
      HttpsRequest httpsReq=(HttpsRequest)req;
      if (httpsReq.handshaken) {
        read=httpsReq.unwrapRead(buffer);
      }
 else {
        read=httpsReq.doHandshake(buffer);
      }
    }
 else {
      read=ch.read(buffer);
    }
  }
 catch (  IOException e) {
    if (!cleanAndRetryIfBroken(key,req)) {
      req.finish(e);
    }
  }
catch (  Exception e) {
    req.finish(e);
  }
  if (read == -1) {
    if (!cleanAndRetryIfBroken(key,req)) {
      req.finish();
    }
  }
 else   if (read > 0) {
    req.onProgress(now);
    buffer.flip();
    try {
      if (req.decoder.decode(buffer) == ALL_READ) {
        req.finish();
        if (req.cfg.keepAlive > 0) {
          keepalives.offer(new PersistentConn(now + req.cfg.keepAlive,req.addr,key));
        }
 else {
          closeQuietly(key);
        }
      }
    }
 catch (    HTTPException e) {
      closeQuietly(key);
      req.finish(e);
    }
catch (    Exception e) {
      closeQuietly(key);
      req.finish(e);
      errorLogger.log("String_Node_Str",e);
      eventLogger.log(eventNames.clientImpossible);
    }
  }
}

Fixed version (ground truth):
private void doRead(SelectionKey key,long now){
  Request req=(Request)key.attachment();
  SocketChannel ch=(SocketChannel)key.channel();
  int read=0;
  try {
    buffer.clear();
    if (req instanceof HttpsRequest) {
      HttpsRequest httpsReq=(HttpsRequest)req;
      if (httpsReq.handshaken) {
        read=httpsReq.unwrapRead(buffer);
      }
 else {
        read=httpsReq.doHandshake(buffer);
      }
    }
 else {
      read=ch.read(buffer);
    }
  }
 catch (  IOException e) {
    if (!cleanAndRetryIfBroken(key,req)) {
      req.finish(e);
    }
  }
catch (  Exception e) {
    req.finish(e);
  }
  if (read == -1) {
    if (!cleanAndRetryIfBroken(key,req)) {
      req.finish();
    }
  }
 else   if (read > 0) {
    req.onProgress(now);
    buffer.flip();
    try {
      State oldState=req.decoder.state;
      if (req.decoder.decode(buffer) == ALL_READ) {
        req.finish();
        if (req.cfg.keepAlive > 0) {
          if (oldState != ALL_READ) {
            keepalives.offer(new PersistentConn(now + req.cfg.keepAlive,req.addr,key));
          }
        }
 else {
          closeQuietly(key);
        }
      }
    }
 catch (    HTTPException e) {
      closeQuietly(key);
      req.finish(e);
    }
catch (    Exception e) {
      closeQuietly(key);
      req.finish(e);
      errorLogger.log("String_Node_Str",e);
      eventLogger.log(eventNames.clientImpossible);
    }
  }
}
Program: 8080
Project: 8080
Buggy source:
private void decodeWs(WsAtta atta,SelectionKey key){
  try {
    do {
      Frame frame=atta.decoder.decode(buffer);
      if (frame instanceof TextFrame || frame instanceof BinaryFrame) {
        handler.handle(atta.channel,frame);
        atta.decoder.reset();
      }
 else       if (frame instanceof PingFrame) {
        atta.decoder.reset();
        tryWrite(key,WsEncode(WSDecoder.OPCODE_PONG,frame.data));
      }
 else       if (frame instanceof PongFrame) {
        atta.decoder.reset();
      }
 else       if (frame instanceof CloseFrame) {
        handler.clientClose(atta.channel,((CloseFrame)frame).getStatus());
        atta.keepalive=false;
        atta.decoder.reset();
        tryWrite(key,WsEncode(WSDecoder.OPCODE_CLOSE,frame.data));
      }
    }
 while (buffer.hasRemaining());
  }
 catch (  ProtocolException e) {
    System.err.printf("String_Node_Str",new Date(),THREAD_NAME,e.getMessage());
    closeKey(key,CLOSE_MESG_BIG);
  }
}

Fixed version (ground truth):
private void decodeWs(WsAtta atta,SelectionKey key){
  try {
    do {
      Frame frame=atta.decoder.decode(buffer);
      if (frame instanceof TextFrame || frame instanceof BinaryFrame) {
        handler.handle(atta.channel,frame);
        atta.decoder.reset();
      }
 else       if (frame instanceof PingFrame) {
        atta.decoder.reset();
        tryWrite(key,WsEncode(WSDecoder.OPCODE_PONG,frame.data));
      }
 else       if (frame instanceof PongFrame) {
        atta.decoder.reset();
      }
 else       if (frame instanceof CloseFrame) {
        boolean closed=atta.channel.isClosed();
        handler.clientClose(atta.channel,((CloseFrame)frame).getStatus());
        atta.keepalive=false;
        atta.decoder.reset();
        if (!closed) {
          tryWrite(key,WsEncode(WSDecoder.OPCODE_CLOSE,frame.data));
        }
      }
    }
 while (buffer.hasRemaining());
  }
 catch (  ProtocolException e) {
    System.err.printf("String_Node_Str",new Date(),THREAD_NAME,e.getMessage());
    closeKey(key,CLOSE_MESG_BIG);
  }
}
Program: 8081
Project: 8081
Buggy source:
public static void splitAndAddHeader(String sb,Map<String,Object> headers){
  final int length=sb.length();
  int nameStart;
  int nameEnd;
  int colonEnd;
  int valueStart;
  int valueEnd;
  nameStart=findNonWhitespace(sb,0);
  for (nameEnd=nameStart; nameEnd < length; nameEnd++) {
    char ch=sb.charAt(nameEnd);
    if (ch == ':' || Character.isWhitespace(ch)) {
      break;
    }
  }
  for (colonEnd=nameEnd; colonEnd < length; colonEnd++) {
    if (sb.charAt(colonEnd) == ':') {
      colonEnd++;
      break;
    }
  }
  valueStart=findNonWhitespace(sb,colonEnd);
  valueEnd=findEndOfString(sb);
  String key=sb.substring(nameStart,nameEnd);
  if (valueStart > valueEnd) {
  }
 else {
    String value=sb.substring(valueStart,valueEnd);
    key=key.toLowerCase();
    Object v=headers.get(key);
    if (v == null) {
      headers.put(key,value);
    }
 else {
      if (v instanceof String) {
        headers.put(key,PersistentList.create(Arrays.asList((String)v,value)));
      }
 else {
        headers.put(key,((ISeq)v).cons(value));
      }
    }
  }
}

Fixed version (ground truth):
public static void splitAndAddHeader(String sb,Map<String,Object> headers){
  final int length=sb.length();
  int nameStart;
  int nameEnd;
  int colonEnd;
  int valueStart;
  int valueEnd;
  nameStart=findNonWhitespace(sb,0);
  for (nameEnd=nameStart; nameEnd < length; nameEnd++) {
    char ch=sb.charAt(nameEnd);
    if (ch == ':' || Character.isWhitespace(ch)) {
      break;
    }
  }
  for (colonEnd=nameEnd; colonEnd < length; colonEnd++) {
    if (sb.charAt(colonEnd) == ':') {
      colonEnd++;
      break;
    }
  }
  valueStart=findNonWhitespace(sb,colonEnd);
  valueEnd=findEndOfString(sb,valueStart);
  String key=sb.substring(nameStart,nameEnd);
  if (valueStart > valueEnd) {
  }
 else {
    String value=sb.substring(valueStart,valueEnd);
    key=key.toLowerCase();
    Object v=headers.get(key);
    if (v == null) {
      headers.put(key,value);
    }
 else {
      if (v instanceof String) {
        headers.put(key,PersistentList.create(Arrays.asList((String)v,value)));
      }
 else {
        headers.put(key,((ISeq)v).cons(value));
      }
    }
  }
}
Program: 8082
Project: 8082
Buggy source:
public static int findEndOfString(String sb){
  int result;
  for (result=sb.length(); result > 0; result--) {
    if (!isWhitespace(sb.charAt(result - 1))) {
      break;
    }
  }
  return result;
}

Fixed version (ground truth):
public static int findEndOfString(String sb,int offset){
  int result;
  for (result=sb.length(); result > offset; result--) {
    if (!isWhitespace(sb.charAt(result - 1))) {
      break;
    }
  }
  return result;
}
Program: 8083
Project: 8083
Buggy source:
private void parseInitialLine(String sb) throws ProtocolException, AbortException {
  int aStart;
  int aEnd;
  int bStart;
  int bEnd;
  int cStart;
  int cEnd;
  aStart=findNonWhitespace(sb,0);
  aEnd=findWhitespace(sb,aStart);
  bStart=findNonWhitespace(sb,aEnd);
  bEnd=findWhitespace(sb,bStart);
  cStart=findNonWhitespace(sb,bEnd);
  cEnd=findEndOfString(sb);
  if ((cStart < cEnd) || (cStart == cEnd && bStart < bEnd)) {
    try {
      int status=Integer.parseInt(sb.substring(bStart,bEnd));
      emptyBodyExpected=status / 100 == 1 || status == 204 || status == 304;
      HttpStatus s=HttpStatus.valueOf(status);
      HttpVersion version=HTTP_1_1;
      if ("String_Node_Str".equals(sb.substring(aStart,aEnd))) {
        version=HTTP_1_0;
      }
      listener.onInitialLineReceived(version,s);
      state=READ_HEADER;
    }
 catch (    NumberFormatException e) {
      throw new ProtocolException("String_Node_Str" + sb);
    }
  }
 else {
    throw new ProtocolException("String_Node_Str" + sb);
  }
}

Fixed version (ground truth):
private void parseInitialLine(String sb) throws ProtocolException, AbortException {
  int aStart;
  int aEnd;
  int bStart;
  int bEnd;
  int cStart;
  int cEnd;
  aStart=findNonWhitespace(sb,0);
  aEnd=findWhitespace(sb,aStart);
  bStart=findNonWhitespace(sb,aEnd);
  bEnd=findWhitespace(sb,bStart);
  cStart=findNonWhitespace(sb,bEnd);
  cEnd=findEndOfString(sb,cStart);
  if ((cStart < cEnd) || (cStart == cEnd && bStart < bEnd)) {
    try {
      int status=Integer.parseInt(sb.substring(bStart,bEnd));
      emptyBodyExpected=status / 100 == 1 || status == 204 || status == 304;
      HttpStatus s=HttpStatus.valueOf(status);
      HttpVersion version=HTTP_1_1;
      if ("String_Node_Str".equals(sb.substring(aStart,aEnd))) {
        version=HTTP_1_0;
      }
      listener.onInitialLineReceived(version,s);
      state=READ_HEADER;
    }
 catch (    NumberFormatException e) {
      throw new ProtocolException("String_Node_Str" + sb);
    }
  }
 else {
    throw new ProtocolException("String_Node_Str" + sb);
  }
}