nus-yam/ex-repair huggingface dataset:
Program: 52067
Project: 52067
Buggy source:
/** 
 * send valid login email id and password to web server
 */
@Test public final void testLogin(){
  JSONObject jObjMain=new JSONObject();
  JSONObject jObj=new JSONObject();
  try {
    PhrescoLogger.info(TAG + "String_Node_Str");
    jObj.put("String_Node_Str","String_Node_Str");
    jObj.put("String_Node_Str","String_Node_Str");
    jObjMain.put("String_Node_Str",jObj);
    JSONObject responseJSON=null;
    responseJSON=JSONHelper.postJSONObjectToURL(Constants.getWebContextURL() + Constants.getRestAPI() + Constants.LOGIN_POST_URL,jObjMain.toString());
    assertNotNull("String_Node_Str",responseJSON.length() > 0);
    PhrescoLogger.info(TAG + "String_Node_Str");
  }
 catch (  IOException ex) {
    PhrescoLogger.info(TAG + "String_Node_Str" + ex.toString());
    PhrescoLogger.warning(ex);
  }
catch (  JSONException ex) {
    PhrescoLogger.info(TAG + "String_Node_Str" + ex.toString());
    PhrescoLogger.warning(ex);
  }
}

Fixed version (ground truth):
/** 
 * send valid login email id and password to web server
 */
@Test public final void testLogin() throws Exception {
  JSONObject jObjMain=new JSONObject();
  JSONObject jObj=new JSONObject();
  try {
    PhrescoLogger.info(TAG + "String_Node_Str");
    jObj.put("String_Node_Str","String_Node_Str");
    jObj.put("String_Node_Str","String_Node_Str");
    jObjMain.put("String_Node_Str",jObj);
    JSONObject responseJSON=null;
    responseJSON=JSONHelper.postJSONObjectToURL(Constants.getWebContextURL() + Constants.getRestAPI() + Constants.LOGIN_POST_URL,jObjMain.toString());
    assertNotNull("String_Node_Str",responseJSON.length() > 0);
    PhrescoLogger.info(TAG + "String_Node_Str");
  }
 catch (  IOException ex) {
    PhrescoLogger.info(TAG + "String_Node_Str" + ex.toString());
    PhrescoLogger.warning(ex);
  }
catch (  JSONException ex) {
    PhrescoLogger.info(TAG + "String_Node_Str" + ex.toString());
    PhrescoLogger.warning(ex);
  }
}
Program: 52068
Project: 52068
Buggy source:
/** 
 * Shows the next SuperActivityToast in the list. Called by add() and when the dismiss animation of a previously showing SuperActivityToast ends. 
 */
private void showNextSuperToast(){
  final SuperActivityToast superActivityToast=mList.peek();
  if (mList.isEmpty() || superActivityToast.getActivity() == null) {
    return;
  }
  if (superActivityToast.getType() == SuperToast.Type.PROGRESS_HORIZONTAL) {
    if (superActivityToast.getProgress() == superActivityToast.getMaxProgress()) {
      mList.remove(superActivityToast);
      this.showNextSuperToast();
      return;
    }
  }
  if (!superActivityToast.isShowing()) {
    final Message message=obtainMessage(Messages.DISPLAY);
    message.obj=superActivityToast;
    sendMessage(message);
  }
}

Fixed version (ground truth):
/** 
 * Shows the next SuperActivityToast in the list. Called by add() and when the dismiss animation of a previously showing SuperActivityToast ends. 
 */
private void showNextSuperToast(){
  final SuperActivityToast superActivityToast=mList.peek();
  if (mList.isEmpty() || superActivityToast.getActivity() == null) {
    return;
  }
  if (!superActivityToast.isShowing()) {
    final Message message=obtainMessage(Messages.DISPLAY);
    message.obj=superActivityToast;
    sendMessage(message);
  }
}
Program: 52069
Project: 52069
Buggy source:
/** 
 * Hide and remove the SuperActivityToast 
 */
void removeSuperToast(final SuperActivityToast superActivityToast){
  if (!superActivityToast.isShowing()) {
    return;
  }
  removeMessages(Messages.REMOVE,superActivityToast);
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissWrapper() != null) {
          superActivityToast.getOnDismissWrapper().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}

Fixed version (ground truth):
/** 
 * Hide and remove the SuperActivityToast 
 */
void removeSuperToast(final SuperActivityToast superActivityToast){
  if (!superActivityToast.isShowing()) {
    mList.remove(superActivityToast);
    return;
  }
  removeMessages(Messages.REMOVE,superActivityToast);
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissWrapper() != null) {
          superActivityToast.getOnDismissWrapper().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}
Program: 52070
Project: 52070
Buggy source:
/** 
 * Shows the next SuperActivityToast in the list. Called by add() and when the dismiss animation of a previously showing SuperActivityToast ends. 
 */
private void showNextSuperToast(){
  final SuperActivityToast superActivityToast=mList.peek();
  if (mList.isEmpty() || superActivityToast.getActivity() == null) {
    return;
  }
  if (!superActivityToast.isShowing()) {
    final Message message=obtainMessage(Messages.DISPLAY);
    message.obj=superActivityToast;
    sendMessage(message);
  }
}

Fixed version (ground truth):
/** 
 * Shows the next SuperActivityToast in the list. Called by add() and when the dismiss animation of a previously showing SuperActivityToast ends. 
 */
