nus-yam/ex-repair huggingface dataset:
Program: 86166
Project: 86166
Buggy source:
@Override public void onScrollStateChanged(AbsListView view,int scrollState){
  if (searchable(mViewPager.getCurrentItem())) {
    startSearchBarAction(ACTION_DISAPPEAR);
  }
}

Fixed version (ground truth):
@Override public void onScrollStateChanged(AbsListView view,int scrollState){
  if (searchable(mViewPager.getCurrentItem())) {
    InputMethodManager imm=(InputMethodManager)getSystemService(Service.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(mSearchBox.getWindowToken(),0);
  }
}
Program: 86167
Project: 86167
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.mentors_fragment,container,false);
  mListView=(ListView)view.findViewById(android.R.id.list);
  mListView.setAdapter(mAdapter);
  mListView.setFastScrollEnabled(true);
  mSearchListView=(ListView)view.findViewById(R.id.searchList);
  mSearchListView.setAdapter(mAdapter);
  if (getActivity() instanceof AbsListView.OnScrollListener) {
    AbsListView.OnScrollListener l=(AbsListView.OnScrollListener)getActivity();
    mListView.setOnScrollListener(l);
  }
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.mentors_fragment,container,false);
  mListView=(ListView)view.findViewById(android.R.id.list);
  mListView.setAdapter(mAdapter);
  mListView.setFastScrollEnabled(true);
  mSearchListView=(ListView)view.findViewById(R.id.searchList);
  mSearchListView.setAdapter(mAdapter);
  if (getActivity() instanceof AbsListView.OnScrollListener) {
    AbsListView.OnScrollListener l=(AbsListView.OnScrollListener)getActivity();
    mSearchListView.setOnScrollListener(l);
  }
  return view;
}
Program: 86168
Project: 86168
Buggy source:
protected abstract void handleJSONUpdateInBackground(String json);

Fixed version (ground truth):
protected abstract void handleJSONUpdateInBackground(String json,String action);
Program: 86169
Project: 86169
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (action != null && action.equals(intent.getAction())) {
    String key=intent.getAction();
    String json=intent.getStringExtra(key);
    handleJSONUpdateInBackground(json);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (action != null && action.equals(intent.getAction())) {
    String key=intent.getAction();
    String json=intent.getStringExtra(key);
    handleJSONUpdateInBackground(json,action);
  }
}
Program: 86170
Project: 86170
Buggy source:
/** 
 * Creates a BroadcastReceiver that is listening to broadcasts of the type action.
 * @param context Used to set up the LocalBroadcastReceiver. Must be non-null.
 * @param action The action to listen to in the broadcast receiver.
 * @param adapter The adapter to pass to handleJSONInBackground in onReceive of theBroadcastReceiver.
 */
protected void registerForSync(Context context,final String action,final ArrayAdapter adapter){
  BroadcastReceiver receiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (action != null && action.equals(intent.getAction())) {
        String key=intent.getAction();
        String json=intent.getStringExtra(key);
        handleJSONUpdateInBackground(json);
      }
    }
  }
;
  IntentFilter filter=new IntentFilter();
  filter.addAction(action);
  LocalBroadcastManager manager=LocalBroadcastManager.getInstance(context);
  manager.registerReceiver(receiver,filter);
}

Fixed version (ground truth):
/** 
 * Given an action string, the handleJSONUpdateInBackground method will be called whenever there is an update.
 * @param context The current Fragment context.
 * @param action The action to sync to. This is the same action string you would pass toHTTPFirebase.GET().
 */
protected void registerForSync(Context context,final String action){
  final String className=getClass().getSimpleName();
  final String TAG=className;
  if (mReceiver == null) {
    mContext=context;
    mReceiver=new BroadcastReceiver(){
      @Override public void onReceive(      Context context,      Intent intent){
        if (action != null && action.equals(intent.getAction())) {
          String key=intent.getAction();
          String json=intent.getStringExtra(key);
          handleJSONUpdateInBackground(json,action);
        }
      }
    }
;
    IntentFilter filter=new IntentFilter();
    filter.addAction(action);
    LocalBroadcastManager manager=LocalBroadcastManager.getInstance(mContext);
    manager.registerReceiver(mReceiver,filter);
  }
}
Program: 86171
Project: 86171
Buggy source:
@Override protected void handleJSONUpdateInBackground(final String json){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Mentor> newData=Mentor.loadMentorArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}

Fixed version (ground truth):
@Override protected void handleJSONUpdateInBackground(final String json,String action){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Mentor> newData=Mentor.loadMentorArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}
Program: 86172
Project: 86172
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.MENTORS_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Mentor>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new MentorListAdapter(activity,R.layout.mentor_list_item,mData);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_MENTORS,mAdapter);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_MENTORS);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.MENTORS_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Mentor>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new MentorListAdapter(activity,R.layout.mentor_list_item,mData);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_MENTORS);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_MENTORS);
}
Program: 86173
Project: 86173
Buggy source:
@Override protected void handleJSONUpdateInBackground(final String json){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Prize> newData=Prize.loadPrizesFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}

