Program: 61895
Project: 61895
Buggy source:
@Override public void beginGradientFill(int type,GRADRECORD[] gradientRecords,Matrix matrix,int spreadMethod,int interpolationMethod,float focalPointRatio){
  finalizePath();
switch (type) {
case FILLSTYLE.LINEAR_GRADIENT:
{
      List<Color> colors=new ArrayList<>();
      List<Float> ratios=new ArrayList<>();
      for (int i=0; i < gradientRecords.length; i++) {
        if ((i > 0) && (gradientRecords[i - 1].ratio == gradientRecords[i].ratio)) {
          continue;
        }
        ratios.add(gradientRecords[i].getRatioFloat());
        colors.add(gradientRecords[i].color.toColor());
      }
      float[] ratiosArr=new float[ratios.size()];
      for (int i=0; i < ratios.size(); i++) {
        ratiosArr[i]=ratios.get(i);
      }
      Color[] colorsArr=colors.toArray(new Color[colors.size()]);
      MultipleGradientPaint.CycleMethod cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
      if (spreadMethod == GRADIENT.SPREAD_PAD_MODE) {
        cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
      }
 else       if (spreadMethod == GRADIENT.SPREAD_REFLECT_MODE) {
        cm=MultipleGradientPaint.CycleMethod.REFLECT;
      }
 else       if (spreadMethod == GRADIENT.SPREAD_REPEAT_MODE) {
        cm=MultipleGradientPaint.CycleMethod.REPEAT;
      }
      fillPathPaint=null;
      fillPaint=new LinearGradientPaint(new java.awt.Point(-16384,0),new java.awt.Point(16384,0),ratiosArr,colorsArr,cm);
      fillTransform=matrixToTransform(matrix);
    }
  break;
case FILLSTYLE.RADIAL_GRADIENT:
{
  List<Color> colors=new ArrayList<>();
  List<Float> ratios=new ArrayList<>();
  for (int i=0; i < gradientRecords.length; i++) {
    if ((i > 0) && (gradientRecords[i - 1].ratio == gradientRecords[i].ratio)) {
      continue;
    }
    ratios.add(gradientRecords[i].getRatioFloat());
    colors.add(gradientRecords[i].color.toColor());
  }
  float[] ratiosArr=new float[ratios.size()];
  for (int i=0; i < ratios.size(); i++) {
    ratiosArr[i]=ratios.get(i);
  }
  Color[] colorsArr=colors.toArray(new Color[colors.size()]);
  MultipleGradientPaint.CycleMethod cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
  if (spreadMethod == GRADIENT.SPREAD_PAD_MODE) {
    cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
  }
 else   if (spreadMethod == GRADIENT.SPREAD_REFLECT_MODE) {
    cm=MultipleGradientPaint.CycleMethod.REFLECT;
  }
 else   if (spreadMethod == GRADIENT.SPREAD_REPEAT_MODE) {
    cm=MultipleGradientPaint.CycleMethod.REPEAT;
  }
  Color endColor=gradientRecords[gradientRecords.length - 1].color.toColor();
  fillPathPaint=endColor;
  fillPaint=new RadialGradientPaint(new java.awt.Point(0,0),16384,ratiosArr,colorsArr,cm);
  fillTransform=matrixToTransform(matrix);
}
break;
case FILLSTYLE.FOCAL_RADIAL_GRADIENT:
{
List<Color> colors=new ArrayList<>();
List<Float> ratios=new ArrayList<>();
for (int i=0; i < gradientRecords.length; i++) {
if ((i > 0) && (gradientRecords[i - 1].ratio == gradientRecords[i].ratio)) {
  continue;
}
ratios.add(gradientRecords[i].getRatioFloat());
colors.add(gradientRecords[i].color.toColor());
}
float[] ratiosArr=new float[ratios.size()];
for (int i=0; i < ratios.size(); i++) {
ratiosArr[i]=ratios.get(i);
}
Color[] colorsArr=colors.toArray(new Color[colors.size()]);
MultipleGradientPaint.CycleMethod cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
if (spreadMethod == GRADIENT.SPREAD_PAD_MODE) {
cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
}
 else if (spreadMethod == GRADIENT.SPREAD_REFLECT_MODE) {
cm=MultipleGradientPaint.CycleMethod.REFLECT;
}
 else if (spreadMethod == GRADIENT.SPREAD_REPEAT_MODE) {
cm=MultipleGradientPaint.CycleMethod.REPEAT;
}
Color endColor=gradientRecords[gradientRecords.length - 1].color.toColor();
fillPathPaint=endColor;
fillPaint=new RadialGradientPaint(new java.awt.Point(0,0),16384,new java.awt.Point((int)(focalPointRatio * 16384),0),ratiosArr,colorsArr,cm);
fillTransform=matrixToTransform(matrix);
}
break;
}
}