private void showNextSuperToast(){
  final SuperActivityToast superActivityToast=mList.peek();
  if (mList.isEmpty() || superActivityToast.getActivity() == null) {
    return;
  }
  if (superActivityToast.getType() == SuperToast.Type.PROGRESS_HORIZONTAL) {
    if (superActivityToast.getProgress() == superActivityToast.getMaxProgress()) {
      mList.remove(superActivityToast);
      this.showNextSuperToast();
      return;
    }
  }
  if (!superActivityToast.isShowing()) {
    final Message message=obtainMessage(Messages.DISPLAY);
    message.obj=superActivityToast;
    sendMessage(message);
  }
}
Program: 52071
Project: 52071
Buggy source:
/** 
 * Hide and remove the SuperActivityToast 
 */
void removeSuperToast(final SuperActivityToast superActivityToast){
  removeMessages(Messages.REMOVE);
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissWrapper() != null) {
          superActivityToast.getOnDismissWrapper().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}

Fixed version (ground truth):
/** 
 * Hide and remove the SuperActivityToast 
 */
void removeSuperToast(final SuperActivityToast superActivityToast){
  if (!superActivityToast.isShowing()) {
    return;
  }
  removeMessages(Messages.REMOVE,superActivityToast);
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissWrapper() != null) {
          superActivityToast.getOnDismissWrapper().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}
Program: 52072
Project: 52072
Buggy source:
void add(SuperActivityToast superActivityToast){
  mList.add(superActivityToast);
  this.showNextSuperToast();
}

Fixed version (ground truth):
/** 
 * Add a SuperActivityToast to the list. Will show immediately if no other SuperActivityToasts are in the list. 
 */
void add(SuperActivityToast superActivityToast){
  mList.add(superActivityToast);
  this.showNextSuperToast();
}
Program: 52075
Project: 52075
Buggy source:
private void showNextSuperToast(){
  final SuperActivityToast superActivityToast=mList.peek();
  if (mList.isEmpty() || superActivityToast.getActivity() == null) {
    return;
  }
  if (!superActivityToast.isShowing()) {
    final Message message=obtainMessage(Messages.DISPLAY);
    message.obj=superActivityToast;
    sendMessage(message);
  }
}

Fixed version (ground truth):
/** 
 * Shows the next SuperActivityToast in the list. Called by add() and when the dismiss animation of a previously showing SuperActivityToast ends. 
 */
private void showNextSuperToast(){
  final SuperActivityToast superActivityToast=mList.peek();
  if (mList.isEmpty() || superActivityToast.getActivity() == null) {
    return;
  }
  if (!superActivityToast.isShowing()) {
    final Message message=obtainMessage(Messages.DISPLAY);
    message.obj=superActivityToast;
    sendMessage(message);
  }
}
Program: 52076
Project: 52076
Buggy source:
private void displaySuperToast(SuperActivityToast superActivityToast){
  if (superActivityToast.isShowing()) {
    return;
  }
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    try {
      viewGroup.addView(toastView);
      if (!superActivityToast.getShowImmediate()) {
        toastView.startAnimation(getShowAnimation(superActivityToast));
      }
    }
 catch (    IllegalStateException e) {
      Log.e(TAG,e.toString());
      clearSuperActivityToastsForActivity(superActivityToast.getActivity());
    }
  }
  if (!superActivityToast.isIndeterminate()) {
    Message message=obtainMessage(Messages.REMOVE);
    message.obj=superActivityToast;
    sendMessageDelayed(message,superActivityToast.getDuration() + getShowAnimation(superActivityToast).getDuration());
  }
}

Fixed version (ground truth):
/** 
 * Displays a SuperActivityToast 
 */
private void displaySuperToast(SuperActivityToast superActivityToast){
  if (superActivityToast.isShowing()) {
    return;
  }
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    try {
      viewGroup.addView(toastView);
      if (!superActivityToast.getShowImmediate()) {
        toastView.startAnimation(getShowAnimation(superActivityToast));
      }
    }
 catch (    IllegalStateException e) {
      this.cancelAllSuperActivityToastsForActivity(superActivityToast.getActivity());
    }
  }
  if (!superActivityToast.isIndeterminate()) {
    Message message=obtainMessage(Messages.REMOVE);
    message.obj=superActivityToast;
    sendMessageDelayed(message,superActivityToast.getDuration() + getShowAnimation(superActivityToast).getDuration());
  }
}
Program: 52077
Project: 52077
Buggy source:
@Override public void onAnimationEnd(Animation animation){
  if (superActivityToast.getOnDismissListenerWrapper() != null) {
    superActivityToast.getOnDismissListenerWrapper().onDismiss(superActivityToast.getView());
  }
  ManagerSuperActivityToast.this.showNextSuperToast();
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  if (superActivityToast.getOnDismissWrapper() != null) {
    superActivityToast.getOnDismissWrapper().onDismiss(superActivityToast.getView());
  }
  ManagerSuperActivityToast.this.showNextSuperToast();
}
Program: 52078
Project: 52078
Buggy source:
LinkedList<SuperActivityToast> getList(){
  return mList;
}

Fixed version (ground truth):
/** 
 * Used in SuperActivityToast saveState() 
 */
LinkedList<SuperActivityToast> getList(){
  return mList;
}
Program: 52079
Project: 52079
Buggy source:
private ManagerSuperActivityToast(){
  mList=new LinkedList<SuperActivityToast>();
}

Fixed version (ground truth):
/** 
 * Private method to create a new list if the manager is being initialized 
 */
private ManagerSuperActivityToast(){
  mList=new LinkedList<SuperActivityToast>();
}
Program: 52080
Project: 52080
Buggy source:
static synchronized ManagerSuperActivityToast getInstance(){
  if (mManagerSuperActivityToast != null) {
    return mManagerSuperActivityToast;
  }
 else {
    mManagerSuperActivityToast=new ManagerSuperActivityToast();
    return mManagerSuperActivityToast;
  }
}

Fixed version (ground truth):
/** 
 * Singleton method to ensure all SuperActivityToasts are passed through the same manager 
 */
