Program: 60799
Project: 60799
Buggy source:
@Override public void enforce(final AccountPolicySpec policy,final PolicyType type,final SyncopeUser user) throws AccountPolicyException, PolicyEnforceException {
  if (user.getUsername() == null) {
    throw new PolicyEnforceException("String_Node_Str");
  }
  if (policy == null) {
    throw new PolicyEnforceException("String_Node_Str");
  }
  if (policy.getMinLength() > 0 && policy.getMinLength() > user.getUsername().length()) {
    throw new AccountPolicyException("String_Node_Str");
  }
  if (policy.getMaxLength() > 0 && policy.getMaxLength() < user.getUsername().length()) {
    throw new AccountPolicyException("String_Node_Str");
  }
  for (  String word : policy.getWordsNotPermitted()) {
    if (user.getUsername().contains(word)) {
      throw new AccountPolicyException("String_Node_Str");
    }
  }
  if ((policy.isAllLowerCase() && !LCPATTERN.matcher(user.getUsername()).matches()) || (policy.isAllUpperCase() && !UCPATTERN.matcher(user.getUsername()).matches()) || !PATTERN.matcher(user.getUsername()).matches()) {
    throw new AccountPolicyException("String_Node_Str");
  }
  for (  String prefix : policy.getPrefixesNotPermitted()) {
    if (user.getUsername().startsWith(prefix)) {
      throw new AccountPolicyException("String_Node_Str");
    }
  }
  for (  String suffix : policy.getSuffixesNotPermitted()) {
    if (user.getUsername().endsWith(suffix)) {
      throw new AccountPolicyException("String_Node_Str");
    }
  }
  if (user.getFailedLogins() != null && policy.getPermittedLoginRetries() > 0 && user.getFailedLogins() > policy.getPermittedLoginRetries() && !user.getSuspended()) {
    try {
      LOG.debug("String_Node_Str",user.getId(),user.getUsername());
      user.setFailedLogins(user.getFailedLogins() - 1);
      final WorkflowResult<Long> updated=wfAdapter.suspend(user);
      if (policy.isPropagateSuspension()) {
        final List<PropagationTask> tasks=propagationManager.getUpdateTaskIds(updated.getResult(),null,null,null,Boolean.FALSE,null);
        propagationManager.execute(tasks);
      }
      if (LOG.isDebugEnabled()) {
        final UserTO savedTO=userDataBinder.getUserTO(updated.getResult());
        LOG.debug("String_Node_Str",savedTO);
      }
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void enforce(final AccountPolicySpec policy,final PolicyType type,final SyncopeUser user) throws AccountPolicyException, PolicyEnforceException {
  if (user.getUsername() == null) {
    throw new PolicyEnforceException("String_Node_Str");
  }
  if (policy == null) {
    throw new PolicyEnforceException("String_Node_Str");
  }
  if (policy.getMinLength() > 0 && policy.getMinLength() > user.getUsername().length()) {
    throw new AccountPolicyException("String_Node_Str");
  }
  if (policy.getMaxLength() > 0 && policy.getMaxLength() < user.getUsername().length()) {
    throw new AccountPolicyException("String_Node_Str");
  }
  for (  String word : policy.getWordsNotPermitted()) {
    if (user.getUsername().contains(word)) {
      throw new AccountPolicyException("String_Node_Str");
    }
  }
  if ((policy.isAllLowerCase() && !LCPATTERN.matcher(user.getUsername()).matches()) || (policy.isAllUpperCase() && !UCPATTERN.matcher(user.getUsername()).matches()) || !PATTERN.matcher(user.getUsername()).matches()) {
    throw new AccountPolicyException("String_Node_Str");
  }
  for (  String prefix : policy.getPrefixesNotPermitted()) {
    if (user.getUsername().startsWith(prefix)) {
      throw new AccountPolicyException("String_Node_Str");
    }
  }
  for (  String suffix : policy.getSuffixesNotPermitted()) {
    if (user.getUsername().endsWith(suffix)) {
      throw new AccountPolicyException("String_Node_Str");
    }
  }
  if (user.getFailedLogins() != null && policy.getPermittedLoginRetries() > 0 && user.getFailedLogins() > policy.getPermittedLoginRetries() && !user.getSuspended()) {
    try {
      LOG.debug("String_Node_Str",user.getId(),user.getUsername());
      user.setFailedLogins(user.getFailedLogins() - 1);
      final WorkflowResult<Long> updated=wfAdapter.suspend(user);
      if (policy.isPropagateSuspension()) {
        final List<PropagationTask> tasks=propagationManager.getUpdateTaskIds(updated,Boolean.FALSE);
        propagationManager.execute(tasks);
      }
      if (LOG.isDebugEnabled()) {
        final UserTO savedTO=userDataBinder.getUserTO(updated.getResult());
        LOG.debug("String_Node_Str",savedTO);
      }
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
  }
}