Program: 32627
Project: 32627
Buggy source:
private synchronized void putSomeRowInMiddle(ListView listView,MonthYearAdapter adapter){
  for (int i=0; i <= listView.getLastVisiblePosition() - listView.getFirstVisiblePosition(); i++) {
    final View v=listView.getChildAt(i);
    if (v != null) {
      if (mMiddlePositionInScreen == 0) {
        mMiddlePositionInScreen=mRootLayoutHeight / 3 + v.getHeight() / 2;
        mBottomPositionOfMiddleElement=mRootLayoutHeight / 3 + v.getHeight();
      }
      if ((v.getTop() >= mRootLayoutHeight / 3 - listView.getDividerHeight() / 2) && v.getTop() < mMiddlePositionInScreen) {
        scrollUp(listView,v,v.getTop(),listView,adapter,listView.getFirstVisiblePosition() + i);
        break;
      }
      if ((v.getBottom() >= mMiddlePositionInScreen) && v.getBottom() <= mBottomPositionOfMiddleElement + listView.getDividerHeight() / 2) {
        scrollDown(listView,v,v.getBottom(),v.getHeight(),listView,adapter,listView.getFirstVisiblePosition() + i);
        break;
      }
      if (v.getBottom() <= mMiddlePositionInScreen && v.getBottom() > mRootLayoutHeight / 3) {
        if (v.getBottom() + listView.getDividerHeight() / 2 >= mMiddlePositionInScreen) {
          scrollDown(listView,v,v.getBottom(),v.getHeight(),listView,adapter,listView.getFirstVisiblePosition() + i);
          break;
        }
      }
      if (v.getTop() >= mMiddlePositionInScreen && v.getTop() < mBottomPositionOfMiddleElement) {
        if (v.getTop() - listView.getDividerHeight() / 2 <= mMiddlePositionInScreen) {
          scrollUp(listView,v,v.getTop(),listView,adapter,listView.getFirstVisiblePosition() + i);
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
private synchronized void putSomeRowInMiddle(ListView listView,MonthYearAdapter adapter){
  for (int i=0; i <= listView.getLastVisiblePosition() - listView.getFirstVisiblePosition(); i++) {
    final View v=listView.getChildAt(i);
    if (v != null) {
      if (mMiddlePositionInScreen == 0) {
        mMiddlePositionInScreen=mRootLayoutHeight / 3 + v.getHeight() / 2;
        mBottomPositionOfMiddleElement=mRootLayoutHeight / 3 + v.getHeight();
      }
      if ((v.getTop() >= mRootLayoutHeight / 3 - listView.getDividerHeight() / 2) && v.getTop() < mMiddlePositionInScreen) {
        scrollUp(i,listView,v,v.getTop(),listView,adapter,listView.getFirstVisiblePosition() + i);
        break;
      }
      if ((v.getBottom() >= mMiddlePositionInScreen) && v.getBottom() <= mBottomPositionOfMiddleElement + listView.getDividerHeight() / 2) {
        scrollDown(i,listView,v,v.getBottom(),v.getHeight(),listView,adapter,listView.getFirstVisiblePosition() + i);
        break;
      }
      if (v.getBottom() <= mMiddlePositionInScreen && v.getBottom() > mRootLayoutHeight / 3) {
        if (v.getBottom() + listView.getDividerHeight() / 2 >= mMiddlePositionInScreen) {
          scrollDown(i,listView,v,v.getBottom(),v.getHeight(),listView,adapter,listView.getFirstVisiblePosition() + i);
          break;
        }
      }
      if (v.getTop() >= mMiddlePositionInScreen && v.getTop() < mBottomPositionOfMiddleElement) {
        if (v.getTop() - listView.getDividerHeight() / 2 <= mMiddlePositionInScreen) {
          scrollUp(i,listView,v,v.getTop(),listView,adapter,listView.getFirstVisiblePosition() + i);
          break;
        }
      }
    }
  }
}