static synchronized ManagerSuperActivityToast getInstance(){
  if (mManagerSuperActivityToast != null) {
    return mManagerSuperActivityToast;
  }
 else {
    mManagerSuperActivityToast=new ManagerSuperActivityToast();
    return mManagerSuperActivityToast;
  }
}
Program: 52081
Project: 52081
Buggy source:
void removeSuperToast(final SuperActivityToast superActivityToast){
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissListenerWrapper() != null) {
          superActivityToast.getOnDismissListenerWrapper().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}

Fixed version (ground truth):
/** 
 * Hide and remove the SuperActivityToast 
 */
void removeSuperToast(final SuperActivityToast superActivityToast){
  removeMessages(Messages.REMOVE);
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissWrapper() != null) {
          superActivityToast.getOnDismissWrapper().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}
Program: 52082
Project: 52082
Buggy source:
/** 
 * Sets the duration that the   {@value #TAG} will show.
 * @param duration {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
 */
public void setDuration(int duration){
  if (duration > 7000) {
    Log.w(TAG,TAG + WARNING_DURATIONTOOLONG);
    this.mDuration=Duration.EXTRA_LONG;
  }
 else {
    this.mDuration=duration;
  }
}

Fixed version (ground truth):
/** 
 * Sets the duration that the   {@value #TAG} will show.
 * @param duration {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
 */
public void setDuration(int duration){
  if (duration > Duration.EXTRA_LONG) {
    Log.e(TAG,TAG + ERROR_DURATIONTOOLONG);
    this.mDuration=Duration.EXTRA_LONG;
  }
 else {
    this.mDuration=duration;
  }
}
Program: 52083
Project: 52083
Buggy source:
/** 
 * Returns a dark themed   {@value #TAG} with specified animations.
 * @param context          {@link android.content.Context}
 * @param textCharSequence {@link java.lang.CharSequence}
 * @param durationInteger  {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
 * @param animations       {@link com.github.johnpersano.supertoasts.SuperToast.Animations}
 * @return {@link com.github.johnpersano.supertoasts.SuperToast}
 */
public static SuperToast createSuperToast(Context context,CharSequence textCharSequence,int durationInteger,Animations animations){
  SuperToast superToast=new SuperToast(context);
  superToast.setText(textCharSequence);
  superToast.setDuration(durationInteger);
  superToast.setAnimations(animations);
  return superToast;
}

Fixed version (ground truth):
/** 
 * Returns a   {@value #TAG} with a specified style.
 * @param context          {@link android.content.Context}
 * @param textCharSequence {@link java.lang.CharSequence}
 * @param durationInteger  {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
 * @param style            {@link com.github.johnpersano.supertoasts.util.Style}
 * @return SuperCardToast
 */
public static SuperToast createSuperToast(Context context,CharSequence textCharSequence,int durationInteger,Style style){
  final SuperToast superToast=new SuperToast(context);
  superToast.setText(textCharSequence);
  superToast.setDuration(durationInteger);
  superToast.setStyle(style);
  return superToast;
}
Program: 52084
Project: 52084
Buggy source:
/** 
 * Instantiates a new   {@value #TAG} with a specified default style.
 * @param context      {@link android.content.Context}
 * @param defaultStyle {@link com.github.johnpersano.supertoasts.util.DefaultStyle}
 */
public SuperToast(Context context,DefaultStyle defaultStyle){
  if (context == null) {
    throw new IllegalArgumentException(TAG + ERROR_CONTEXTNULL);
  }
  this.mContext=context;
  mYOffset=context.getResources().getDimensionPixelSize(R.dimen.toast_yoffset);
  final LayoutInflater layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mToastView=layoutInflater.inflate(R.layout.supertoast,null);
  mWindowManager=(WindowManager)mToastView.getContext().getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
  mRootLayout=(LinearLayout)mToastView.findViewById(R.id.root_layout);
  mMessageTextView=(TextView)mToastView.findViewById(R.id.message_textView);
  this.setDefaultStyle(defaultStyle);
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@value #TAG} with a specified style.
 * @param context {@link android.content.Context}
 * @param style   {@link com.github.johnpersano.supertoasts.util.Style}
 */
public SuperToast(Context context,Style style){
  if (context == null) {
    throw new IllegalArgumentException(TAG + ERROR_CONTEXTNULL);
  }
  this.mContext=context;
  mYOffset=context.getResources().getDimensionPixelSize(R.dimen.toast_yoffset);
  final LayoutInflater layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mToastView=layoutInflater.inflate(R.layout.supertoast,null);
  mWindowManager=(WindowManager)mToastView.getContext().getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
  mRootLayout=(LinearLayout)mToastView.findViewById(R.id.root_layout);
  mMessageTextView=(TextView)mToastView.findViewById(R.id.message_textView);
  this.setStyle(style);
}
Program: 52085
Project: 52085
Buggy source:
/** 
 * Sets the gravity of the   {@value #TAG}.
 * @param gravity U{@link android.view.Gravity} int
 */
public void setGravity(int gravity){
  this.mGravity=gravity;
}

Fixed version (ground truth):
/** 
 * Sets the gravity of the   {@value #TAG} along with x and y offsets.
 * @param gravity {@link android.view.Gravity} int
 * @param xOffset int
 * @param yOffset int
 */
public void setGravity(int gravity,int xOffset,int yOffset){
  this.mGravity=gravity;
  this.mXOffset=xOffset;
  this.mYOffset=yOffset;
}
Program: 52086
Project: 52086
Buggy source:
@Override public void onAnimationUpdate(ValueAnimator valueAnimator){
  layoutParams.height=(Integer)valueAnimator.getAnimatedValue();
  mToastView.setLayoutParams(layoutParams);
}

Fixed version (ground truth):
@Override public void onAnimationUpdate(ValueAnimator valueAnimator){
  if (mToastView != null) {
    layoutParams.height=(Integer)valueAnimator.getAnimatedValue();
    mToastView.setLayoutParams(layoutParams);
  }
}
Program: 52087
Project: 52087
Buggy source:
/** 
 * Hide the SuperCardToast and animate the Layout. Post Honeycomb only. 
 */
@SuppressLint("String_Node_Str") private void dismissWithLayoutAnimation(){
  if (mToastView != null) {
    mToastView.setVisibility(View.INVISIBLE);
    final ViewGroup.LayoutParams layoutParams=mToastView.getLayoutParams();
    final int originalHeight=mToastView.getHeight();
    ValueAnimator animator=ValueAnimator.ofInt(originalHeight,1).setDuration(mContext.getResources().getInteger(android.R.integer.config_shortAnimTime));
    animator.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        Handler mHandler=new Handler();
        mHandler.post(mHideImmediateRunnable);
      }
    }
);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
      @Override public void onAnimationUpdate(      ValueAnimator valueAnimator){
        layoutParams.height=(Integer)valueAnimator.getAnimatedValue();
        mToastView.setLayoutParams(layoutParams);
      }
    }
);
    animator.start();
  }
 else {
    dismissImmediately();
  }
}