Fixed version (ground truth):
@Override protected void handleJSONUpdateInBackground(final String json,String action){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Prize> newData=Prize.loadPrizesFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}
Program: 86174
Project: 86174
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.PRIZES_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Prize>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new PrizesFragmentAdapter(activity,R.layout.prizes_list_item,mData);
  mAdapter.setFragment(this);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_PRIZES,mAdapter);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_PRIZES);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.PRIZES_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Prize>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new PrizesFragmentAdapter(activity,R.layout.prizes_list_item,mData);
  mAdapter.setFragment(this);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_PRIZES);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_PRIZES);
}
Program: 86175
Project: 86175
Buggy source:
@Override protected void handleJSONUpdateInBackground(final String json){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<ScheduleItem> newData=ScheduleItem.loadScheduleFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}

Fixed version (ground truth):
@Override protected void handleJSONUpdateInBackground(final String json,String actio){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<ScheduleItem> newData=ScheduleItem.loadScheduleFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}
Program: 86176
Project: 86176
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.SCHEDULE_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Model>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new ScheduleFragmentAdapter(activity,R.layout.schedule_list_item,mData);
  mAdapter.setFragment(this);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_SCHEDULE,mAdapter);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_SCHEDULE);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.SCHEDULE_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Model>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new ScheduleFragmentAdapter(activity,R.layout.schedule_list_item,mData);
  mAdapter.setFragment(this);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_SCHEDULE);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_SCHEDULE);
}
Program: 86177
Project: 86177
Buggy source:
@Override protected void handleJSONUpdateInBackground(final String json){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<TeamMember> newData=TeamMember.loadTeamMemberArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}

Fixed version (ground truth):
@Override protected void handleJSONUpdateInBackground(final String json,String action){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<TeamMember> newData=TeamMember.loadTeamMemberArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            mData.clear();
            mData.addAll(newData);
            mAdapter.notifyDataSetChanged();
          }
        }
);
      }
      return null;
    }
  }
.execute();
}
Program: 86178
Project: 86178
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.TEAM_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<TeamMember>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new TeamFragmentAdapter(activity,R.layout.team_list_item,mData);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_TEAM,mAdapter);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_TEAM);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.TEAM_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<TeamMember>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new TeamFragmentAdapter(activity,R.layout.team_list_item,mData);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_TEAM);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_TEAM);
}
Program: 86179
Project: 86179
Buggy source:
@Override protected void handleJSONUpdateInBackground(final String json){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Update> newData=Update.loadUpdateArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            if (newData.size() > mData.size()) {
              int delta=newData.size() - mData.size();
              for (int i=0; i < delta; i++) {
                mData.add(null);
              }
              for (int i=0; i < newData.size(); i++) {
                mData.set(i,newData.get(i));
              }
              mAdapter.notifyDataSetChanged();
            }
          }
        }
);
      }
      return null;
    }
  }
.execute();
}

Fixed version (ground truth):
@Override protected void handleJSONUpdateInBackground(final String json,String action){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Update> newData=Update.loadUpdateArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            if (newData.size() > mData.size()) {
              int delta=newData.size() - mData.size();
              for (int i=0; i < delta; i++) {
                mData.add(null);
              }
              for (int i=0; i < newData.size(); i++) {
                mData.set(i,newData.get(i));
              }
              mAdapter.notifyDataSetChanged();
            }
          }
        }
);
      }
      return null;
    }
  }
.execute();
}
Program: 86180
Project: 86180
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.UPDATES_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Update>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new UpdatesFragmentAdapter(activity,R.layout.update_list_item,mData);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_UPDATES,mAdapter);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_UPDATES);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  String key=ViewPagerAdapter.UPDATES_TAG;
  Object thing=getCachedObject(key);
  if (thing != null) {
    mData=(ArrayList<Update>)thing;
  }
 else {
    setCachedObject(key,mData);
  }
  mAdapter=new UpdatesFragmentAdapter(activity,R.layout.update_list_item,mData);
  registerForSync(activity,HackTheNorthApplication.Actions.SYNC_UPDATES);
  HTTPFirebase.GET("String_Node_Str",activity,HackTheNorthApplication.Actions.SYNC_UPDATES);
}
Program: 86181
Project: 86181
Buggy source:
@Override protected void handleJSONUpdateInBackground(final String json){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Update> newData=Update.loadUpdateArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            if (newData.size() > mData.size()) {
              int delta=newData.size() - mData.size();
              for (int i=0; i < delta; i++) {
                mData.add(null);
              }
              for (int i=0; i < newData.size(); i++) {
                mData.set(i,newData.get(i));
              }
            }
          }
        }
);
      }
      return null;
    }
  }
.execute();
}

