Program: 26634
Project: 26634
Buggy source:
@Override protected void calculateOffsets(){
  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()) {
    offsetTop+=mAxisLeft.getRequiredHeightSpace(mAxisRendererLeft.getAxisPaint());
  }
  if (mAxisRight.isEnabled()) {
    offsetBottom+=mAxisRight.getRequiredHeightSpace(mAxisRendererRight.getAxisPaint());
  }
  float xlabelwidth=mXAxis.mLabelWidth;
  if (mXAxis.isEnabled()) {
    if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
      offsetLeft+=xlabelwidth;
    }
 else     if (mXAxis.getPosition() == XAxisPosition.TOP) {
      offsetRight+=xlabelwidth;
    }
 else     if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
      offsetLeft+=xlabelwidth;
      offsetRight+=xlabelwidth;
    }
  }
  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(){
  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()) {
    offsetTop+=mAxisLeft.getRequiredHeightSpace(mAxisRendererLeft.getAxisPaint());
  }
  if (mAxisRight.needsOffset()) {
    offsetBottom+=mAxisRight.getRequiredHeightSpace(mAxisRendererRight.getAxisPaint());
  }
  float xlabelwidth=mXAxis.mLabelWidth;
  if (mXAxis.isEnabled()) {
    if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
      offsetLeft+=xlabelwidth;
    }
 else     if (mXAxis.getPosition() == XAxisPosition.TOP) {
      offsetRight+=xlabelwidth;
    }
 else     if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
      offsetLeft+=xlabelwidth;
      offsetRight+=xlabelwidth;
    }
  }
  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();
}