Fixed version (ground truth):
/** 
 * Hide the SuperCardToast and animate the Layout. Post Honeycomb only. 
 */
@SuppressLint("String_Node_Str") private void dismissWithLayoutAnimation(){
  if (mToastView != null) {
    mToastView.setVisibility(View.INVISIBLE);
    final ViewGroup.LayoutParams layoutParams=mToastView.getLayoutParams();
    final int originalHeight=mToastView.getHeight();
    ValueAnimator animator=ValueAnimator.ofInt(originalHeight,1).setDuration(mContext.getResources().getInteger(android.R.integer.config_shortAnimTime));
    animator.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        Handler mHandler=new Handler();
        mHandler.post(mHideImmediateRunnable);
      }
    }
);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
      @Override public void onAnimationUpdate(      ValueAnimator valueAnimator){
        if (mToastView != null) {
          layoutParams.height=(Integer)valueAnimator.getAnimatedValue();
          mToastView.setLayoutParams(layoutParams);
        }
      }
    }
);
    animator.start();
  }
 else {
    dismissImmediately();
  }
}
Program: 52090
Project: 52090
Buggy source:
@Override public void onAnimationEnd(Animation animation){
  if (superActivityToast.getOnDismissListener() != null) {
    superActivityToast.getOnDismissListener().onDismiss(superActivityToast.getView());
  }
  ManagerSuperActivityToast.this.showNextSuperToast();
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  if (superActivityToast.getOnDismissListenerWrapper() != null) {
    superActivityToast.getOnDismissListenerWrapper().onDismiss(superActivityToast.getView());
  }
  ManagerSuperActivityToast.this.showNextSuperToast();
}
Program: 52091
Project: 52091
Buggy source:
void removeSuperToast(final SuperActivityToast superActivityToast){
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissListener() != null) {
          superActivityToast.getOnDismissListener().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}

Fixed version (ground truth):
void removeSuperToast(final SuperActivityToast superActivityToast){
  final ViewGroup viewGroup=superActivityToast.getViewGroup();
  final View toastView=superActivityToast.getView();
  if (viewGroup != null) {
    Animation animation=getDismissAnimation(superActivityToast);
    animation.setAnimationListener(new Animation.AnimationListener(){
      @Override public void onAnimationStart(      Animation animation){
      }
      @Override public void onAnimationEnd(      Animation animation){
        if (superActivityToast.getOnDismissListenerWrapper() != null) {
          superActivityToast.getOnDismissListenerWrapper().onDismiss(superActivityToast.getView());
        }
        ManagerSuperActivityToast.this.showNextSuperToast();
      }
      @Override public void onAnimationRepeat(      Animation animation){
      }
    }
);
    toastView.startAnimation(animation);
    viewGroup.removeView(toastView);
    mList.poll();
  }
}
Program: 52092
Project: 52092
Buggy source:
protected void clearQueue(){
  removeMessages(Messages.ADD);
  removeMessages(Messages.DISPLAY);
  removeMessages(Messages.REMOVE);
  if (mList != null) {
    for (    SuperActivityToast superActivityToast : mList) {
      if (superActivityToast.isShowing()) {
        superActivityToast.getViewGroup().removeView(superActivityToast.getView());
      }
    }
    mList.clear();
  }
}

Fixed version (ground truth):
protected void clearQueue(){
  removeMessages(Messages.ADD);
  removeMessages(Messages.DISPLAY);
  removeMessages(Messages.REMOVE);
  if (mList != null) {
    for (    SuperActivityToast superActivityToast : mList) {
      if (superActivityToast.isShowing()) {
        superActivityToast.getViewGroup().removeView(superActivityToast.getView());
        superActivityToast.getViewGroup().invalidate();
      }
    }
    mList.clear();
  }
}
Program: 52093
Project: 52093
Buggy source:
/** 
 * Sets the text size of the SuperCardToast. <br>
 * @param textSize
 */
public void setTextSizeFloat(float textSize){
  mMessageTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP,textSize);
}

Fixed version (ground truth):
/** 
 * Sets the text size of the SuperCardToast. <br>
 * @param textSize
 */
public void setTextSizeFloat(float textSize){
  mMessageTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,textSize);
}
Program: 52094
Project: 52094
Buggy source:
/** 
 * Sets the text size of the Button in a BUTTON Type SuperCardToast <br>
 * @param buttonTextSize
 */
