Program: 98527
Project: 98527
Buggy source:
/** 
 * Validates whether the CommentVo object satisfies the business rules and contains correct references to other objects
 * @param entityManager the entity manager
 * @param commentVo the CommentVo
 * @throws InvalidVoException in case the business rules are violated
 */
@Override public void validateVoForCreation(EntityManager entityManager,CommentVo commentVo) throws MultipleMessagesException, DataBaseException {
  MultipleMessagesException multipleMessageException=new MultipleMessagesException();
  if (commentVo == null) {
    multipleMessageException.addMessage("String_Node_Str");
    throw multipleMessageException;
  }
  if (commentVo.getContent() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
 else {
    commentVo.setContent(SecurityHelper.sanitizeHTML(commentVo.getContent()));
    if (commentVo.getContent().length() < 1 || commentVo.getContent().length() > MAX_COMMENT_LENGTH) {
      multipleMessageException.addMessage("String_Node_Str");
    }
  }
  if (commentVo.getCourseId() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
 else   if (getDaoFactory().getCourseDao().read(entityManager,commentVo.getCourseId()) == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
  if (commentVo.getDate() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
  if (commentVo.isAnonymous()) {
    if (commentVo.getUserId() != null) {
      multipleMessageException.addMessage("String_Node_Str");
    }
  }
 else {
    if (commentVo.getUserId() == null) {
      multipleMessageException.addMessage("String_Node_Str");
    }
 else     if (getDaoFactory().getUserDao().read(entityManager,commentVo.getUserId()) == null) {
      multipleMessageException.addMessage("String_Node_Str");
    }
  }
  if (commentVo.getRating() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
 else   if (commentVo.getRating() < 0.0F || commentVo.getRating() > 5.0F) {
    multipleMessageException.addMessage("String_Node_Str");
  }
  if (!multipleMessageException.getMessages().isEmpty()) {
    throw multipleMessageException;
  }
}

Fixed version (ground truth):
/** 
 * Validates whether the CommentVo object satisfies the business rules and contains correct references to other objects
 * @param entityManager the entity manager
 * @param commentVo the CommentVo
 * @throws InvalidVoException in case the business rules are violated
 */
@Override public void validateVoForCreation(EntityManager entityManager,CommentVo commentVo) throws MultipleMessagesException, DataBaseException {
  MultipleMessagesException multipleMessageException=new MultipleMessagesException();
  if (commentVo == null) {
    multipleMessageException.addMessage("String_Node_Str");
    throw multipleMessageException;
  }
  if (commentVo.getContent() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
 else {
    commentVo.setContent(SecurityHelper.sanitizeHTML(commentVo.getContent()));
    if (commentVo.getContent().length() < 1 || commentVo.getContent().length() > MAX_COMMENT_LENGTH) {
      multipleMessageException.addMessage("String_Node_Str");
    }
  }
  if (commentVo.getCourseId() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
 else   if (getDaoFactory().getCourseDao().read(entityManager,commentVo.getCourseId()) == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
  if (commentVo.getDate() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
  if (commentVo.getUserId() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
 else   if (getDaoFactory().getUserDao().read(entityManager,commentVo.getUserId()) == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
  if (commentVo.getRating() == null) {
    multipleMessageException.addMessage("String_Node_Str");
  }
 else   if (commentVo.getRating() < 0.0F || commentVo.getRating() > 5.0F) {
    multipleMessageException.addMessage("String_Node_Str");
  }
  if (!multipleMessageException.getMessages().isEmpty()) {
    throw multipleMessageException;
  }
}