Program: 71459
Project: 71459
Buggy source:
/** 
 * @param ipr
 * @param iLabelPosition
 * @param lo
 * @param la
 * @throws RenderingException
 */
public final void renderTextAtLocation(IPrimitiveRenderer idr,int iLabelPosition,Location lo,Label la) throws ChartException {
  final GC gc=(GC)((IDeviceRenderer)idr).getGraphicsContext();
  BoundingBox bb=null;
  try {
    bb=Methods.computeBox(_sxs,iLabelPosition,la,0,0);
  }
 catch (  IllegalArgumentException uiex) {
    throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,uiex);
  }
switch (iLabelPosition & POSITION_MASK) {
case ABOVE:
    bb.setTop(lo.getY() - bb.getHeight());
  bb.setLeft(lo.getX() - bb.getHotPoint());
break;
case BELOW:
bb.setTop(lo.getY());
bb.setLeft(lo.getX() - bb.getHotPoint());
break;
case LEFT:
bb.setTop(lo.getY() - bb.getHotPoint());
bb.setLeft(lo.getX() - bb.getWidth());
break;
case RIGHT:
bb.setTop(lo.getY() - bb.getHotPoint());
bb.setLeft(lo.getX());
break;
case INSIDE:
bb.setTop(lo.getY() - bb.getHeight() / 2);
bb.setLeft(lo.getX() - bb.getWidth() / 2);
break;
}
adjustTextPosition(iLabelPosition,bb);
if (ChartUtil.isShadowDefined(la)) {
try {
final ITextMetrics itm=_sxs.getTextMetrics(la);
final double dFH=itm.getFullHeight();
Location tmpLoc=Methods.computeRotatedTopPoint(_sxs,bb,la,dFH);
renderShadowAtLocation(idr,IConstants.ABOVE,tmpLoc,la);
}
 catch (IllegalArgumentException uiex) {
throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,uiex);
}
}
if (la.getCaption().getFont().getRotation() == 0 || R31Enhance.isR31Available()) {
renderHorizontalText(gc,la,bb.getLeft(),bb.getTop());
}
 else {
final Image imgText=rotatedTextAsImage(la);
gc.drawImage(imgText,(int)bb.getLeft(),(int)bb.getTop());
imgText.dispose();
}
renderBorder(gc,la,iLabelPosition,lo);
}

Fixed version (ground truth):
/** 
 * @param ipr
 * @param iLabelPosition
 * @param lo
 * @param la
 * @throws ChartException
 */
public final void renderTextAtLocation(IPrimitiveRenderer idr,int iLabelPosition,Location lo,Label la) throws ChartException {
  final GC gc=(GC)((IDeviceRenderer)idr).getGraphicsContext();
  BoundingBox bb=null;
  try {
    bb=Methods.computeBox(_sxs,iLabelPosition,la,0,0);
  }
 catch (  IllegalArgumentException uiex) {
    throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,uiex);
  }
switch (iLabelPosition & POSITION_MASK) {
case ABOVE:
    bb.setTop(lo.getY() - bb.getHeight());
  bb.setLeft(lo.getX() - bb.getHotPoint());
break;
case BELOW:
bb.setTop(lo.getY());
bb.setLeft(lo.getX() - bb.getHotPoint());
break;
case LEFT:
bb.setTop(lo.getY() - bb.getHotPoint());
bb.setLeft(lo.getX() - bb.getWidth());
break;
case RIGHT:
bb.setTop(lo.getY() - bb.getHotPoint());
bb.setLeft(lo.getX());
break;
case INSIDE:
bb.setTop(lo.getY() - bb.getHeight() / 2);
bb.setLeft(lo.getX() - bb.getWidth() / 2);
break;
}
adjustTextPosition(iLabelPosition,bb);
if (ChartUtil.isShadowDefined(la)) {
try {
final ITextMetrics itm=_sxs.getTextMetrics(la);
final double dFH=itm.getFullHeight();
Location tmpLoc=Methods.computeRotatedTopPoint(_sxs,bb,la,dFH);
renderShadowAtLocation(idr,IConstants.ABOVE,tmpLoc,la);
}
 catch (IllegalArgumentException uiex) {
throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,uiex);
}
}
if (la.getCaption().getFont().getRotation() == 0 || R31Enhance.isR31Available()) {
renderHorizontalText(gc,la,bb.getLeft(),bb.getTop());
}
 else {
final Image imgText=rotatedTextAsImage(la);
gc.drawImage(imgText,(int)bb.getLeft(),(int)bb.getTop());
imgText.dispose();
}
renderBorder(gc,la,iLabelPosition,lo);
}