Fixed version (ground truth):
@Override public void beginGradientFill(int type,GRADRECORD[] gradientRecords,Matrix matrix,int spreadMethod,int interpolationMethod,float focalPointRatio){
  finalizePath();
switch (type) {
case FILLSTYLE.LINEAR_GRADIENT:
{
      List<Color> colors=new ArrayList<>();
      List<Float> ratios=new ArrayList<>();
      for (int i=0; i < gradientRecords.length; i++) {
        if ((i > 0) && (gradientRecords[i - 1].ratio == gradientRecords[i].ratio)) {
          continue;
        }
        ratios.add(gradientRecords[i].getRatioFloat());
        colors.add(gradientRecords[i].color.toColor());
      }
      float[] ratiosArr=new float[ratios.size()];
      for (int i=0; i < ratios.size(); i++) {
        ratiosArr[i]=ratios.get(i);
      }
      Color[] colorsArr=colors.toArray(new Color[colors.size()]);
      MultipleGradientPaint.CycleMethod cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
      if (spreadMethod == GRADIENT.SPREAD_PAD_MODE) {
        cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
      }
 else       if (spreadMethod == GRADIENT.SPREAD_REFLECT_MODE) {
        cm=MultipleGradientPaint.CycleMethod.REFLECT;
      }
 else       if (spreadMethod == GRADIENT.SPREAD_REPEAT_MODE) {
        cm=MultipleGradientPaint.CycleMethod.REPEAT;
      }
      fillPathPaint=null;
      fillPaint=new LinearGradientPaint(new java.awt.Point(-16384,0),new java.awt.Point(16384,0),ratiosArr,colorsArr,cm);
      matrix.translateX-=deltaX;
      matrix.translateY-=deltaY;
      fillTransform=matrix.toTransform();
    }
  break;
case FILLSTYLE.RADIAL_GRADIENT:
{
  List<Color> colors=new ArrayList<>();
  List<Float> ratios=new ArrayList<>();
  for (int i=0; i < gradientRecords.length; i++) {
    if ((i > 0) && (gradientRecords[i - 1].ratio == gradientRecords[i].ratio)) {
      continue;
    }
    ratios.add(gradientRecords[i].getRatioFloat());
    colors.add(gradientRecords[i].color.toColor());
  }
  float[] ratiosArr=new float[ratios.size()];
  for (int i=0; i < ratios.size(); i++) {
    ratiosArr[i]=ratios.get(i);
  }
  Color[] colorsArr=colors.toArray(new Color[colors.size()]);
  MultipleGradientPaint.CycleMethod cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
  if (spreadMethod == GRADIENT.SPREAD_PAD_MODE) {
    cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
  }
 else   if (spreadMethod == GRADIENT.SPREAD_REFLECT_MODE) {
    cm=MultipleGradientPaint.CycleMethod.REFLECT;
  }
 else   if (spreadMethod == GRADIENT.SPREAD_REPEAT_MODE) {
    cm=MultipleGradientPaint.CycleMethod.REPEAT;
  }
  Color endColor=gradientRecords[gradientRecords.length - 1].color.toColor();
  fillPathPaint=endColor;
  fillPaint=new RadialGradientPaint(new java.awt.Point(0,0),16384,ratiosArr,colorsArr,cm);
  matrix.translateX-=deltaX;
  matrix.translateY-=deltaY;
  fillTransform=matrix.toTransform();
}
break;
case FILLSTYLE.FOCAL_RADIAL_GRADIENT:
{
List<Color> colors=new ArrayList<>();
List<Float> ratios=new ArrayList<>();
for (int i=0; i < gradientRecords.length; i++) {
if ((i > 0) && (gradientRecords[i - 1].ratio == gradientRecords[i].ratio)) {
  continue;
}
ratios.add(gradientRecords[i].getRatioFloat());
colors.add(gradientRecords[i].color.toColor());
}
float[] ratiosArr=new float[ratios.size()];
for (int i=0; i < ratios.size(); i++) {
ratiosArr[i]=ratios.get(i);
}
Color[] colorsArr=colors.toArray(new Color[colors.size()]);
MultipleGradientPaint.CycleMethod cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
if (spreadMethod == GRADIENT.SPREAD_PAD_MODE) {
cm=MultipleGradientPaint.CycleMethod.NO_CYCLE;
}
 else if (spreadMethod == GRADIENT.SPREAD_REFLECT_MODE) {
cm=MultipleGradientPaint.CycleMethod.REFLECT;
}
 else if (spreadMethod == GRADIENT.SPREAD_REPEAT_MODE) {
cm=MultipleGradientPaint.CycleMethod.REPEAT;
}
Color endColor=gradientRecords[gradientRecords.length - 1].color.toColor();
fillPathPaint=endColor;
fillPaint=new RadialGradientPaint(new java.awt.Point(0,0),16384,new java.awt.Point((int)(focalPointRatio * 16384),0),ratiosArr,colorsArr,cm);
matrix.translateX-=deltaX;
matrix.translateY-=deltaY;
fillTransform=matrix.toTransform();
}
break;
}
}