Program: 139770
Project: 139770
Buggy source:
public void drawItem(Graphics2D g2,XYItemRendererState state,Rectangle2D dataArea,PlotRenderingInfo info,XYPlot plot,ValueAxis domainAxis,ValueAxis rangeAxis,XYDataset dataset,int series,int item,CrosshairState crosshairState,int pass){
  if (!getItemVisible(series,item)) {
    return;
  }
  PlotOrientation orientation=plot.getOrientation();
  double x=dataset.getXValue(series,item);
  double y=dataset.getYValue(series,item);
  double z=Double.NaN;
  if (dataset instanceof XYZDataset) {
    XYZDataset xyzData=(XYZDataset)dataset;
    z=xyzData.getZValue(series,item);
  }
  if (!Double.isNaN(z)) {
    RectangleEdge domainAxisLocation=plot.getDomainAxisEdge();
    RectangleEdge rangeAxisLocation=plot.getRangeAxisEdge();
    double transX=domainAxis.valueToJava2D(x,dataArea,domainAxisLocation);
    double transY=rangeAxis.valueToJava2D(y,dataArea,rangeAxisLocation);
    double transDomain=0.0;
    double transRange=0.0;
    double zero;
switch (getScaleType()) {
case SCALE_ON_DOMAIN_AXIS:
      zero=domainAxis.valueToJava2D(0.0,dataArea,domainAxisLocation);
    transDomain=domainAxis.valueToJava2D(z,dataArea,domainAxisLocation) - zero;
  transRange=transDomain;
break;
case SCALE_ON_RANGE_AXIS:
zero=rangeAxis.valueToJava2D(0.0,dataArea,rangeAxisLocation);
transRange=zero - rangeAxis.valueToJava2D(z,dataArea,rangeAxisLocation);
transDomain=transRange;
break;
default :
double zero1=domainAxis.valueToJava2D(0.0,dataArea,domainAxisLocation);
double zero2=rangeAxis.valueToJava2D(0.0,dataArea,rangeAxisLocation);
transDomain=domainAxis.valueToJava2D(z,dataArea,domainAxisLocation) - zero1;
transRange=zero2 - rangeAxis.valueToJava2D(z,dataArea,rangeAxisLocation);
}
transDomain=Math.abs(transDomain);
transRange=Math.abs(transRange);
double diag=Math.sqrt(dataArea.getHeight() * dataArea.getHeight() + dataArea.getWidth() * dataArea.getWidth());
transDomain+=diag / 100;
transRange+=diag / 100;
Ellipse2D circle=null;
if (orientation == PlotOrientation.VERTICAL) {
circle=new Ellipse2D.Double(transX - transDomain / 2.0,transY - transRange / 2.0,transDomain,transRange);
}
 else if (orientation == PlotOrientation.HORIZONTAL) {
circle=new Ellipse2D.Double(transY - transRange / 2.0,transX - transDomain / 2.0,transRange,transDomain);
}
g2.setPaint(getItemPaint(series,item));
g2.fill(circle);
g2.setStroke(getItemOutlineStroke(series,item));
g2.setPaint(getItemOutlinePaint(series,item));
g2.draw(circle);
if (isItemLabelVisible(series,item)) {
if (orientation == PlotOrientation.VERTICAL) {
drawItemLabel(g2,orientation,dataset,series,item,transX,transY,false);
}
 else if (orientation == PlotOrientation.HORIZONTAL) {
drawItemLabel(g2,orientation,dataset,series,item,transY,transX,false);
}
}
EntityCollection entities=null;
if (info != null) {
entities=info.getOwner().getEntityCollection();
if (entities != null && circle.intersects(dataArea)) {
addEntity(entities,circle,dataset,series,item,circle.getCenterX(),circle.getCenterY());
}
}
int domainAxisIndex=plot.getDomainAxisIndex(domainAxis);
int rangeAxisIndex=plot.getRangeAxisIndex(rangeAxis);
updateCrosshairValues(crosshairState,x,y,domainAxisIndex,rangeAxisIndex,transX,transY,orientation);
}
}

