Fixed major issues reported by sonar (Simplify Boolean Return)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@64825 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-03-18 23:22:27 +00:00
parent a30836b0c0
commit 822a53b8c3
2 changed files with 20 additions and 20 deletions

View File

@@ -57,6 +57,7 @@ import org.alfresco.service.cmr.search.PermissionEvaluationMode;
import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.AccessStatus;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
@@ -76,16 +77,15 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
private long maxPermissionCheckTimeMillis; private long maxPermissionCheckTimeMillis;
public boolean supports(ConfigAttribute attribute) public boolean supports(ConfigAttribute configAttribute)
{ {
if ((attribute.getAttribute() != null) && (attribute.getAttribute().startsWith(AFTER_RM))) boolean supports = false;
String attribute = configAttribute.getAttribute();
if (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM))
{ {
return true; supports = true;
}
else
{
return false;
} }
return supports;
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")

View File

@@ -36,6 +36,7 @@ import org.alfresco.repo.transaction.TransactionalResourceHelper;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespacePrefixResolver; import org.alfresco.service.namespace.NamespacePrefixResolver;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
@@ -90,22 +91,21 @@ public class RMEntryVoter extends RMSecurityCommon
* @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(net.sf.acegisecurity.ConfigAttribute) * @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(net.sf.acegisecurity.ConfigAttribute)
*/ */
@Override @Override
public boolean supports(ConfigAttribute attribute) public boolean supports(ConfigAttribute configAttribute)
{ {
if ((attribute.getAttribute() != null) && boolean supports = false;
(attribute.getAttribute().equals(ConfigAttributeDefinition.RM_ABSTAIN) || String attribute = configAttribute.getAttribute();
attribute.getAttribute().equals(ConfigAttributeDefinition.RM_QUERY) || if (StringUtils.isNotBlank(attribute) &&
attribute.getAttribute().equals(ConfigAttributeDefinition.RM_ALLOW) || (attribute.equals(ConfigAttributeDefinition.RM_ABSTAIN) ||
attribute.getAttribute().equals(ConfigAttributeDefinition.RM_DENY) || attribute.equals(ConfigAttributeDefinition.RM_QUERY) ||
attribute.getAttribute().startsWith(ConfigAttributeDefinition.RM_CAP) || attribute.equals(ConfigAttributeDefinition.RM_ALLOW) ||
attribute.getAttribute().startsWith(ConfigAttributeDefinition.RM))) attribute.equals(ConfigAttributeDefinition.RM_DENY) ||
attribute.startsWith(ConfigAttributeDefinition.RM_CAP) ||
attribute.startsWith(ConfigAttributeDefinition.RM)))
{ {
return true; supports = true;
}
else
{
return false;
} }
return supports;
} }
/** /**