Program: 18597
Project: 18597
Buggy source:
@Override protected void calculateOffsets(){
  if (!mCustomViewPortEnabled) {
    float offsetLeft=0f, offsetRight=0f, offsetTop=0f, offsetBottom=0f;
    if (mLegend != null && mLegend.isEnabled()) {
      if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) {
        offsetRight+=mLegend.mTextWidthMax + mLegend.getXOffset() * 2f;
      }
 else       if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
        offsetBottom+=mLegend.mTextHeightMax * 3f;
      }
    }
    if (mAxisLeft.isEnabled()) {
      offsetLeft+=mAxisLeft.getRequiredWidthSpace(mAxisRendererLeft.getAxisPaint());
    }
    if (mAxisRight.isEnabled()) {
      offsetRight+=mAxisRight.getRequiredWidthSpace(mAxisRendererRight.getAxisPaint());
    }
    float xlabelheight=mXAxis.mLabelHeight * 2f;
    if (mXAxis.isEnabled()) {
      if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        offsetBottom+=xlabelheight;
      }
 else       if (mXAxis.getPosition() == XAxisPosition.TOP) {
        offsetTop+=xlabelheight;
      }
 else       if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        offsetBottom+=xlabelheight;
        offsetTop+=xlabelheight;
      }
    }
    float min=Utils.convertDpToPixel(10f);
    mViewPortHandler.restrainViewPort(Math.max(min,offsetLeft),Math.max(min,offsetTop),Math.max(min,offsetRight),Math.max(min,offsetBottom));
    if (mLogEnabled) {
      Log.i(LOG_TAG,"String_Node_Str" + offsetLeft + "String_Node_Str"+ offsetTop+ "String_Node_Str"+ offsetRight+ "String_Node_Str"+ offsetBottom);
      Log.i(LOG_TAG,"String_Node_Str" + mViewPortHandler.getContentRect().toString());
    }
  }
  prepareOffsetMatrix();
  prepareValuePxMatrix();
}

Fixed version (ground truth):
@Override protected void calculateOffsets(){
  if (!mCustomViewPortEnabled) {
    float offsetLeft=0f, offsetRight=0f, offsetTop=0f, offsetBottom=0f;
    if (mLegend != null && mLegend.isEnabled()) {
      if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) {
        offsetRight+=mLegend.mTextWidthMax + mLegend.getXOffset() * 2f;
      }
 else       if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
        offsetBottom+=mLegend.mTextHeightMax * 3f;
      }
    }
    if (mAxisLeft.needsOffset()) {
      offsetLeft+=mAxisLeft.getRequiredWidthSpace(mAxisRendererLeft.getAxisPaint());
    }
    if (mAxisRight.needsOffset()) {
      offsetRight+=mAxisRight.getRequiredWidthSpace(mAxisRendererRight.getAxisPaint());
    }
    float xlabelheight=mXAxis.mLabelHeight * 2f;
    if (mXAxis.isEnabled()) {
      if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        offsetBottom+=xlabelheight;
      }
 else       if (mXAxis.getPosition() == XAxisPosition.TOP) {
        offsetTop+=xlabelheight;
      }
 else       if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        offsetBottom+=xlabelheight;
        offsetTop+=xlabelheight;
      }
    }
    float min=Utils.convertDpToPixel(10f);
    mViewPortHandler.restrainViewPort(Math.max(min,offsetLeft),Math.max(min,offsetTop),Math.max(min,offsetRight),Math.max(min,offsetBottom));
    if (mLogEnabled) {
      Log.i(LOG_TAG,"String_Node_Str" + offsetLeft + "String_Node_Str"+ offsetTop+ "String_Node_Str"+ offsetRight+ "String_Node_Str"+ offsetBottom);
      Log.i(LOG_TAG,"String_Node_Str" + mViewPortHandler.getContentRect().toString());
    }
  }
  prepareOffsetMatrix();
  prepareValuePxMatrix();
}