Program: 129031
Project: 129031
Buggy source:
public void run() throws PersistenceException {
  boolean needSave=false;
  if (!beforeLogon) {
    ERepositoryObjectType[] types=(ERepositoryObjectType[])ERepositoryObjectType.values();
    Arrays.sort(types,new Comparator<ERepositoryObjectType>(){
      public int compare(      ERepositoryObjectType arg0,      ERepositoryObjectType arg1){
        if (arg0 == ERepositoryObjectType.PROCESS) {
          return 1;
        }
        if (arg0 == ERepositoryObjectType.JOBLET) {
          return 1;
        }
        return 0;
      }
    }
);
    for (    ERepositoryObjectType type : types) {
      if (!type.isResourceItem()) {
        continue;
      }
      List<IRepositoryViewObject> objects=repFactory.getAll(project,type,true,true);
      for (      IRepositoryViewObject object : objects) {
        Item item=object.getProperty().getItem();
        monitorWrap.subTask("String_Node_Str" + item.getProperty().getLabel());
        subProgressMonitor.worked(1);
        for (        IProjectMigrationTask task : toExecute) {
          if (monitorWrap.isCanceled()) {
            throw new OperationCanceledException(Messages.getString("String_Node_Str",task.getName()));
          }
          MigrationTask mgTask=MigrationUtil.findMigrationTask(done,task);
          if (mgTask == null && !task.isDeprecated()) {
            ExecutionResult status=task.execute(project,item);
switch (status) {
case SUCCESS_WITH_ALERT:
              if (task.getStatus() != ExecutionResult.FAILURE) {
                task.setStatus(status);
              }
case SUCCESS_NO_ALERT:
            if (task.getStatus() != ExecutionResult.FAILURE) {
              task.setStatus(status);
            }
case NOTHING_TO_DO:
          if (task.getStatus() != ExecutionResult.SUCCESS_WITH_ALERT && task.getStatus() != ExecutionResult.SUCCESS_NO_ALERT && task.getStatus() != ExecutionResult.FAILURE) {
            task.setStatus(status);
          }
        break;
case SKIPPED:
      if (task.getStatus() != ExecutionResult.SUCCESS_WITH_ALERT && task.getStatus() != ExecutionResult.SUCCESS_NO_ALERT && task.getStatus() != ExecutionResult.FAILURE) {
        task.setStatus(status);
      }
    break;
case FAILURE:
  task.setStatus(status);
default :
task.setStatus(status);
break;
}
}
}
if (object instanceof RepositoryObject) {
((RepositoryObject)object).unload();
}
}
monitorWrap.subTask("String_Node_Str");
}
}
for (IProjectMigrationTask task : toExecute) {
MigrationTask mgTask=MigrationUtil.findMigrationTask(done,task);
if (mgTask == null && !task.isDeprecated()) {
try {
ExecutionResult status;
if (beforeLogon) {
status=task.execute(project);
task.setStatus(status);
}
 else {
status=task.getStatus();
}
switch (status) {
case SUCCESS_WITH_ALERT:
doneThisSession.add(task);
case SUCCESS_NO_ALERT:
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
case NOTHING_TO_DO:
done.add(MigrationUtil.convertMigrationTask(task));
needSave=true;
break;
case SKIPPED:
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
break;
case FAILURE:
default :
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
break;
}
}
 catch (Exception e) {
ExceptionHandler.process(e);
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
}
}
 else if (mgTask == null && task.isDeprecated()) {
done.add(MigrationUtil.convertMigrationTask(task));
needSave=true;
}
}
if (needSave) {
saveProjectMigrationTasksDone(project,done);
}
RelationshipItemBuilder.getInstance().saveRelations();
if (!RelationshipItemBuilder.INDEX_VERSION.equals(project.getEmfProject().getItemsRelationVersion())) {
project.getEmfProject().setItemsRelationVersion(RelationshipItemBuilder.INDEX_VERSION);
}
}

