Program: 169328
Project: 169328
Buggy source:
protected final synchronized boolean getNextDeviceEvent(Event event) throws IOException {
  while (true) {
switch (event_state) {
case EVENT_DONE:
      if (!device.getNextMouseEvent(current_event))       return false;
    event_state=EVENT_X;
  break;
case EVENT_X:
int rel_x=device.getEventRelativeX();
event_state=EVENT_Y;
if (rel_x != 0) {
event.set(getX(),rel_x,current_event.getNanos());
return true;
}
break;
case EVENT_Y:
int rel_y=device.getEventRelativeY();
event_state=EVENT_Z;
if (rel_y != 0) {
event.set(getY(),rel_y,current_event.getNanos());
return true;
}
break;
case EVENT_Z:
int wheel=current_event.getWheelDelta();
event_state=EVENT_BUTTON_0;
if (wheel != 0) {
event.set(getWheel(),wheel,current_event.getNanos());
return true;
}
break;
case EVENT_BUTTON_0:
event_state=EVENT_BUTTON_1;
if (makeButtonEvent(current_event,event,getLeft(),RawDevice.RI_MOUSE_BUTTON_1_DOWN,RawDevice.RI_MOUSE_BUTTON_1_UP)) return true;
break;
case EVENT_BUTTON_1:
event_state=EVENT_BUTTON_2;
if (makeButtonEvent(current_event,event,getLeft(),RawDevice.RI_MOUSE_BUTTON_2_DOWN,RawDevice.RI_MOUSE_BUTTON_2_UP)) return true;
break;
case EVENT_BUTTON_2:
event_state=EVENT_BUTTON_3;
if (makeButtonEvent(current_event,event,getLeft(),RawDevice.RI_MOUSE_BUTTON_3_DOWN,RawDevice.RI_MOUSE_BUTTON_3_UP)) return true;
break;
case EVENT_BUTTON_3:
event_state=EVENT_BUTTON_4;
if (makeButtonEvent(current_event,event,getLeft(),RawDevice.RI_MOUSE_BUTTON_4_DOWN,RawDevice.RI_MOUSE_BUTTON_4_UP)) return true;
break;
case EVENT_BUTTON_4:
event_state=EVENT_DONE;
if (makeButtonEvent(current_event,event,getLeft(),RawDevice.RI_MOUSE_BUTTON_5_DOWN,RawDevice.RI_MOUSE_BUTTON_5_UP)) return true;
break;
default :
throw new RuntimeException("String_Node_Str" + event_state);
}
}
}

Fixed version (ground truth):
protected final synchronized boolean getNextDeviceEvent(Event event) throws IOException {
  while (true) {
switch (event_state) {
case EVENT_DONE:
      if (!device.getNextMouseEvent(current_event))       return false;
    event_state=EVENT_X;
  break;
case EVENT_X:
int rel_x=device.getEventRelativeX();
event_state=EVENT_Y;
if (rel_x != 0) {
event.set(getX(),rel_x,current_event.getNanos());
return true;
}
break;
case EVENT_Y:
int rel_y=device.getEventRelativeY();
event_state=EVENT_Z;
if (rel_y != 0) {
event.set(getY(),rel_y,current_event.getNanos());
return true;
}
break;
case EVENT_Z:
int wheel=current_event.getWheelDelta();
event_state=EVENT_BUTTON_0;
if (wheel != 0) {
event.set(getWheel(),wheel,current_event.getNanos());
return true;
}
break;
case EVENT_BUTTON_0:
event_state=EVENT_BUTTON_1;
if (makeButtonEvent(current_event,event,getLeft(),RawDevice.RI_MOUSE_BUTTON_1_DOWN,RawDevice.RI_MOUSE_BUTTON_1_UP)) return true;
break;
case EVENT_BUTTON_1:
event_state=EVENT_BUTTON_2;
if (makeButtonEvent(current_event,event,getRight(),RawDevice.RI_MOUSE_BUTTON_2_DOWN,RawDevice.RI_MOUSE_BUTTON_2_UP)) return true;
break;
case EVENT_BUTTON_2:
event_state=EVENT_BUTTON_3;
if (makeButtonEvent(current_event,event,getMiddle(),RawDevice.RI_MOUSE_BUTTON_3_DOWN,RawDevice.RI_MOUSE_BUTTON_3_UP)) return true;
break;
case EVENT_BUTTON_3:
event_state=EVENT_BUTTON_4;
if (makeButtonEvent(current_event,event,getSide(),RawDevice.RI_MOUSE_BUTTON_4_DOWN,RawDevice.RI_MOUSE_BUTTON_4_UP)) return true;
break;
case EVENT_BUTTON_4:
event_state=EVENT_DONE;
if (makeButtonEvent(current_event,event,getExtra(),RawDevice.RI_MOUSE_BUTTON_5_DOWN,RawDevice.RI_MOUSE_BUTTON_5_UP)) return true;
break;
default :
throw new RuntimeException("String_Node_Str" + event_state);
}
}
}