public void setButtonTextSizeFloat(float buttonTextSize){
  mMessageTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP,buttonTextSize);
}

Fixed version (ground truth):
/** 
 * Sets the text size of the Button in a BUTTON Type SuperCardToast <br>
 * @param buttonTextSize
 */
public void setButtonTextSizeFloat(float buttonTextSize){
  mMessageTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,buttonTextSize);
}
Program: 52096
Project: 52096
Buggy source:
private void updateDisplay(){
  if (this.mDayOfWeekView != null)   this.mDayOfWeekView.setText(dateformartsymbols.getWeekdays()[Calendar.DAY_OF_WEEK].toUpperCase(Locale.getDefault()));
  this.mSelectedMonthTextView.setText(dateformartsymbols.getMonths()[this.mCalendar.getTime().getMonth()].toUpperCase(Locale.getDefault()));
  this.mSelectedDayTextView.setText(DAY_FORMAT.format(this.mCalendar.getTime()));
  this.mYearView.setText(YEAR_FORMAT.format(this.mCalendar.getTime()));
  long timeInMillis=this.mCalendar.getTimeInMillis();
  String desc=DateUtils.formatDateTime(getActivity(),timeInMillis,24);
  this.mMonthAndDayView.setContentDescription(desc);
}

Fixed version (ground truth):
private void updateDisplay(){
  if (this.mDayOfWeekView != null) {
    this.mCalendar.setFirstDayOfWeek(mWeekStart);
    this.mDayOfWeekView.setText(dateformartsymbols.getWeekdays()[this.mCalendar.get(Calendar.DAY_OF_WEEK)].toUpperCase(Locale.getDefault()));
  }
  this.mSelectedMonthTextView.setText(dateformartsymbols.getMonths()[this.mCalendar.get(Calendar.MONTH)].toUpperCase(Locale.getDefault()));
  this.mSelectedDayTextView.setText(DAY_FORMAT.format(this.mCalendar.getTime()));
  this.mYearView.setText(YEAR_FORMAT.format(this.mCalendar.getTime()));
  long timeInMillis=this.mCalendar.getTimeInMillis();
  String desc=DateUtils.formatDateTime(getActivity(),timeInMillis,24);
  this.mMonthAndDayView.setContentDescription(desc);
}
Program: 52097
Project: 52097
Buggy source:
private void drawMonthDayLabels(Canvas canvas){
  int y=MONTH_HEADER_SIZE - MONTH_DAY_LABEL_TEXT_SIZE / 2;
  int space=(this.mWidth - 2 * this.mPadding) / (2 * this.mNumDays);
  for (int day=0; day < this.mNumDays; day++) {
    int dayOfWeek=(day + this.mWeekStart) % this.mNumDays;
    int x=space * (1 + day * 2) + this.mPadding;
    this.mDayLabelCalendar.set(Calendar.DAY_OF_WEEK,dayOfWeek);
    canvas.drawText(dateformartsymbols.getShortWeekdays()[dayOfWeek + 1].toUpperCase(Locale.getDefault()),x,y,this.mMonthDayLabelPaint);
  }
}

Fixed version (ground truth):
private void drawMonthDayLabels(Canvas canvas){
  int y=MONTH_HEADER_SIZE - MONTH_DAY_LABEL_TEXT_SIZE / 2;
  int space=(this.mWidth - 2 * this.mPadding) / (2 * this.mNumDays);
  for (int day=0; day < this.mNumDays; day++) {
    int dayOfWeek=(day + this.mWeekStart) % this.mNumDays;
    int x=space * (1 + day * 2) + this.mPadding;
    this.mDayLabelCalendar.set(Calendar.DAY_OF_WEEK,dayOfWeek);
    canvas.drawText(dateformartsymbols.getShortWeekdays()[this.mDayLabelCalendar.get(Calendar.DAY_OF_WEEK)].toUpperCase(Locale.getDefault()),x,y,this.mMonthDayLabelPaint);
  }
}
Program: 52098
Project: 52098
Buggy source:
private void setFirstAndLastCycle(){
  long now=time.currentTimeMillis();
  if (now == firstAndLastCycleTime) {
    return;
  }
  firstCycle=directoryListing.getMinCreatedCycle();
  lastCycle=directoryListing.getMaxCreatedCycle();
  firstAndLastCycleTime=now;
  firstAndLastRetry=0;
}

Fixed version (ground truth):
private void setFirstAndLastCycle(){
  long now=time.currentTimeMillis();
  if (now == firstAndLastCycleTime) {
    if (++firstAndLastRetry > FIRST_AND_LAST_RETRY_MAX)     return;
  }
  firstCycle=directoryListing.getMinCreatedCycle();
  lastCycle=directoryListing.getMaxCreatedCycle();
  firstAndLastCycleTime=now;
  firstAndLastRetry=0;
}
Program: 52099
Project: 52099
Buggy source:
@Override public long toIndex(long headerNumber,long sequence){
  int cycle=toCycle(headerNumber);
  return toLongValue(cycle,sequence);
}

Fixed version (ground truth):
@Override public long toIndex(long headerNumber,long sequence){
  long cycle=toLowerBitsWritePosition(headerNumber);
  return toLongValue(cycle,sequence);
}
Program: 52100
Project: 52100
Buggy source:
private long toLowerBitsWritePosition(long index){
  return index >> cycleShift;
}

Fixed version (ground truth):
private long toLowerBitsWritePosition(long index){
  return index >>> cycleShift;
}
Program: 52101
Project: 52101
Buggy source:
/** 
 * gets the sequence for a writePosition <p> This method will only return a valid sequence number of the write position if the write position is the last write position in the queue. YOU CAN NOT USE THIS METHOD TO LOOK UP RANDOM SEQUENCES FOR ANY WRITE POSITION. NOT_FOUND_RETRY will be return if a sequence number can not be found  ( so can retry ) or NOT_FOUND when you should not retry
 * @param forWritePosition the last write position, expected to be the end of queue
 * @return NOT_FOUND_RETRY if the sequence for this write position can not be found, or NOT_FOUND if sequenceValue==null or the sequence for this {@code writePosition}
 */
