Program: 172203
Project: 172203
Buggy source:
public int vote(Authentication authentication,Object object,ConfigAttributeDefinition config){
  if (log.isDebugEnabled()) {
    MethodInvocation mi=(MethodInvocation)object;
    log.debug("String_Node_Str" + mi.getMethod().toString());
  }
  if (AuthenticationUtil.isRunAsUserTheSystemUser()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    return AccessDecisionVoter.ACCESS_GRANTED;
  }
  List<ConfigAttributeDefintion> supportedDefinitions=extractSupportedDefinitions(config);
  if (supportedDefinitions.size() == 0) {
    return AccessDecisionVoter.ACCESS_ABSTAIN;
  }
  MethodInvocation invocation=(MethodInvocation)object;
  Method method=invocation.getMethod();
  Class[] params=method.getParameterTypes();
  Boolean hasMethodEntry=null;
  for (  ConfigAttributeDefintion cad : supportedDefinitions) {
    NodeRef testNodeRef=null;
    if (cad.typeString.equals(ACL_DENY)) {
      return AccessDecisionVoter.ACCESS_DENIED;
    }
 else     if (cad.typeString.equals(ACL_ALLOW)) {
      return AccessDecisionVoter.ACCESS_GRANTED;
    }
 else     if (cad.typeString.equals(ACL_METHOD)) {
      if (hasMethodEntry == null) {
        hasMethodEntry=Boolean.FALSE;
      }
      if (cad.authority.equals(AuthenticationUtil.getRunAsUser())) {
        hasMethodEntry=Boolean.TRUE;
      }
 else       if (authorityService.getAuthorities().contains(cad.authority)) {
        hasMethodEntry=Boolean.TRUE;
      }
    }
 else     if (cad.parameter >= invocation.getArguments().length) {
      continue;
    }
 else     if (cad.typeString.equals(ACL_NODE)) {
      if (StoreRef.class.isAssignableFrom(params[cad.parameter])) {
        if (invocation.getArguments()[cad.parameter] != null) {
          if (log.isDebugEnabled()) {
            log.debug("String_Node_Str");
          }
          StoreRef storeRef=(StoreRef)invocation.getArguments()[cad.parameter];
          if (nodeService.exists(storeRef)) {
            testNodeRef=nodeService.getRootNode(storeRef);
          }
        }
      }
 else       if (NodeRef.class.isAssignableFrom(params[cad.parameter])) {
        testNodeRef=(NodeRef)invocation.getArguments()[cad.parameter];
        if (log.isDebugEnabled()) {
          if (nodeService.exists(testNodeRef)) {
            log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
          }
 else {
            log.debug("String_Node_Str" + testNodeRef);
          }
        }
      }
 else       if (ChildAssociationRef.class.isAssignableFrom(params[cad.parameter])) {
        if (invocation.getArguments()[cad.parameter] != null) {
          testNodeRef=((ChildAssociationRef)invocation.getArguments()[cad.parameter]).getChildRef();
          if (log.isDebugEnabled()) {
            if (nodeService.exists(testNodeRef)) {
              log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
            }
 else {
              log.debug("String_Node_Str" + testNodeRef);
            }
          }
        }
      }
 else {
        throw new ACLEntryVoterException("String_Node_Str");
      }
    }
 else     if (cad.typeString.equals(ACL_PARENT)) {
      if (NodeRef.class.isAssignableFrom(params[cad.parameter])) {
        NodeRef child=(NodeRef)invocation.getArguments()[cad.parameter];
        if (child != null) {
          testNodeRef=nodeService.getPrimaryParent(child).getParentRef();
          if (log.isDebugEnabled()) {
            if (nodeService.exists(testNodeRef)) {
              log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
            }
 else {
              log.debug("String_Node_Str" + testNodeRef);
            }
            log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
          }
        }
      }
 else       if (ChildAssociationRef.class.isAssignableFrom(params[cad.parameter])) {
        if (invocation.getArguments()[cad.parameter] != null) {
          testNodeRef=((ChildAssociationRef)invocation.getArguments()[cad.parameter]).getParentRef();
          if (log.isDebugEnabled()) {
            if (nodeService.exists(testNodeRef)) {
              log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
            }
 else {
              log.debug("String_Node_Str" + testNodeRef);
            }
          }
        }
      }
 else {
        throw new ACLEntryVoterException("String_Node_Str");
      }
    }
    if (testNodeRef != null) {
      if (abstainForClassQNames.size() > 0) {
        QName typeQName=nodeService.getType(testNodeRef);
        if (abstainForClassQNames.contains(typeQName)) {
          return AccessDecisionVoter.ACCESS_ABSTAIN;
        }
        Set<QName> aspectQNames=nodeService.getAspects(testNodeRef);
        for (        QName abstain : abstainForClassQNames) {
          if (aspectQNames.contains(abstain)) {
            return AccessDecisionVoter.ACCESS_ABSTAIN;
          }
        }
      }
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
      if (permissionService.hasPermission(testNodeRef,cad.required.toString()) == AccessStatus.DENIED) {
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str");
          Thread.dumpStack();
        }
        return AccessDecisionVoter.ACCESS_DENIED;
      }
    }
  }
  if ((hasMethodEntry == null) || (hasMethodEntry.booleanValue())) {
    return AccessDecisionVoter.ACCESS_GRANTED;
  }
 else {
    return AccessDecisionVoter.ACCESS_DENIED;
  }
}

