Fixed major issues reported by sonar (Unnecessary Local Before Return)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@64827 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-03-18 23:41:13 +00:00
parent 49f9e35640
commit bcfb1ba174
6 changed files with 51 additions and 65 deletions

View File

@@ -1196,31 +1196,28 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
invokeOnRemoveReference(fromNode, toNode, assocId); invokeOnRemoveReference(fromNode, toNode, assocId);
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesFrom(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesFrom(org.alfresco.service.cmr.repository.NodeRef)
*/ */
public List<AssociationRef> getCustomReferencesFrom(NodeRef node) public List<AssociationRef> getCustomReferencesFrom(NodeRef node)
{ {
List<AssociationRef> retrievedAssocs = nodeService.getTargetAssocs(node, RegexQNamePattern.MATCH_ALL); return nodeService.getTargetAssocs(node, RegexQNamePattern.MATCH_ALL);
return retrievedAssocs; }
}
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomChildReferences(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomChildReferences(org.alfresco.service.cmr.repository.NodeRef)
*/ */
public List<ChildAssociationRef> getCustomChildReferences(NodeRef node) public List<ChildAssociationRef> getCustomChildReferences(NodeRef node)
{ {
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(node); return nodeService.getChildAssocs(node);
return childAssocs; }
}
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesTo(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesTo(org.alfresco.service.cmr.repository.NodeRef)
*/ */
public List<AssociationRef> getCustomReferencesTo(NodeRef node) public List<AssociationRef> getCustomReferencesTo(NodeRef node)
{ {
List<AssociationRef> retrievedAssocs = nodeService.getSourceAssocs(node, RegexQNamePattern.MATCH_ALL); return nodeService.getSourceAssocs(node, RegexQNamePattern.MATCH_ALL);
return retrievedAssocs;
} }
/** /**
@@ -1228,8 +1225,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
*/ */
public List<ChildAssociationRef> getCustomParentReferences(NodeRef node) public List<ChildAssociationRef> getCustomParentReferences(NodeRef node)
{ {
List<ChildAssociationRef> result = nodeService.getParentAssocs(node); return nodeService.getParentAssocs(node);
return result;
} }
// note: currently RMC custom assocs only // note: currently RMC custom assocs only

View File

@@ -421,8 +421,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
{ {
ResultSet raw = returnedObject.getWrapped(); ResultSet raw = returnedObject.getWrapped();
ResultSet filteredForPermissions = decide(authentication, object, config, raw); ResultSet filteredForPermissions = decide(authentication, object, config, raw);
PagingLuceneResultSet newPaging = new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService); return new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService);
return newPaging;
} }
private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject) throws AccessDeniedException private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject) throws AccessDeniedException

View File

@@ -108,8 +108,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
if (invocation.getArguments()[position] != null) if (invocation.getArguments()[position] != null)
{ {
QName qname = (QName) invocation.getArguments()[position]; return (QName) invocation.getArguments()[position];
return qname;
} }
} }
else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
@@ -133,8 +132,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
QName qname = (QName) invocation.getArguments()[position]; return (QName) invocation.getArguments()[position];
return qname;
} }
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }
@@ -155,8 +153,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
} }
if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
Serializable property = (Serializable) invocation.getArguments()[position]; return (Serializable) invocation.getArguments()[position];
return property;
} }
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }
@@ -177,8 +174,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
} }
if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
Map<QName, Serializable> properties = (Map<QName, Serializable>) invocation.getArguments()[position]; return (Map<QName, Serializable>) invocation.getArguments()[position];
return properties;
} }
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }

View File

@@ -67,8 +67,7 @@ public class ScriptConstraint implements Serializable
public String getName() public String getName()
{ {
String xxx = info.getName().replace(":", "_"); return info.getName().replace(":", "_");
return xxx;
} }
public boolean isCaseSensitive() public boolean isCaseSensitive()
@@ -257,9 +256,7 @@ public class ScriptConstraint implements Serializable
} }
} }
return constraints.toArray(new ScriptConstraintValue[constraints.size()]);
ScriptConstraintValue[] retVal = constraints.toArray(new ScriptConstraintValue[constraints.size()]);
return retVal;
} }
} }

View File

@@ -159,8 +159,7 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
} }
RMConstraintInfo info = caveatConfigService.addRMConstraint(listName, title, allowedValues); RMConstraintInfo info = caveatConfigService.addRMConstraint(listName, title, allowedValues);
ScriptConstraint c = new ScriptConstraint(info, caveatConfigService, getAuthorityService()); return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
return c;
} }
} }

View File

@@ -51,7 +51,6 @@ public class BasicIdentifierGenerator extends IdentifierGeneratorBase
Calendar fileCalendar = Calendar.getInstance(); Calendar fileCalendar = Calendar.getInstance();
String year = Integer.toString(fileCalendar.get(Calendar.YEAR)); String year = Integer.toString(fileCalendar.get(Calendar.YEAR));
String identifier = year + "-" + padString(dbId.toString(), 10); return year + "-" + padString(dbId.toString(), 10);
return identifier;
} }
} }