Fixed version (ground truth):
@Override protected void handleJSONUpdateInBackground(final String json){
  final Activity activity=getActivity();
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... nothing){
      final ArrayList<Update> newData=Update.loadUpdateArrayFromJSON(json);
      if (activity != null && mAdapter != null) {
        activity.runOnUiThread(new Runnable(){
          @Override public void run(){
            if (newData.size() > mData.size()) {
              int delta=newData.size() - mData.size();
              for (int i=0; i < delta; i++) {
                mData.add(null);
              }
              for (int i=0; i < newData.size(); i++) {
                mData.set(i,newData.get(i));
              }
              mAdapter.notifyDataSetChanged();
            }
          }
        }
);
      }
      return null;
    }
  }
.execute();
}
Program: 86182
Project: 86182
Buggy source:
@Override protected Void doInBackground(Void... nothing){
  final ArrayList<Update> newData=Update.loadUpdateArrayFromJSON(json);
  if (activity != null && mAdapter != null) {
    activity.runOnUiThread(new Runnable(){
      @Override public void run(){
        if (newData.size() > mData.size()) {
          int delta=newData.size() - mData.size();
          for (int i=0; i < delta; i++) {
            mData.add(null);
          }
          for (int i=0; i < newData.size(); i++) {
            mData.set(i,newData.get(i));
          }
        }
      }
    }
);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... nothing){
  final ArrayList<Update> newData=Update.loadUpdateArrayFromJSON(json);
  if (activity != null && mAdapter != null) {
    activity.runOnUiThread(new Runnable(){
      @Override public void run(){
        if (newData.size() > mData.size()) {
          int delta=newData.size() - mData.size();
          for (int i=0; i < delta; i++) {
            mData.add(null);
          }
          for (int i=0; i < newData.size(); i++) {
            mData.set(i,newData.get(i));
          }
          mAdapter.notifyDataSetChanged();
        }
      }
    }
);
  }
  return null;
}
Program: 86183
Project: 86183
Buggy source:
@Override public void run(){
  if (newData.size() > mData.size()) {
    int delta=newData.size() - mData.size();
    for (int i=0; i < delta; i++) {
      mData.add(null);
    }
    for (int i=0; i < newData.size(); i++) {
      mData.set(i,newData.get(i));
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (newData.size() > mData.size()) {
    int delta=newData.size() - mData.size();
    for (int i=0; i < delta; i++) {
      mData.add(null);
    }
    for (int i=0; i < newData.size(); i++) {
      mData.set(i,newData.get(i));
    }
    mAdapter.notifyDataSetChanged();
  }
}
Program: 86184
Project: 86184
Buggy source:
@Override public void onSizeChanged(int w,int h,int oldWidth,int oldHeight){
  double radius=Units.dpToPx(getContext(),50);
  double smallRadius=Math.sqrt(radius * radius * 3.0d / 4.0d);
  boolean stagger=false;
  double vadjust=Units.dpToPx(getContext(),0.0d);
  double hadjust=(radius * radius) / (250.0d * 250.0d);
  for (double i=0; i < h + radius; i+=smallRadius + vadjust) {
    double j=0.0d;
    if (stagger) {
      j=(int)(2 * smallRadius * Math.cos(11 * Math.PI / 6));
    }
    for (; j < w + radius; j+=3 * radius) {
      if (stagger) {
        j+=hadjust;
      }
      mHexagons.add(new RegularHexagon(j,i,radius));
    }
    stagger=!stagger;
  }
}

Fixed version (ground truth):
@Override public void onSizeChanged(int w,int h,int oldWidth,int oldHeight){
  initializeHexagons(w,h,oldWidth,oldHeight);
}
Program: 86186
Project: 86186
Buggy source:
@Override public boolean onTouchEvent(@NonNull final MotionEvent event){
  if (event.getActionMasked() == MotionEvent.ACTION_UP) {
    mDownX=event.getX();
    mDownY=event.getY();
    int endRadius=Units.dpToPx(getContext(),128);
    final ObjectAnimator fadeInAnimator=ObjectAnimator.ofInt(this,"String_Node_Str",0,25);
    fadeInAnimator.setInterpolator(new AccelerateInterpolator());
    fadeInAnimator.setDuration(100);
    final ObjectAnimator circleAnimator=ObjectAnimator.ofFloat(this,"String_Node_Str",0,endRadius);
    circleAnimator.setInterpolator(new DecelerateInterpolator());
    circleAnimator.setDuration(200);
    final ObjectAnimator fadeOutAnimator=ObjectAnimator.ofInt(this,"String_Node_Str",25,0);
    fadeOutAnimator.setInterpolator(new LinearInterpolator());
    fadeOutAnimator.setStartDelay(150);
    fadeOutAnimator.setDuration(300);
    new Runnable(){
      @Override public void run(){
        fadeInAnimator.start();
        circleAnimator.start();
        fadeOutAnimator.start();
      }
    }
.run();
  }
  super.onTouchEvent(event);
  return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(@NonNull final MotionEvent event){
  if (event.getActionMasked() == MotionEvent.ACTION_UP) {
    mDownX=event.getX();
    mDownY=event.getY();
    int endRadius=Units.dpToPx(getContext(),128);
    final ObjectAnimator fadeInAnimator=ObjectAnimator.ofInt(this,"String_Node_Str",0,25);
    fadeInAnimator.setInterpolator(new AccelerateInterpolator());
    fadeInAnimator.setDuration(100);
    final ObjectAnimator circleAnimator=ObjectAnimator.ofFloat(this,"String_Node_Str",0,endRadius * 2);
    circleAnimator.setInterpolator(new DecelerateInterpolator());
    circleAnimator.setDuration(400);
    final ObjectAnimator fadeOutAnimator=ObjectAnimator.ofInt(this,"String_Node_Str",25,0);
    fadeOutAnimator.setInterpolator(new LinearInterpolator());
    fadeOutAnimator.setStartDelay(150);
    fadeOutAnimator.setDuration(300);
    new Runnable(){
      @Override public void run(){
        fadeInAnimator.start();
        circleAnimator.start();
        fadeOutAnimator.start();
      }
    }
.run();
  }
  super.onTouchEvent(event);
  return true;
}
Program: 86187
Project: 86187
Buggy source:
private String getSkillsString(ArrayList<String> skillsList){
  String skills="String_Node_Str";
  for (  String skill : skillsList) {
    if (skillsList.indexOf(skill) != 0) {
      skills+="String_Node_Str";
    }
    skills+=skill;
  }
  return skills;
}

Fixed version (ground truth):
private String getSkillsString(ArrayList<String> skillsList){
  if (skillsList == null || skillsList.size() == 0) {
    return null;
  }
  String skills=skillsList.get(0);
  for (int i=1; i < skillsList.size(); i++) {
    skills+="String_Node_Str" + skillsList.get(i);
  }
  return skills;
}
Program: 86188
Project: 86188
Buggy source:
private String getAvailabilityString(ArrayList<ArrayList<String>> timeslots){
  String availability="String_Node_Str";
  if (timeslots == null) {
    return null;
  }
  for (  ArrayList<String> timeslotTimes : timeslots) {
    if (timeslotTimes.size() != 2) {
      Log.e(TAG,"String_Node_Str");
      return null;
    }
    Timeslot start=buildTimeslot(timeslotTimes.get(0));
    Timeslot end=buildTimeslot(timeslotTimes.get(1));
    if (start.day.equals(end.day)) {
      availability+=start.day + "String_Node_Str";
      if (start.period.equals(end.period)) {
        availability+=start.hour + "String_Node_Str" + start.minute+ "String_Node_Str"+ end.hour+ "String_Node_Str"+ end.minute+ end.period;
      }
 else {
        availability+=start.hour + "String_Node_Str" + start.minute+ start.period+ "String_Node_Str"+ end.hour+ "String_Node_Str"+ end.minute+ end.period;
      }
    }
 else {
      availability+=start.day + "String_Node_Str" + start.hour+ "String_Node_Str"+ start.minute+ start.period+ "String_Node_Str"+ end.day+ "String_Node_Str"+ end.hour+ "String_Node_Str"+ end.minute+ end.period;
    }
    if (timeslots.indexOf(timeslotTimes) != timeslots.size() - 1) {
      availability+="String_Node_Str";
    }
  }
  return availability;
}

Fixed version (ground truth):
private String getAvailabilityString(ArrayList<ArrayList<String>> timeslots){
  if (timeslots == null || timeslots.size() == 0) {
    return null;
  }
  String availability="String_Node_Str";
  for (int i=0; i < timeslots.size(); i++) {
    ArrayList<String> timeslotTimes=timeslots.get(i);
    if (timeslotTimes.size() != 2) {
      Log.e(TAG,"String_Node_Str");
      return null;
    }
    Timeslot start=buildTimeslot(timeslotTimes.get(0));
    Timeslot end=buildTimeslot(timeslotTimes.get(1));
    if (start.day.equals(end.day)) {
      availability+=start.day + "String_Node_Str";
      if (start.period.equals(end.period)) {
        availability+=start.hour + "String_Node_Str" + start.minute+ "String_Node_Str"+ end.hour+ "String_Node_Str"+ end.minute+ end.period;
      }
 else {
        availability+=start.hour + "String_Node_Str" + start.minute+ start.period+ "String_Node_Str"+ end.hour+ "String_Node_Str"+ end.minute+ end.period;
      }
    }
 else {
      availability+=start.day + "String_Node_Str" + start.hour+ "String_Node_Str"+ start.minute+ start.period+ "String_Node_Str"+ end.day+ "String_Node_Str"+ end.hour+ "String_Node_Str"+ end.minute+ end.period;
    }
    if (i != timeslots.size() - 1) {
      availability+="String_Node_Str";
    }
  }
  return availability;
}
Program: 86189
Project: 86189
Buggy source:
public void onUpdate(String json){
  if (mData == null) {
    mData=Mentor.loadMentorArrayFromJSON(json);
    setupAdapterIfReady();
  }
 else {
    ArrayList<Mentor> newData=Mentor.loadMentorArrayFromJSON(json);
    mData.clear();
    mData.addAll(newData);
  }
}

Fixed version (ground truth):
public void onUpdate(String json){
  if (mData == null) {
    mData=Mentor.loadMentorArrayFromJSON(json);
    setupAdapterIfReady();
  }
 else {
    ArrayList<Mentor> newData=Mentor.loadMentorArrayFromJSON(json);
    mData.clear();
    mData.addAll(newData);
    mAdapter.notifyDataSetChanged();
  }
}
Program: 86190
Project: 86190
Buggy source:
public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null) {
    LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    convertView=inflater.inflate(mResource,parent,false);
  }
  Mentor mentor=mData.get(position);
  NetworkImageView networkImageView=(NetworkImageView)convertView.findViewById(R.id.mentor_image);
  networkImageView.setDefaultImageResId(R.drawable.ic_launcher);
  ImageLoader loader=NetworkManager.getImageLoader();
  if (!"String_Node_Str".equals(mentor.image)) {
    networkImageView.setVisibility(View.VISIBLE);
    networkImageView.setImageUrl(mentor.image,loader);
  }
 else {
    networkImageView.setVisibility(View.GONE);
  }
  ((TextView)convertView.findViewById(R.id.mentor_name)).setText(mentor.name);
  ((TextView)convertView.findViewById(R.id.mentor_organization)).setText(mentor.organization);
  ((TextView)convertView.findViewById(R.id.mentor_availability)).setText(getAvailabilityString(mentor.availability));
  ((TextView)convertView.findViewById(R.id.mentor_skills)).setText(getSkillsString(mentor.skills));
  return convertView;
}

Fixed version (ground truth):
public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null) {
    LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    convertView=inflater.inflate(mResource,parent,false);
  }
  Mentor mentor=mData.get(position);
  NetworkImageView networkImageView=(NetworkImageView)convertView.findViewById(R.id.mentor_image);
  networkImageView.setDefaultImageResId(R.drawable.ic_launcher);
  ImageLoader loader=NetworkManager.getImageLoader();
  if (!TextUtils.isEmpty(mentor.image)) {
    networkImageView.setVisibility(View.VISIBLE);
    networkImageView.setImageUrl(mentor.image,loader);
  }
 else {
    networkImageView.setVisibility(View.GONE);
  }
  ((TextView)convertView.findViewById(R.id.mentor_name)).setText(mentor.name);
  ((TextView)convertView.findViewById(R.id.mentor_organization)).setText(mentor.organization);
  ((TextView)convertView.findViewById(R.id.mentor_availability)).setText(getAvailabilityString(mentor.availability));
  ((TextView)convertView.findViewById(R.id.mentor_skills)).setText(getSkillsString(mentor.skills));
  return convertView;
}
Program: 86191
Project: 86191
Buggy source:
@Override public Collection<Callable<?>> getExternalMappings(){
  Collection<Callable<?>> callbacks=new ArrayList<Callable<?>>();
  for (  MappingType mapping : externalMappings) {
    if (outputMappings.containsKey(mapping))     callbacks.add((Callable<?>)getAs(mapping));
  }
  return callbacks;
}

