Program: 55855
Project: 55855
Buggy source:
@Override protected void action(){
  if (isJobless())   return;
  if (!building.isNotDestroyed()) {
    buildingDestroyed();
    return;
  }
switch (currentJob.getType()) {
case GO_TO:
    gotoAction();
  break;
case TRY_TAKING_RESOURCE:
if (tryTakingResource()) {
  jobFinished();
}
 else {
  jobFailed();
}
break;
case TRY_TAKING_FOOD:
if (building.tryTakingFoood(currentJob.getFoodOrder())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case WAIT:
{
short waitTime=(short)(currentJob.getTime() * 1000);
super.sleep(waitTime);
jobFinished();
break;
}
case WALK:
IBuildingJob job=currentJob;
super.goInDirection(currentJob.getDirection(),true);
if (currentJob == job) {
jobFinished();
}
break;
case SHOW:
{
if (building.getPriority() == EPriority.STOPPED) {
break;
}
ShortPoint2D pos=getCurrentJobPos();
if (currentJob.getDirection() != null) {
super.lookInDirection(currentJob.getDirection());
}
super.setPosition(pos);
super.setVisible(true);
jobFinished();
break;
}
case HIDE:
super.setVisible(false);
jobFinished();
break;
case SET_MATERIAL:
super.setMaterial(currentJob.getMaterial());
jobFinished();
break;
case TAKE:
takeAction();
break;
case DROP:
dropAction(currentJob.getMaterial());
break;
case DROP_POPPED:
dropAction(poppedMaterial);
break;
case PRE_SEARCH:
preSearchPathAction(true);
break;
case PRE_SEARCH_IN_AREA:
preSearchPathAction(false);
break;
case FOLLOW_SEARCHED:
followPreSearchedAction();
break;
case LOOK_AT_SEARCHED:
lookAtSearched();
break;
case LOOK_AT:
super.lookInDirection(currentJob.getDirection());
jobFinished();
break;
case EXECUTE:
executeAction();
break;
case PLAY_ACTION1:
super.playAction(EMovableAction.ACTION1,currentJob.getTime());
jobFinished();
break;
case PLAY_ACTION2:
super.playAction(EMovableAction.ACTION2,currentJob.getTime());
jobFinished();
break;
case AVAILABLE:
if (super.getGrid().canTakeMaterial(getCurrentJobPos(),currentJob.getMaterial())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case NOT_FULL:
if (super.getGrid().canPushMaterial(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case SMOKE_ON:
case SMOKE_OFF:
{
super.getGrid().placeSmoke(getCurrentJobPos(),currentJob.getType() == EBuildingJobType.SMOKE_ON);
building.addMapObjectCleanupPosition(getCurrentJobPos(),EMapObjectType.SMOKE);
jobFinished();
break;
}
case START_WORKING:
case STOP_WORKING:
if (building instanceof MillBuilding) {
((MillBuilding)building).setRotating(currentJob.getType() == EBuildingJobType.START_WORKING);
}
jobFinished();
break;
case PIG_IS_ADULT:
if (super.getGrid().isPigAdult(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_IS_THERE:
if (super.getGrid().hasPigAt(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_PLACE:
case PIG_REMOVE:
placeOrRemovePigAction();
break;
case POP_TOOL:
popToolRequestAction();
break;
case POP_WEAPON:
popWeaponRequestAction();
break;
case GROW_DONKEY:
growDonkeyAction();
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
  if (isJobless())   return;
  if (!building.isNotDestroyed()) {
    buildingDestroyed();
    return;
  }
switch (currentJob.getType()) {
case GO_TO:
    gotoAction();
  break;
case TRY_TAKING_RESOURCE:
if (tryTakingResource()) {
  jobFinished();
}
 else {
  jobFailed();
}
break;
case TRY_TAKING_FOOD:
if (building.tryTakingFoood(currentJob.getFoodOrder())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case WAIT:
{
short waitTime=(short)(currentJob.getTime() * 1000);
super.sleep(waitTime);
jobFinished();
break;
}
case WALK:
IBuildingJob job=currentJob;
super.goInDirection(currentJob.getDirection(),EGoInDirectionMode.GO_IF_ALLOWED_WAIT_TILL_FREE);
if (currentJob == job) {
jobFinished();
}
break;
case SHOW:
{
if (building.getPriority() == EPriority.STOPPED) {
break;
}
ShortPoint2D pos=getCurrentJobPos();
if (currentJob.getDirection() != null) {
super.lookInDirection(currentJob.getDirection());
}
super.setPosition(pos);
super.setVisible(true);
jobFinished();
break;
}
case HIDE:
super.setVisible(false);
jobFinished();
break;
case SET_MATERIAL:
super.setMaterial(currentJob.getMaterial());
jobFinished();
break;
case TAKE:
takeAction();
break;
case DROP:
dropAction(currentJob.getMaterial());
break;
case DROP_POPPED:
dropAction(poppedMaterial);
break;
case PRE_SEARCH:
preSearchPathAction(true);
break;
case PRE_SEARCH_IN_AREA:
preSearchPathAction(false);
break;
case FOLLOW_SEARCHED:
followPreSearchedAction();
break;
case LOOK_AT_SEARCHED:
lookAtSearched();
break;
case LOOK_AT:
super.lookInDirection(currentJob.getDirection());
jobFinished();
break;
case EXECUTE:
executeAction();
break;
case PLAY_ACTION1:
super.playAction(EMovableAction.ACTION1,currentJob.getTime());
jobFinished();
break;
case PLAY_ACTION2:
super.playAction(EMovableAction.ACTION2,currentJob.getTime());
jobFinished();
break;
case AVAILABLE:
if (super.getGrid().canTakeMaterial(getCurrentJobPos(),currentJob.getMaterial())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case NOT_FULL:
if (super.getGrid().canPushMaterial(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case SMOKE_ON:
case SMOKE_OFF:
{
super.getGrid().placeSmoke(getCurrentJobPos(),currentJob.getType() == EBuildingJobType.SMOKE_ON);
building.addMapObjectCleanupPosition(getCurrentJobPos(),EMapObjectType.SMOKE);
jobFinished();
break;
}
case START_WORKING:
case STOP_WORKING:
if (building instanceof MillBuilding) {
((MillBuilding)building).setRotating(currentJob.getType() == EBuildingJobType.START_WORKING);
}
jobFinished();
break;
case PIG_IS_ADULT:
if (super.getGrid().isPigAdult(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_IS_THERE:
if (super.getGrid().hasPigAt(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_PLACE:
case PIG_REMOVE:
placeOrRemovePigAction();
break;
case POP_TOOL:
popToolRequestAction();
break;
case POP_WEAPON:
popWeaponRequestAction();
break;
case GROW_DONKEY:
growDonkeyAction();
break;
}
}