public long getSequence(long forWritePosition){
  if (writePositionAndSequence == null)   return Sequence.NOT_FOUND;
  final long sequenceValue=this.writePositionAndSequence.getVolatileValue2();
  if (sequenceValue == 0)   return Sequence.NOT_FOUND;
  int writePositionCycle=(int)cycleMask(forWritePosition);
  final long lowerBitsOfWp=toLowerBitsWritePosition(toLongValue(writePositionCycle,0));
  final long toLowerBitsWritePosition=toLowerBitsWritePosition(cycleMask(sequenceValue));
  if (lowerBitsOfWp == toLowerBitsWritePosition)   return toSequenceNumber(sequenceValue);
  return Sequence.NOT_FOUND_RETRY;
}

Fixed version (ground truth):
/** 
 * gets the sequence for a writePosition <p> This method will only return a valid sequence number of the write position if the write position is the last write position in the queue. YOU CAN NOT USE THIS METHOD TO LOOK UP RANDOM SEQUENCES FOR ANY WRITE POSITION. NOT_FOUND_RETRY will be return if a sequence number can not be found  ( so can retry ) or NOT_FOUND when you should not retry
 * @param forWritePosition the last write position, expected to be the end of queue
 * @return NOT_FOUND_RETRY if the sequence for this write position can not be found, or NOT_FOUND if sequenceValue==null or the sequence for this {@code writePosition}
 */
public long getSequence(long forWritePosition){
  if (writePositionAndSequence == null)   return Sequence.NOT_FOUND;
  final long sequenceValue=this.writePositionAndSequence.getVolatileValue2();
  if (sequenceValue == 0)   return Sequence.NOT_FOUND;
  long writePositionAsCycle=toLongValue(forWritePosition,0);
  long lowerBitsOfWp=toLowerBitsWritePosition(writePositionAsCycle);
  final long toLowerBitsWritePosition=toLowerBitsWritePosition(sequenceValue);
  if (lowerBitsOfWp == toLowerBitsWritePosition)   return toSequenceNumber(sequenceValue);
  return Sequence.NOT_FOUND_RETRY;
}
Program: 52102
Project: 52102
Buggy source:
@NotNull default <T>MethodWriterBuilder<T> methodWriterBuilder(@NotNull Class<T> tClass){
  ChronicleQueue queue=queue();
  return new MethodWriterBuilder<>(tClass,new BinaryMethodWriterInvocationHandler(queue::acquireAppender));
}

Fixed version (ground truth):
@NotNull default <T>MethodWriterBuilder<T> methodWriterBuilder(@NotNull Class<T> tClass){
  return queue().methodWriterBuilder(tClass);
}
Program: 52103
Project: 52103
Buggy source:
default <T>T methodWriter(@NotNull Class<T> tClass,Class... additional){
  Class[] interfaces=ObjectUtils.addAll(tClass,additional);
  ChronicleQueue queue=queue();
  return (T)Proxy.newProxyInstance(tClass.getClassLoader(),interfaces,new BinaryMethodWriterInvocationHandler(queue::acquireAppender));
}

Fixed version (ground truth):
@NotNull default <T>T methodWriter(@NotNull Class<T> tClass,Class... additional){
  return queue().methodWriter(tClass,additional);
}
Program: 52105
Project: 52105
Buggy source:
@Override public void writeMarshallable(@NotNull WireOut wire){
  if (lastAcknowledgedIndexReplicated == null)   lastAcknowledgedIndexReplicated=wire.newLongReference();
  wire.write(MetaDataField.wireType).asEnum(wireType).writeAlignTo(8,0).write(MetaDataField.writePosition).int64forBinding(0L,writePosition).write(MetaDataField.roll).typedMarshallable(this.roll).write(MetaDataField.indexing).typedMarshallable(this.indexing).write(MetaDataField.lastAcknowledgedIndexReplicated).int64forBinding(-1L,lastAcknowledgedIndexReplicated);
  wire.write(MetaDataField.recovery).typedMarshallable(recovery);
  wire.write(MetaDataField.deltaCheckpointInterval).int32(this.deltaCheckpointInterval);
  wire.padToCacheAlign();
}

Fixed version (ground truth):
@Override public void writeMarshallable(@NotNull WireOut wire){
  if (lastAcknowledgedIndexReplicated == null)   lastAcknowledgedIndexReplicated=wire.newLongReference();
  wire.write(MetaDataField.wireType).object(wireType).writeAlignTo(8,0).write(MetaDataField.writePosition).int64forBinding(0L,writePosition).write(MetaDataField.roll).typedMarshallable(this.roll).write(MetaDataField.indexing).typedMarshallable(this.indexing).write(MetaDataField.lastAcknowledgedIndexReplicated).int64forBinding(-1L,lastAcknowledgedIndexReplicated);
  wire.write(MetaDataField.recovery).typedMarshallable(recovery);
  wire.write(MetaDataField.deltaCheckpointInterval).int32(this.deltaCheckpointInterval);
  wire.padToCacheAlign();
}
Program: 52106
Project: 52106
Buggy source:
@NotNull @Override public DocumentContext readingDocument(boolean includeMetaData){
  try {
    boolean next=false, tryAgain=true;
    if (state == FOUND_CYCLE) {
      try {
        next=inACycle(includeMetaData,true);
        tryAgain=false;
      }
 catch (      EOFException eof) {
        state=TailerState.END_OF_CYCLE;
      }
    }
    if (tryAgain)     next=next0(includeMetaData);
    if (context.present(next)) {
      context.setStart(context.wire().bytes().readPosition() - 4);
      return context;
    }
    RollCycle rollCycle=queue.rollCycle();
    if (state == CYCLE_NOT_FOUND && direction == FORWARD) {
      int firstCycle=queue.firstCycle();
      if (rollCycle.toCycle(index) < firstCycle)       toStart();
    }
  }
 catch (  StreamCorruptedException e) {
    throw new IllegalStateException(e);
  }
catch (  UnrecoverableTimeoutException notComplete) {
  }
catch (  DecoratedBufferUnderflowException e) {
    if (queue.isReadOnly()) {
      Jvm.warn().on(StoreTailer.class,"String_Node_Str" + "String_Node_Str",e);
    }
 else {
      throw e;
    }
  }
  return NoDocumentContext.INSTANCE;
}

