Program: 56623
Project: 56623
Buggy source:
private static Step myGetDateStep(Cell[] srcCells,int b,int e,boolean positive,int fillType,int subType){
  final Cell srcCell1=srcCells[b];
  final int[] time1=getTimeParts(srcCell1);
  int j=0;
  int y1=time1[j];
  ++j;
  int m1=time1[j];
  ++j;
  int d1=time1[j];
  ++j;
  int h1=time1[j];
  ++j;
  int min1=time1[j];
  ++j;
  int s1=time1[j];
  ++j;
  int ms1=time1[j];
  int t1=(h1 < 0 ? 0 : h1 * 60 * 60* 1000) + min1 * 60 * 1000 + s1 * 1000 + ms1;
  if (b == e) {
switch (fillType) {
case FILL_DAYS:
      return new MsecondStep(srcCells[b].getDateCellValue(),positive ? 24 * 60 * 60* 1000 : -24 * 60 * 60* 1000,subType);
case FILL_HOURS:
    return new MsecondStep(srcCells[b].getDateCellValue(),positive ? 60 * 60 * 1000 : -60 * 60 * 1000,subType);
case FILL_MONTHS:
  return new DateStep(y1,m1,d1,t1,positive ? 1 : -1,0,subType);
case FILL_YEARS:
return new DateStep(y1,m1,d1,t1,positive ? 12 : -12,0,subType);
case FILL_WEEKDAYS:
return new MsecondStep(srcCells[b].getDateCellValue(),positive ? 7 * 24 * 60* 60* 1000 : -7 * 24 * 60* 60* 1000,subType);
default :
return CopyStep.instance;
}
}
final Cell srcCell2=srcCells[b + 1];
final int[] time2=getTimeParts(srcCell2);
j=0;
int y2=time2[j];
++j;
int m2=time2[j];
++j;
int d2=time2[j];
++j;
int h2=time2[j];
++j;
int min2=time2[j];
++j;
int s2=time2[j];
++j;
int ms2=time2[j];
int diffM=m2 - m1 + (y2 - y1) * 12;
int diffD=d2 - d1;
if (h1 < 0 && h2 >= 0) {
h1=h2;
min1=min2;
s1=s2;
ms1=ms2;
}
 else if (h1 >= 0 && h2 < 0) {
h2=h1;
min2=min1;
s2=s1;
ms2=ms1;
}
int t2=(h2 < 0 ? 0 : h2 * 60 * 60* 1000) + min2 * 60 * 1000 + s2 * 1000 + ms2;
int diffT=t2 - t1;
for (int k=b + 2; k <= e; ++k) {
y1=y2;
m1=m2;
d1=d2;
h1=h2;
min1=min2;
s1=s2;
ms1=ms2;
t1=t2;
final Cell srcCell=srcCells[k];
final int[] time=getTimeParts(srcCell);
j=0;
y2=time[j];
++j;
m2=time[j];
++j;
d2=time[j];
++j;
h2=time[j];
++j;
min2=time[j];
++j;
s2=time[j];
++j;
ms2=time[j];
if ((diffM != m2 - m1 + (y2 - y1) * 12) || (diffD != d2 - d1)) {
return CopyStep.instance;
}
if (h1 < 0 && h2 >= 0) {
h1=h2;
min1=min2;
s1=s2;
ms1=ms2;
}
 else if (h1 >= 0 && h2 < 0) {
h2=h1;
min2=min1;
s2=s1;
ms2=ms1;
}
t2=(h2 < 0 ? 0 : h2 * 60 * 60* 1000) + min2 * 60 * 1000 + s2 * 1000 + ms2;
if (diffT != t2 - t1) {
diffT=0;
}
}
if (diffD != 0) {
final Calendar cal1=Calendar.getInstance();
final Calendar cal2=Calendar.getInstance();
cal1.set(y1,m1,d1,h1,min1,s1);
cal1.set(Calendar.MILLISECOND,ms1);
cal2.set(y2,m2,d2,h2,min2,s2);
cal2.set(Calendar.MILLISECOND,ms2);
final long step=cal2.getTime().getTime() - cal1.getTime().getTime();
return new MsecondStep(cal2.getTime(),step,-1);
}
 else {
return new DateStep(y2,m2,d2,t2,diffM,diffT,-1);
}
}

