Program: 18609
Project: 18609
Buggy source:
/** 
 * Returns the correct Highlight object (including xIndex and dataSet-index) for the specified touch position.
 * @param xPosition
 * @return
 */
protected Highlight getHighlight(double xPosition,double yPosition){
  int setCount=mData.getDataSetCount();
  int valCount=mData.getXValCount();
  if (!mData.isGrouped()) {
    int dataSet=0;
    int xIndex=(int)Math.round(xPosition);
    if (!mData.getDataSetByIndex(dataSet).isStacked())     return new Highlight(xIndex,dataSet);
 else     return getStackedHighlight(xIndex,dataSet,yPosition);
  }
 else {
    int steps=(int)((float)xPosition / ((float)setCount + mData.getGroupSpace()));
    float groupSpaceSum=mData.getGroupSpace() * (float)steps;
    float baseNoSpace=(float)xPosition - groupSpaceSum;
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + xPosition + "String_Node_Str"+ steps+ "String_Node_Str"+ groupSpaceSum+ "String_Node_Str"+ baseNoSpace);
    int dataSetIndex=(int)baseNoSpace % setCount;
    int xIndex=(int)baseNoSpace / setCount;
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + xIndex + "String_Node_Str"+ dataSetIndex);
    if (xIndex < 0) {
      xIndex=0;
      dataSetIndex=0;
    }
 else     if (xIndex >= valCount) {
      xIndex=valCount - 1;
      dataSetIndex=setCount - 1;
    }
    if (dataSetIndex < 0)     dataSetIndex=0;
 else     if (dataSetIndex >= setCount)     dataSetIndex=setCount - 1;
    if (!mData.getDataSetByIndex(dataSetIndex).isStacked())     return new Highlight(xIndex,dataSetIndex);
 else     return getStackedHighlight(xIndex,dataSetIndex,yPosition);
  }
}

Fixed version (ground truth):
/** 
 * Returns the correct Highlight object (including xIndex and dataSet-index) for the specified touch position.
 * @param xPosition
 * @return
 */
protected Highlight getHighlight(double xPosition,double yPosition){
  int setCount=mData.getDataSetCount();
  int valCount=mData.getXValCount();
  if (!mData.isGrouped()) {
    int dataSetIndex=0;
    int xIndex=(int)Math.round(xPosition);
    if (xIndex < 0) {
      xIndex=0;
      dataSetIndex=0;
    }
 else     if (xIndex >= valCount) {
      xIndex=valCount - 1;
      dataSetIndex=setCount - 1;
    }
    if (dataSetIndex < 0)     dataSetIndex=0;
 else     if (dataSetIndex >= setCount)     dataSetIndex=setCount - 1;
    if (!mData.getDataSetByIndex(dataSetIndex).isStacked())     return new Highlight(xIndex,dataSetIndex);
 else     return getStackedHighlight(xIndex,dataSetIndex,yPosition);
  }
 else {
    int steps=(int)((float)xPosition / ((float)setCount + mData.getGroupSpace()));
    float groupSpaceSum=mData.getGroupSpace() * (float)steps;
    float baseNoSpace=(float)xPosition - groupSpaceSum;
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + xPosition + "String_Node_Str"+ steps+ "String_Node_Str"+ groupSpaceSum+ "String_Node_Str"+ baseNoSpace);
    int dataSetIndex=(int)baseNoSpace % setCount;
    int xIndex=(int)baseNoSpace / setCount;
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + xIndex + "String_Node_Str"+ dataSetIndex);
    if (xIndex < 0) {
      xIndex=0;
      dataSetIndex=0;
    }
 else     if (xIndex >= valCount) {
      xIndex=valCount - 1;
      dataSetIndex=setCount - 1;
    }
    if (dataSetIndex < 0)     dataSetIndex=0;
 else     if (dataSetIndex >= setCount)     dataSetIndex=setCount - 1;
    if (!mData.getDataSetByIndex(dataSetIndex).isStacked())     return new Highlight(xIndex,dataSetIndex);
 else     return getStackedHighlight(xIndex,dataSetIndex,yPosition);
  }
}