Fixed version (ground truth):
@NotNull @Override public DocumentContext readingDocument(boolean includeMetaData){
  try {
    boolean next=false, tryAgain=true;
    if (state == FOUND_CYCLE) {
      try {
        next=inACycle(includeMetaData,true);
        tryAgain=false;
      }
 catch (      EOFException eof) {
        state=TailerState.END_OF_CYCLE;
      }
    }
    if (tryAgain)     next=next0(includeMetaData);
    if (context.present(next)) {
      context.setStart(context.wire().bytes().readPosition() - 4);
      readingDocumentFound=true;
      return context;
    }
    RollCycle rollCycle=queue.rollCycle();
    if (state == CYCLE_NOT_FOUND && direction == FORWARD) {
      int firstCycle=queue.firstCycle();
      if (rollCycle.toCycle(index) < firstCycle)       toStart();
    }
  }
 catch (  StreamCorruptedException e) {
    throw new IllegalStateException(e);
  }
catch (  UnrecoverableTimeoutException notComplete) {
  }
catch (  DecoratedBufferUnderflowException e) {
    if (queue.isReadOnly()) {
      Jvm.warn().on(StoreTailer.class,"String_Node_Str" + "String_Node_Str",e);
    }
 else {
      throw e;
    }
  }
  return NoDocumentContext.INSTANCE;
}
Program: 52107
Project: 52107
Buggy source:
private static void expected(@NotNull ExcerptTailer tailer,String expected){
  try (DocumentContext dc=tailer.readingDocument()){
    assertTrue(dc.isPresent());
    Bytes bytes2=Bytes.elasticHeapByteBuffer(128);
    dc.wire().copyTo(new TextWire(bytes2));
    assertEquals(expected,bytes2.toString());
  }
 }

Fixed version (ground truth):
private static void expected(@NotNull ExcerptTailer tailer,String expected){
  try (DocumentContext dc=tailer.readingDocument()){
    assertTrue("String_Node_Str",dc.isPresent());
    Bytes bytes2=Bytes.elasticHeapByteBuffer(128);
    dc.wire().copyTo(new TextWire(bytes2));
    assertEquals(expected,bytes2.toString());
  }
 }
Program: 52108
Project: 52108
Buggy source:
@Nullable public synchronized WireStore acquire(final int cycle,final long epoch,boolean createIfAbsent){
  RollDetails rollDetails=new RollDetails(cycle,epoch);
  WireStore store=stores.get(rollDetails);
  if (store != null) {
    if (store.tryReserve())     return store;
 else     stores.remove(rollDetails);
  }
  store=this.supplier.acquire(cycle,createIfAbsent);
  if (store != null) {
    store.reserve();
    stores.put(rollDetails,store);
    storeFileListener.onAcquired(cycle,store.file());
  }
  return store;
}

Fixed version (ground truth):
@Nullable public synchronized WireStore acquire(final int cycle,final long epoch,boolean createIfAbsent){
  RollDetails rollDetails=new RollDetails(cycle,epoch);
  WireStore store=stores.get(rollDetails);
  if (store != null) {
    if (store.tryReserve())     return store;
 else     stores.remove(rollDetails);
  }
  store=this.supplier.acquire(cycle,createIfAbsent);
  if (store != null) {
    stores.put(rollDetails,store);
    storeFileListener.onAcquired(cycle,store.file());
  }
  return store;
}
Program: 52109
Project: 52109
Buggy source:
@Test public void tailerToEndIncreasesRefCount() throws Exception {
  String path=OS.TARGET + "String_Node_Str" + System.nanoTime();
  IOTools.shallowDeleteDirWithFiles(path);
  SetTimeProvider time=new SetTimeProvider();
  long now=System.currentTimeMillis();
  time.currentTimeMillis(now);
  RollingChronicleQueue queue=SingleChronicleQueueBuilder.binary(path).testBlockSize().rollCycle(RollCycles.TEST_SECONDLY).timeProvider(time).build();
  final SingleChronicleQueueExcerpts.StoreAppender appender=(SingleChronicleQueueExcerpts.StoreAppender)queue.acquireAppender();
  Field storeF1=SingleChronicleQueueExcerpts.StoreAppender.class.getDeclaredField("String_Node_Str");
  storeF1.setAccessible(true);
  SingleChronicleQueueStore store1=(SingleChronicleQueueStore)storeF1.get(appender);
  System.out.println(store1);
  appender.writeDocument(wire -> wire.write(() -> "String_Node_Str").int32(1));
  final SingleChronicleQueueExcerpts.StoreTailer tailer=(SingleChronicleQueueExcerpts.StoreTailer)queue.createTailer();
  System.out.println(tailer);
  tailer.toEnd();
  System.out.println(tailer);
  Field storeF2=SingleChronicleQueueExcerpts.StoreTailer.class.getDeclaredField("String_Node_Str");
  storeF2.setAccessible(true);
  SingleChronicleQueueStore store2=(SingleChronicleQueueStore)storeF2.get(tailer);
  assertEquals(3,store2.refCount());
}