Fixed version (ground truth):
private static Step myGetDateStep(Cell[] srcCells,int b,int e,boolean positive,int fillType,int subType){
  final Cell srcCell1=srcCells[b];
  final int[] time1=getTimeParts(srcCell1);
  int j=0;
  int y1=time1[j];
  ++j;
  int m1=time1[j];
  ++j;
  int d1=time1[j];
  ++j;
  int h1=time1[j];
  ++j;
  int min1=time1[j];
  ++j;
  int s1=time1[j];
  ++j;
  int ms1=time1[j];
  int t1=(h1 < 0 ? 0 : h1 * 60 * 60* 1000) + min1 * 60 * 1000 + s1 * 1000 + ms1;
  if (b == e) {
switch (fillType) {
case FILL_DAYS:
      return new MsecondStep(srcCells[b].getDateCellValue(),positive ? 24 * 60 * 60* 1000 : -24 * 60 * 60* 1000,subType);
case FILL_HOURS:
    return new MsecondStep(srcCells[b].getDateCellValue(),positive ? 60 * 60 * 1000 : -60 * 60 * 1000,subType);
case FILL_MONTHS:
  return new DateStep(y1,m1,d1,t1,positive ? 1 : -1,0,subType);
case FILL_YEARS:
return new DateStep(y1,m1,d1,t1,positive ? 12 : -12,0,subType);
case FILL_WEEKDAYS:
return new MsecondStep(srcCells[b].getDateCellValue(),positive ? 7 * 24 * 60* 60* 1000 : -7 * 24 * 60* 60* 1000,subType);
default :
return CopyStep.instance;
}
}
final Cell srcCell2=srcCells[b + 1];
final int[] time2=getTimeParts(srcCell2);
j=0;
int y2=time2[j];
++j;
int m2=time2[j];
++j;
int d2=time2[j];
++j;
int h2=time2[j];
++j;
int min2=time2[j];
++j;
int s2=time2[j];
++j;
int ms2=time2[j];
int diffM=m2 - m1 + (y2 - y1) * 12;
int diffD=d2 - d1;
if (h1 < 0 && h2 >= 0) {
h1=h2;
min1=min2;
s1=s2;
ms1=ms2;
}
 else if (h1 >= 0 && h2 < 0) {
h2=h1;
min2=min1;
s2=s1;
ms2=ms1;
}
int t2=(h2 < 0 ? 0 : h2 * 60 * 60* 1000) + min2 * 60 * 1000 + s2 * 1000 + ms2;
int diffT=t2 - t1;
for (int k=b + 2; k <= e; ++k) {
y1=y2;
m1=m2;
d1=d2;
h1=h2;
min1=min2;
s1=s2;
ms1=ms2;
t1=t2;
final Cell srcCell=srcCells[k];
final int[] time=getTimeParts(srcCell);
j=0;
y2=time[j];
++j;
m2=time[j];
++j;
d2=time[j];
++j;
h2=time[j];
++j;
min2=time[j];
++j;
s2=time[j];
++j;
ms2=time[j];
if ((diffM != m2 - m1 + (y2 - y1) * 12) || (diffD != d2 - d1)) {
return CopyStep.instance;
}
if (h1 < 0 && h2 >= 0) {
h1=h2;
min1=min2;
s1=s2;
ms1=ms2;
}
 else if (h1 >= 0 && h2 < 0) {
h2=h1;
min2=min1;
s2=s1;
ms2=ms1;
}
t2=(h2 < 0 ? 0 : h2 * 60 * 60* 1000) + min2 * 60 * 1000 + s2 * 1000 + ms2;
if (diffT != t2 - t1) {
diffT=0;
}
}
if (diffD != 0) {
if (h1 < 0) {
h1=0;
}
if (h2 < 0) {
h2=0;
}
final Calendar cal1=Calendar.getInstance();
final Calendar cal2=Calendar.getInstance();
cal1.set(y1,m1,d1,h1,min1,s1);
cal1.set(Calendar.MILLISECOND,ms1);
cal2.set(y2,m2,d2,h2,min2,s2);
cal2.set(Calendar.MILLISECOND,ms2);
final long step=cal2.getTime().getTime() - cal1.getTime().getTime();
return new MsecondStep(cal2.getTime(),step,-1);
}
 else {
return new DateStep(y2,m2,d2,t2,diffM,diffT,-1);
}
}