Fixed version (ground truth):
@Override public Collection<Callable<?>> getExternalMappings(){
  if (this.events != null)   return getAllCallablesInInterval(getCurrentInterval());
  Collection<Callable<?>> callbacks=new ArrayList<Callable<?>>();
  for (  MappingType mapping : externalMappings) {
    if (outputMappings.containsKey(mapping))     callbacks.add((Callable<?>)getAs(mapping));
  }
  return callbacks;
}
Program: 86192
Project: 86192
Buggy source:
@Override public double getValueFor(Interval now){
  double value=defaultValue;
  if (this.function != null) {
    try {
      value=function.call(now);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else   if (this.events != null) {
    Collection<Event> activeEvents=this.events.getForInterval(now);
    for (    Event e : activeEvents) {
      value=e.getValue();
    }
  }
  value*=valueScale;
  value+=valueOffset;
  value=MathOps.modInterval(value);
  return value;
}

Fixed version (ground truth):
@Override public double getValueFor(Interval now){
  double value=defaultValue;
  if (this.function != null) {
    try {
      value=function.call(now);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else   if (this.events != null) {
    Collection<Event> activeEvents=this.events.getForInterval(now);
    for (    Event e : activeEvents) {
      value=e.getValue();
    }
  }
  value=transformValue(value);
  return value;
}
Program: 86193
Project: 86193
Buggy source:
public Void call() throws Exception {
  int priorValue=lastValue.getAndSet(index);
  if (priorValue < index) {
    inner.call();
  }
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  int priorValue=lastValue.getAndSet(index);
  if (priorValue != index) {
    inner.call();
  }
  return null;
}
Program: 86194
Project: 86194
Buggy source:
public String toString(){
  return "String_Node_Str" + inner.toString() + "String_Node_Str"+ "String_Node_Str"+ Integer.toHexString(hashCode());
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + inner.toString() + "String_Node_Str"+ "String_Node_Str"+ Integer.toHexString(hashCode());
}
Program: 86195
Project: 86195
Buggy source:
@SuppressWarnings("String_Node_Str") @Test public void noteOnAndOff(){
  final AtomicInteger noteOffs=new AtomicInteger();
  final AtomicInteger noteOns=new AtomicInteger();
  Callable<Void> noteOffInc=new Callable<Void>(){
    @Override public Void call(){
      noteOffs.getAndIncrement();
      return null;
    }
  }
;
  Callable<Void> noteOnInc=new Callable<Void>(){
    @Override public Void call(){
      noteOns.getAndIncrement();
      return null;
    }
  }
;
  pattern.extend("String_Node_Str");
  ConcretePattern trigger=ConcretePattern.forEach(pattern.getConcretePattern());
  trigger.asStatefulCallable(CallableOnChange.fromCallables(noteOffInc,noteOnInc));
  pattern.addChild(trigger);
  scheduler.setElapsedMillis(501);
  assertThat(noteOffs.get(),is(equalTo(2)));
  assertThat(noteOns.get(),is(equalTo(3)));
  scheduler.setElapsedMillis(1000);
  assertThat(noteOffs.get(),is(equalTo(4)));
  assertThat(noteOns.get(),is(equalTo(4)));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Test public void noteOnAndOff(){
  final AtomicInteger noteOffs=new AtomicInteger();
  final AtomicInteger noteOns=new AtomicInteger();
  Callable<Void> noteOffInc=new Callable<Void>(){
    @Override public Void call(){
      noteOffs.getAndIncrement();
      return null;
    }
  }
;
  Callable<Void> noteOnInc=new Callable<Void>(){
    @Override public Void call(){
      noteOns.getAndIncrement();
      return null;
    }
  }
;
  pattern.extend("String_Node_Str");
  ConcretePattern trigger=ConcretePattern.forEach(pattern.getConcretePattern());
  trigger.asStatefulCallable(CallableOnChange.fromCallables(noteOffInc,noteOnInc));
  pattern.addChild(trigger);
  scheduler.setElapsedMillis(501);
  assertThat(noteOns.get(),is(equalTo(3)));
  assertThat(noteOffs.get(),is(equalTo(2)));
  scheduler.setElapsedMillis(1000);
  assertThat(noteOns.get(),is(equalTo(4)));
  assertThat(noteOffs.get(),is(equalTo(4)));
}
Program: 86196
Project: 86196
Buggy source:
public Void call(){
  count2.incrementAndGet();
  return null;
}

Fixed version (ground truth):
@Override public Void call(){
  count2.incrementAndGet();
  return null;
}
Program: 86197
Project: 86197
Buggy source:
@Test public void onlyOnceWithTwoCallables() throws Exception {
  final AtomicInteger count1=new AtomicInteger();
  final AtomicInteger count2=new AtomicInteger();
  Callable<Void> one=new Callable<Void>(){
    public Void call(){
      count1.incrementAndGet();
      return null;
    }
  }
;
  Callable<Void> two=new Callable<Void>(){
    public Void call(){
      count2.incrementAndGet();
      return null;
    }
  }
;
  StatefulCallable[] callables=CallableOnChange.fromCallables(one,two);
  callables[1].call();
  callables[1].call();
  assertThat(count1.get(),is(equalTo(1)));
  assertThat(count2.get(),is(equalTo(0)));
  callables[2].call();
  callables[1].call();
  assertThat(count1.get(),is(equalTo(1)));
  assertThat(count2.get(),is(equalTo(1)));
  callables[0].call();
  callables[2].call();
  assertThat(count1.get(),is(equalTo(1)));
  assertThat(count2.get(),is(equalTo(2)));
}

Fixed version (ground truth):
@Test public void onlyOnceWithTwoCallables() throws Exception {
  final AtomicInteger count1=new AtomicInteger();
  final AtomicInteger count2=new AtomicInteger();
  Callable<Void> one=new Callable<Void>(){
    @Override public Void call(){
      count1.incrementAndGet();
      return null;
    }
  }
;
  Callable<Void> two=new Callable<Void>(){
    @Override public Void call(){
      count2.incrementAndGet();
      return null;
    }
  }
;
  StatefulCallable[] callables=CallableOnChange.fromCallables(one,two);
  callables[1].call();
  callables[1].call();
  assertThat(count1.get(),is(equalTo(1)));
  assertThat(count2.get(),is(equalTo(0)));
  callables[1].call();
  callables[2].call();
  assertThat(count1.get(),is(equalTo(1)));
  assertThat(count2.get(),is(equalTo(1)));
  callables[0].call();
  callables[2].call();
  assertThat(count1.get(),is(equalTo(1)));
  assertThat(count2.get(),is(equalTo(2)));
}
Program: 86198
Project: 86198
Buggy source:
@Test public void onlyOnce() throws Exception {
  final AtomicInteger totalCount=new AtomicInteger();
  StatefulCallable[] callables=CallableOnChange.fromCallables(new Callable<Void>(){
    public Void call(){
      totalCount.incrementAndGet();
      return null;
    }
  }
);
  StatefulCallable one=callables[0];
  StatefulCallable add=callables[1];
  one.call();
  add.call();
  add.call();
  assertThat(totalCount.get(),is(equalTo(1)));
  one.call();
  add.call();
  add.call();
  add.call();
  assertThat(totalCount.get(),is(equalTo(2)));
}

Fixed version (ground truth):
@Test public void onlyOnce() throws Exception {
  final AtomicInteger totalCount=new AtomicInteger();
  StatefulCallable[] callables=CallableOnChange.fromCallables(new Callable<Void>(){
    @Override public Void call(){
      totalCount.incrementAndGet();
      return null;
    }
  }
);
  StatefulCallable one=callables[0];
  StatefulCallable add=callables[1];
  one.call();
  add.call();
  add.call();
  assertThat(totalCount.get(),is(equalTo(1)));
  one.call();
  add.call();
  add.call();
  add.call();
  assertThat(totalCount.get(),is(equalTo(2)));
}
Program: 86199
Project: 86199
Buggy source:
public DrawCommand[] getDrawCommands(){
  DrawCommand[] commands=new DrawCommand[alphabet.length()];
  for (int i=0; i < commands.length; i++) {
    DrawCommand command=drawCommands.get(alphabet.charAt(i));
    commands[i]=command != null ? command : Draw.NOOP;
  }
  return commands;
}

Fixed version (ground truth):
public DrawCommand[] getDrawCommands(){
  DrawCommand[] commands=new DrawCommand[alphabet.length()];
  for (int i=0; i < commands.length; i++) {
    DrawCommand command=drawCommands.get(alphabet.substring(i,i + 1));
    commands[i]=command != null ? command : Draw.NOOP;
  }
  return commands;
}
Program: 86200
Project: 86200
Buggy source:
public Interval getCurrentInterval(){
  BigFraction now=getNow();
  return new Interval(now.subtract(minimumResolution),now);
}

Fixed version (ground truth):
public Interval getCurrentInterval(){
  BigFraction now=getNow();
  return new Interval(now.subtract(halfMinimum),now.add(halfMinimum));
}
Program: 86201
Project: 86201
Buggy source:
private void archiveOldLogFiles() throws IOException {
  if (config.getDeleteOldFiles()) {
    final File archiveDir=new File(getLogDirectory(),"String_Node_Str");
    archiveDir.mkdir();
    long index=commitIndex - (config.getEntriesPerSnapshot() * 4);
    while (index >= 0) {
      logger.info("String_Node_Str",Long.toHexString(index));
      File file=getFile(index,true);
      if (file.exists()) {
        logger.info("String_Node_Str",file);
        file.renameTo(new File(archiveDir,file.getName()));
      }
 else {
        break;
      }
      index-=config.getEntriesPerFile();
    }
    final Pattern p=Pattern.compile("String_Node_Str");
    for (    File file : getLogDirectory().listFiles()) {
      Matcher m=p.matcher(file.getName());
      if (m.matches()) {
        final long snapIndex=Long.parseLong(m.group(1),16);
        logger.info("String_Node_Str",Long.toHexString(index),file,Long.toHexString(snapIndex));
        if (snapIndex < index) {
          if (index % (config.getEntriesPerSnapshot() * 16) == 0) {
            logger.info("String_Node_Str",file);
            file.renameTo(new File(archiveDir,file.getName()));
          }
 else {
            logger.info("String_Node_Str",file);
            file.delete();
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void archiveOldLogFiles() throws IOException {
  if (config.getDeleteOldFiles()) {
    final File archiveDir=new File(getLogDirectory(),"String_Node_Str");
    archiveDir.mkdir();
    long index=commitIndex - (config.getEntriesPerSnapshot() * 4);
    while (index >= 0) {
      logger.info("String_Node_Str",Long.toHexString(index));
      File file=getFile(index,true);
      if (file.exists()) {
        logger.info("String_Node_Str",file);
        file.renameTo(new File(archiveDir,file.getName()));
      }
 else {
        break;
      }
      index-=config.getEntriesPerFile();
    }
    final Pattern p=Pattern.compile("String_Node_Str");
    for (    File file : getLogDirectory().listFiles()) {
      Matcher m=p.matcher(file.getName());
      if (m.matches()) {
        final long snapIndex=Long.parseLong(m.group(1),16);
        logger.info("String_Node_Str",Long.toHexString(index),file,Long.toHexString(snapIndex));
        if (snapIndex < index) {
          if (snapIndex % (config.getEntriesPerSnapshot() * 16) == 0) {
            logger.info("String_Node_Str",file);
            file.renameTo(new File(archiveDir,file.getName()));
          }
 else {
            logger.info("String_Node_Str",file);
            file.delete();
          }
        }
      }
    }
  }
}
Program: 86202
Project: 86202
Buggy source:
/** 
 * Writes this entry to an output stream
 */
public void write(DataOutputStream out) throws IOException {
  out.writeLong(term);
  out.writeLong(index);
  out.writeInt(command.getCommandType());
  command.write(out);
}

Fixed version (ground truth):
/** 
 * Writes this entry to an output stream
 */
public void write(DataOutputStream out) throws IOException {
}
Program: 86203
Project: 86203
Buggy source:
@Override public void loadState(DataInputStream in,int snapshotVersion) throws IOException {
  int fileVersion=snapshotVersion >= 3 ? in.readInt() : 0;
  items.clear();
  copyOnWrite.clear();
  int numItems=in.readInt();
  while (numItems-- > 0) {
    StorageItem item=new StorageItem(in,fileVersion);
    items.put(item.key,item);
  }
}

Fixed version (ground truth):
@Override public void loadState(DataInputStream in,int snapshotVersion) throws IOException {
  items.clear();
  copyOnWrite.clear();
  int fileVersion=snapshotVersion >= 3 ? in.readInt() : 0;
  int numItems=in.readInt();
  while (numItems-- > 0) {
    StorageItem item=new StorageItem(in,fileVersion);
    items.put(item.key,item);
  }
}
Program: 86204
Project: 86204
Buggy source:
@Override public void saveState(DataOutputStream out) throws IOException {
  final Map<String,StorageItem> modified=new HashMap<>();
  out.write(STORAGE_STATE_FILE_VERSION);
  long writeIndex;
  List<StorageItem> list;
synchronized (copyOnWrite) {
    writeIndex=getIndex();
    copyOnWrite.put(writeIndex,modified);
    list=new ArrayList<StorageItem>(items.values());
  }
  out.writeInt(list.size());
  for (  StorageItem item : list) {
synchronized (copyOnWrite) {
      StorageItem modItem=modified.get(item.key);
      if (modItem != null) {
        modItem.write(out);
      }
 else {
        item.write(out);
      }
    }
  }
synchronized (copyOnWrite) {
    copyOnWrite.remove(writeIndex);
  }
  modified.clear();
}

Fixed version (ground truth):
@Override public void saveState(DataOutputStream out) throws IOException {
  final Map<String,StorageItem> modified=new HashMap<>();
  out.writeInt(STORAGE_STATE_FILE_VERSION);
  long writeIndex;
  List<StorageItem> list;
synchronized (copyOnWrite) {
    writeIndex=getIndex();
    copyOnWrite.put(writeIndex,modified);
    list=new ArrayList<StorageItem>(items.values());
  }
  out.writeInt(list.size());
  for (  StorageItem item : list) {
synchronized (copyOnWrite) {
      StorageItem modItem=modified.get(item.key);
      if (modItem != null) {
        modItem.write(out);
      }
 else {
        item.write(out);
      }
    }
  }
synchronized (copyOnWrite) {
    copyOnWrite.remove(writeIndex);
  }
  modified.clear();
}
Program: 86205
Project: 86205
Buggy source:
private void archiveOldLogFiles() throws IOException {
  if (config.getDeleteOldFiles()) {
    long index=commitIndex - (config.getEntriesPerSnapshot() * 4);
    while (index > 0) {
      File file=getFile(index,true);
      if (file.exists()) {
        logger.info("String_Node_Str",file);
        File newFile=new File("String_Node_Str",file.getName());
        newFile.mkdirs();
        file.renameTo(newFile);
      }
 else {
        break;
      }
      index-=config.getEntriesPerFile();
    }
  }
}

Fixed version (ground truth):
private void archiveOldLogFiles() throws IOException {
  if (config.getDeleteOldFiles()) {
    long index=commitIndex - (config.getEntriesPerSnapshot() * 4);
    while (index > 0) {
      File file=getFile(index,true);
      if (file.exists()) {
        logger.info("String_Node_Str",file);
        File archiveDir=new File(getLogDirectory(),"String_Node_Str");
        archiveDir.mkdir();
        File newFile=new File(archiveDir,file.getName());
        file.renameTo(newFile);
      }
 else {
        break;
      }
      index-=config.getEntriesPerFile();
    }
  }
}
Program: 86206
Project: 86206
Buggy source:
/** 
 * Applies log entries to our state machine until it is at the given index
 */
private synchronized void updateStateMachine(){
  try {
synchronized (stateMachine) {
      while (commitIndex > stateMachine.getIndex()) {
        final Entry<T> e=getEntry(stateMachine.getIndex() + 1);
        assert(e != null);
        stateMachine.apply(e);
        ensureCorrectLogFile(e.index);
        e.write(out);
        if ((e.index % config.getEntriesPerSnapshot()) == 0) {
          saveSnapshot();
        }
      }
    }
  }
 catch (  IOException e) {
    logger.error(e.getMessage(),e);
    running=false;
  }
}

Fixed version (ground truth):
/** 
 * Applies log entries to our state machine until it is at the given index
 */
private synchronized void updateStateMachine(){
  try {
synchronized (stateMachine) {
      while (commitIndex > stateMachine.getIndex()) {
        final Entry<T> e=getEntry(stateMachine.getIndex() + 1);
        assert(e != null);
        assert(e.index == stateMachine.getIndex() + 1);
        stateMachine.apply(e);
        ensureCorrectLogFile(e.index);
        e.write(out);
        if ((e.index % config.getEntriesPerSnapshot()) == 0) {
          saveSnapshot();
        }
      }
    }
  }
 catch (  IOException e) {
    logger.error(e.getMessage(),e);
    running=false;
  }
}