Fixed version (ground truth):
public int vote(Authentication authentication,Object object,ConfigAttributeDefinition config){
  if (log.isDebugEnabled()) {
    MethodInvocation mi=(MethodInvocation)object;
    log.debug("String_Node_Str" + mi.getMethod().toString());
  }
  if (AuthenticationUtil.isRunAsUserTheSystemUser()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    return AccessDecisionVoter.ACCESS_GRANTED;
  }
  List<ConfigAttributeDefintion> supportedDefinitions=extractSupportedDefinitions(config);
  if (supportedDefinitions.size() == 0) {
    return AccessDecisionVoter.ACCESS_ABSTAIN;
  }
  MethodInvocation invocation=(MethodInvocation)object;
  Method method=invocation.getMethod();
  Class[] params=method.getParameterTypes();
  Boolean hasMethodEntry=null;
  for (  ConfigAttributeDefintion cad : supportedDefinitions) {
    NodeRef testNodeRef=null;
    if (cad.typeString.equals(ACL_DENY)) {
      return AccessDecisionVoter.ACCESS_DENIED;
    }
 else     if (cad.typeString.equals(ACL_ALLOW)) {
      return AccessDecisionVoter.ACCESS_GRANTED;
    }
 else     if (cad.typeString.equals(ACL_METHOD)) {
      if (hasMethodEntry == null) {
        hasMethodEntry=Boolean.FALSE;
      }
      if (cad.authority.equals(AuthenticationUtil.getRunAsUser())) {
        hasMethodEntry=Boolean.TRUE;
      }
 else       if (authorityService.getAuthorities().contains(cad.authority)) {
        hasMethodEntry=Boolean.TRUE;
      }
    }
 else     if (cad.parameter >= invocation.getArguments().length) {
      continue;
    }
 else     if (cad.typeString.equals(ACL_NODE)) {
      if (StoreRef.class.isAssignableFrom(params[cad.parameter])) {
        if (invocation.getArguments()[cad.parameter] != null) {
          if (log.isDebugEnabled()) {
            log.debug("String_Node_Str");
          }
          StoreRef storeRef=(StoreRef)invocation.getArguments()[cad.parameter];
          if (nodeService.exists(storeRef)) {
            testNodeRef=nodeService.getRootNode(storeRef);
          }
        }
      }
 else       if (NodeRef.class.isAssignableFrom(params[cad.parameter])) {
        testNodeRef=(NodeRef)invocation.getArguments()[cad.parameter];
        if (log.isDebugEnabled()) {
          if (nodeService.exists(testNodeRef)) {
            log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
          }
 else {
            log.debug("String_Node_Str" + testNodeRef);
          }
        }
      }
 else       if (ChildAssociationRef.class.isAssignableFrom(params[cad.parameter])) {
        if (invocation.getArguments()[cad.parameter] != null) {
          testNodeRef=((ChildAssociationRef)invocation.getArguments()[cad.parameter]).getChildRef();
          if (log.isDebugEnabled()) {
            if (nodeService.exists(testNodeRef)) {
              log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
            }
 else {
              log.debug("String_Node_Str" + testNodeRef);
            }
          }
        }
      }
 else {
        throw new ACLEntryVoterException("String_Node_Str");
      }
    }
 else     if (cad.typeString.equals(ACL_PARENT)) {
      if (NodeRef.class.isAssignableFrom(params[cad.parameter])) {
        NodeRef child=(NodeRef)invocation.getArguments()[cad.parameter];
        if (child != null) {
          testNodeRef=nodeService.getPrimaryParent(child).getParentRef();
          if (log.isDebugEnabled()) {
            if (nodeService.exists(testNodeRef)) {
              log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
            }
 else {
              log.debug("String_Node_Str" + testNodeRef);
            }
            log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
          }
        }
      }
 else       if (ChildAssociationRef.class.isAssignableFrom(params[cad.parameter])) {
        if (invocation.getArguments()[cad.parameter] != null) {
          testNodeRef=((ChildAssociationRef)invocation.getArguments()[cad.parameter]).getParentRef();
          if (log.isDebugEnabled()) {
            if (nodeService.exists(testNodeRef)) {
              log.debug("String_Node_Str" + nodeService.getPath(testNodeRef));
            }
 else {
              log.debug("String_Node_Str" + testNodeRef);
            }
          }
        }
      }
 else {
        throw new ACLEntryVoterException("String_Node_Str");
      }
    }
    if (testNodeRef != null) {
      if (abstainForClassQNames.size() > 0) {
        if (nodeService.exists(testNodeRef)) {
          QName typeQName=nodeService.getType(testNodeRef);
          if (abstainForClassQNames.contains(typeQName)) {
            return AccessDecisionVoter.ACCESS_ABSTAIN;
          }
          Set<QName> aspectQNames=nodeService.getAspects(testNodeRef);
          for (          QName abstain : abstainForClassQNames) {
            if (aspectQNames.contains(abstain)) {
              return AccessDecisionVoter.ACCESS_ABSTAIN;
            }
          }
        }
      }
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
      if (permissionService.hasPermission(testNodeRef,cad.required.toString()) == AccessStatus.DENIED) {
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str");
          Thread.dumpStack();
        }
        return AccessDecisionVoter.ACCESS_DENIED;
      }
    }
  }
  if ((hasMethodEntry == null) || (hasMethodEntry.booleanValue())) {
    return AccessDecisionVoter.ACCESS_GRANTED;
  }
 else {
    return AccessDecisionVoter.ACCESS_DENIED;
  }
}