Fixed version (ground truth):
@Override public void run() throws PersistenceException {
  boolean needSave=false;
  if (!beforeLogon) {
    ERepositoryObjectType[] types=(ERepositoryObjectType[])ERepositoryObjectType.values();
    Arrays.sort(types,new Comparator<ERepositoryObjectType>(){
      @Override public int compare(      ERepositoryObjectType arg0,      ERepositoryObjectType arg1){
        if (arg0 == ERepositoryObjectType.PROCESS) {
          return 1;
        }
        if (arg0 == ERepositoryObjectType.JOBLET) {
          return 1;
        }
        return 0;
      }
    }
);
    for (    ERepositoryObjectType type : types) {
      if (!type.isResourceItem()) {
        continue;
      }
      List<IRepositoryViewObject> objects=repFactory.getAll(project,type,true,true);
      for (      IRepositoryViewObject object : objects) {
        Item item=object.getProperty().getItem();
        monitorWrap.subTask("String_Node_Str" + item.getProperty().getLabel());
        subProgressMonitor.worked(1);
        for (        IProjectMigrationTask task : toExecute) {
          if (monitorWrap.isCanceled()) {
            throw new OperationCanceledException(Messages.getString("String_Node_Str",task.getName()));
          }
          MigrationTask mgTask=MigrationUtil.findMigrationTask(done,task);
          if (mgTask == null && !task.isDeprecated()) {
            ExecutionResult status=task.execute(project,item);
switch (status) {
case SUCCESS_WITH_ALERT:
              if (task.getStatus() != ExecutionResult.FAILURE) {
                task.setStatus(status);
              }
case SUCCESS_NO_ALERT:
            if (task.getStatus() != ExecutionResult.FAILURE) {
              task.setStatus(status);
            }
case NOTHING_TO_DO:
          if (task.getStatus() != ExecutionResult.SUCCESS_WITH_ALERT && task.getStatus() != ExecutionResult.SUCCESS_NO_ALERT && task.getStatus() != ExecutionResult.FAILURE) {
            task.setStatus(status);
          }
        break;
case SKIPPED:
      if (task.getStatus() != ExecutionResult.SUCCESS_WITH_ALERT && task.getStatus() != ExecutionResult.SUCCESS_NO_ALERT && task.getStatus() != ExecutionResult.FAILURE) {
        task.setStatus(status);
      }
    break;
case FAILURE:
  task.setStatus(status);
default :
task.setStatus(status);
break;
}
}
}
if (object instanceof RepositoryObject) {
((RepositoryObject)object).unload();
}
}
monitorWrap.subTask("String_Node_Str");
}
}
for (IProjectMigrationTask task : toExecute) {
MigrationTask mgTask=MigrationUtil.findMigrationTask(done,task);
if (mgTask == null && !task.isDeprecated()) {
try {
ExecutionResult status;
if (beforeLogon) {
status=task.execute(project);
task.setStatus(status);
}
 else {
status=task.getStatus();
}
switch (status) {
case SUCCESS_WITH_ALERT:
doneThisSession.add(task);
case SUCCESS_NO_ALERT:
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
case NOTHING_TO_DO:
done.add(MigrationUtil.convertMigrationTask(task));
needSave=true;
break;
case SKIPPED:
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
break;
case FAILURE:
default :
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
break;
}
}
 catch (Exception e) {
ExceptionHandler.process(e);
log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
}
}
 else if (mgTask == null && task.isDeprecated()) {
done.add(MigrationUtil.convertMigrationTask(task));
needSave=true;
}
}
if (needSave) {
saveProjectMigrationTasksDone(project,done);
}
if (!RelationshipItemBuilder.INDEX_VERSION.equals(project.getEmfProject().getItemsRelationVersion())) {
project.getEmfProject().setItemsRelationVersion(RelationshipItemBuilder.INDEX_VERSION);
}
RelationshipItemBuilder.getInstance().saveRelations();
}