Program: 67899
Project: 67899
Buggy source:
/** 
 * @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();
  IChartComputation cComp=((IDeviceRenderer)idr).getChartComputation();
  BoundingBox bb=cComp.computeBox(_sxs,iLabelPosition,la,0,0);
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)) {
ITextMetrics itm=cComp.getTextMetrics(_sxs,la,0);
try {
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);
}
 finally {
cComp.recycleTextMetrics(itm);
}
}
if (la.getCaption().getFont().getRotation() == 0 || R31Enhance.isR31Available()) {
renderHorizontalText(cComp,gc,la,bb.getLeft(),bb.getTop());
}
 else {
final Image imgText=rotatedTextAsImage(cComp,la);
gc.drawImage(imgText,(int)bb.getLeft(),(int)bb.getTop());
imgText.dispose();
}
renderBorder(cComp,gc,la,iLabelPosition,lo);
}

Fixed version (ground truth):
/** 
 * @param ipr
 * @param iLabelPosition
 * @param lo
 * @param la
 * @throws ChartException
 */
@Override public final void renderTextAtLocation(IPrimitiveRenderer idr,int iLabelPosition,Location lo,Label la) throws ChartException {
  final GC gc=(GC)((IDeviceRenderer)idr).getGraphicsContext();
  IChartComputation cComp=((IDeviceRenderer)idr).getChartComputation();
  BoundingBox bb=cComp.computeBox(_sxs,iLabelPosition,la,0,0);
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)) {
ITextMetrics itm=cComp.getTextMetrics(_sxs,la,0);
try {
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);
}
 finally {
cComp.recycleTextMetrics(itm);
}
}
if (la.getCaption().getFont().getRotation() == 0 || R31Enhance.isR31Available()) {
renderHorizontalText(cComp,gc,la,bb.getLeft(),bb.getTop());
}
 else {
final Image imgText=rotatedTextAsImage(cComp,la);
gc.drawImage(imgText,(int)bb.getLeft(),(int)bb.getTop());
imgText.dispose();
}
renderBorder(cComp,gc,la,iLabelPosition,lo);
}