Fixed version (ground truth):
public void drawItem(Graphics2D g2,XYItemRendererState state,Rectangle2D dataArea,PlotRenderingInfo info,XYPlot plot,ValueAxis domainAxis,ValueAxis rangeAxis,XYDataset dataset,int series,int item,CrosshairState crosshairState,int pass){
  if (!getItemVisible(series,item)) {
    return;
  }
  PlotOrientation orientation=plot.getOrientation();
  double x=dataset.getXValue(series,item);
  double y=dataset.getYValue(series,item);
  double z=Double.NaN;
  if (dataset instanceof XYZDataset) {
    XYZDataset xyzData=(XYZDataset)dataset;
    z=xyzData.getZValue(series,item);
  }
  if (!Double.isNaN(z)) {
    RectangleEdge domainAxisLocation=plot.getDomainAxisEdge();
    RectangleEdge rangeAxisLocation=plot.getRangeAxisEdge();
    double transX=domainAxis.valueToJava2D(x,dataArea,domainAxisLocation);
    double transY=rangeAxis.valueToJava2D(y,dataArea,rangeAxisLocation);
    double transDomain=0.0;
    double transRange=0.0;
    double zero;
    double zSize=getBubbleSize(z);
    z=0;
switch (getScaleType()) {
case SCALE_ON_DOMAIN_AXIS:
      zero=domainAxis.valueToJava2D(0.0,dataArea,domainAxisLocation);
    transDomain=domainAxis.valueToJava2D(z,dataArea,domainAxisLocation) - zero;
  transRange=transDomain;
break;
case SCALE_ON_RANGE_AXIS:
zero=rangeAxis.valueToJava2D(0.0,dataArea,rangeAxisLocation);
transRange=zero - rangeAxis.valueToJava2D(z,dataArea,rangeAxisLocation);
transDomain=transRange;
break;
default :
double zero1=domainAxis.valueToJava2D(0.0,dataArea,domainAxisLocation);
double zero2=rangeAxis.valueToJava2D(0.0,dataArea,rangeAxisLocation);
transDomain=domainAxis.valueToJava2D(z,dataArea,domainAxisLocation) - zero1;
transRange=zero2 - rangeAxis.valueToJava2D(z,dataArea,rangeAxisLocation);
}
transDomain=Math.abs(transDomain);
transRange=Math.abs(transRange);
double diag=Math.sqrt(dataArea.getHeight() * dataArea.getHeight() + dataArea.getWidth() * dataArea.getWidth());
transDomain+=diag / 100;
transRange+=diag / 100;
Ellipse2D circle=null;
transDomain*=zSize;
transRange*=zSize;
if (orientation == PlotOrientation.VERTICAL) {
circle=new Ellipse2D.Double(transX - transDomain / 2.0,transY - transRange / 2.0,transDomain,transRange);
}
 else if (orientation == PlotOrientation.HORIZONTAL) {
circle=new Ellipse2D.Double(transY - transRange / 2.0,transX - transDomain / 2.0,transRange,transDomain);
}
g2.setPaint(getItemPaint(series,item));
g2.fill(circle);
g2.setStroke(getItemOutlineStroke(series,item));
g2.setPaint(getItemOutlinePaint(series,item));
g2.draw(circle);
if (isItemLabelVisible(series,item)) {
if (orientation == PlotOrientation.VERTICAL) {
drawItemLabel(g2,orientation,dataset,series,item,transX,transY,false);
}
 else if (orientation == PlotOrientation.HORIZONTAL) {
drawItemLabel(g2,orientation,dataset,series,item,transY,transX,false);
}
}
EntityCollection entities=null;
if (info != null) {
entities=info.getOwner().getEntityCollection();
if (entities != null && circle.intersects(dataArea)) {
addEntity(entities,circle,dataset,series,item,circle.getCenterX(),circle.getCenterY());
}
}
int domainAxisIndex=plot.getDomainAxisIndex(domainAxis);
int rangeAxisIndex=plot.getRangeAxisIndex(rangeAxis);
updateCrosshairValues(crosshairState,x,y,domainAxisIndex,rangeAxisIndex,transX,transY,orientation);
}
}