Fixed version (ground truth):
@Test public void tailerToEndIncreasesRefCount() throws Exception {
  String path=OS.TARGET + "String_Node_Str" + System.nanoTime();
  IOTools.shallowDeleteDirWithFiles(path);
  SetTimeProvider time=new SetTimeProvider();
  long now=System.currentTimeMillis();
  time.currentTimeMillis(now);
  RollingChronicleQueue queue=SingleChronicleQueueBuilder.binary(path).testBlockSize().rollCycle(RollCycles.TEST_SECONDLY).timeProvider(time).build();
  final SingleChronicleQueueExcerpts.StoreAppender appender=(SingleChronicleQueueExcerpts.StoreAppender)queue.acquireAppender();
  Field storeF1=SingleChronicleQueueExcerpts.StoreAppender.class.getDeclaredField("String_Node_Str");
  storeF1.setAccessible(true);
  SingleChronicleQueueStore store1=(SingleChronicleQueueStore)storeF1.get(appender);
  System.out.println(store1);
  appender.writeDocument(wire -> wire.write(() -> "String_Node_Str").int32(1));
  final SingleChronicleQueueExcerpts.StoreTailer tailer=(SingleChronicleQueueExcerpts.StoreTailer)queue.createTailer();
  System.out.println(tailer);
  tailer.toEnd();
  System.out.println(tailer);
  Field storeF2=SingleChronicleQueueExcerpts.StoreTailer.class.getDeclaredField("String_Node_Str");
  storeF2.setAccessible(true);
  SingleChronicleQueueStore store2=(SingleChronicleQueueStore)storeF2.get(tailer);
  assertEquals(2,store2.refCount());
}
Program: 52110
Project: 52110
Buggy source:
/** 
 * @param store the {@code store} to release
 */
void release(@NotNull WireStore store);

Fixed version (ground truth):
/** 
 * @param store the {@code store} to release
 */
void release(WireStore store);
Program: 52111
Project: 52111
Buggy source:
/** 
 * Reverse look up an index for a position.
 * @param ec       the wire of the bytes, to work with
 * @param position of the start of the message
 * @return index in this store.
 */
long sequenceForPosition(ExcerptContext ec,long position,boolean inclusive) throws EOFException, UnrecoverableTimeoutException, StreamCorruptedException ;

Fixed version (ground truth):
/** 
 * Reverse look up an index for a position.
 * @param ec       the wire of the bytes, to work with
 * @param position of the start of the message
 * @return index in this store.
 */
long sequenceForPosition(ExcerptContext ec,long position,boolean inclusive) throws UnrecoverableTimeoutException, StreamCorruptedException ;
Program: 52112
Project: 52112
Buggy source:
@Nullable public synchronized WireStore acquire(final int cycle,final long epoch,boolean createIfAbsent){
  RollDetails rollDetails=new RollDetails(cycle,epoch);
  WireStore store=stores.get(rollDetails);
  if (store != null) {
    if (store.tryReserve())     return store;
 else     stores.remove(rollDetails);
  }
  store=this.supplier.acquire(cycle,createIfAbsent);
  if (store != null) {
    stores.put(rollDetails,store);
    storeFileListener.onAcquired(cycle,store.file());
  }
  return store;
}

Fixed version (ground truth):
@Nullable public synchronized WireStore acquire(final int cycle,final long epoch,boolean createIfAbsent){
  RollDetails rollDetails=new RollDetails(cycle,epoch);
  WireStore store=stores.get(rollDetails);
  if (store != null) {
    if (store.tryReserve())     return store;
 else     stores.remove(rollDetails);
  }
  store=this.supplier.acquire(cycle,createIfAbsent);
  if (store != null) {
    store.reserve();
    stores.put(rollDetails,store);
    storeFileListener.onAcquired(cycle,store.file());
  }
  return store;
}
Program: 52113
Project: 52113
Buggy source:
LongArrayValues getIndex2index(StoreRecovery recovery,ExcerptContext ec,long timeoutMS) throws EOFException, UnrecoverableTimeoutException, StreamCorruptedException {
  LongArrayValuesHolder holder=getIndex2IndexArray();
  LongArrayValues values=holder.values;
  if (((Byteable)values).bytesStore() != null || timeoutMS == 0)   return values;
  final long indexToIndex0=indexToIndex(recovery,ec,timeoutMS);
  Wire wire=ec.wireForIndex();
  for (; ; ) {
    try (DocumentContext context=wire.readingDocument(indexToIndex0)){
      if (!context.isPresent() || !context.isMetaData()) {
        wire.pauser().pause();
        continue;
      }
      return array(wire,values,true);
    }
   }
}

Fixed version (ground truth):
private LongArrayValues getIndex2index(StoreRecovery recovery,ExcerptContext ec,long timeoutMS) throws EOFException, UnrecoverableTimeoutException, StreamCorruptedException {
  LongArrayValuesHolder holder=getIndex2IndexArray();
  LongArrayValues values=holder.values;
  if (((Byteable)values).bytesStore() != null || timeoutMS == 0)   return values;
  final long indexToIndex0=indexToIndex(recovery,ec,timeoutMS);
  Wire wire=ec.wireForIndex();
  for (; ; ) {
    try (DocumentContext context=wire.readingDocument(indexToIndex0)){
      if (!context.isPresent() || !context.isMetaData()) {
        wire.pauser().pause();
        continue;
      }
      return array(wire,values,true);
    }
   }
}