Fixed critical issues reported by sonar (Empty If Stmt)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63495 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-03-02 16:40:09 +00:00
parent 6df1a7bca4
commit 83f2f59bcb
3 changed files with 24 additions and 36 deletions

View File

@@ -36,7 +36,7 @@ import org.alfresco.service.namespace.QName;
/** /**
* Complete event action * Complete event action
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class CompleteEventAction extends RMActionExecuterAbstractBase public class CompleteEventAction extends RMActionExecuterAbstractBase
@@ -45,7 +45,7 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
public static final String PARAM_EVENT_NAME = "eventName"; public static final String PARAM_EVENT_NAME = "eventName";
public static final String PARAM_EVENT_COMPLETED_BY = "eventCompletedBy"; public static final String PARAM_EVENT_COMPLETED_BY = "eventCompletedBy";
public static final String PARAM_EVENT_COMPLETED_AT = "eventCompletedAt"; public static final String PARAM_EVENT_COMPLETED_AT = "eventCompletedAt";
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List)
*/ */
@@ -69,7 +69,7 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME);
String eventCompletedBy = (String)action.getParameterValue(PARAM_EVENT_COMPLETED_BY); String eventCompletedBy = (String)action.getParameterValue(PARAM_EVENT_COMPLETED_BY);
Date eventCompletedAt = (Date)action.getParameterValue(PARAM_EVENT_COMPLETED_AT); Date eventCompletedAt = (Date)action.getParameterValue(PARAM_EVENT_COMPLETED_AT);
if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true) if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true)
{ {
// Get the next disposition action // Get the next disposition action
@@ -84,12 +84,12 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
{ {
eventCompletedAt = new Date(); eventCompletedAt = new Date();
} }
if (eventCompletedBy == null) if (eventCompletedBy == null)
{ {
eventCompletedBy = AuthenticationUtil.getRunAsUser(); eventCompletedBy = AuthenticationUtil.getRunAsUser();
} }
// Update the event so that it is complete // Update the event so that it is complete
NodeRef eventNodeRef = event.getNodeRef(); NodeRef eventNodeRef = event.getNodeRef();
Map<QName, Serializable> props = this.nodeService.getProperties(eventNodeRef); Map<QName, Serializable> props = this.nodeService.getProperties(eventNodeRef);
@@ -97,24 +97,24 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, eventCompletedAt); props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, eventCompletedAt);
props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, eventCompletedBy); props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, eventCompletedBy);
this.nodeService.setProperties(eventNodeRef, props); this.nodeService.setProperties(eventNodeRef, props);
// Check to see if the events eligible property needs to be updated // Check to see if the events eligible property needs to be updated
updateEventEligible(da); updateEventEligible(da);
} }
else // else
{ // {
// RM-695: Commenting error handling out. If the current disposition stage does not define the event being completed nothing should happen. // RM-695: Commenting error handling out. If the current disposition stage does not define the event being completed nothing should happen.
// throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EVENT_NO_DISP_LC, eventName)); // throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EVENT_NO_DISP_LC, eventName));
} // }
} }
} }
} }
} }
/** /**
* Get the event from the dispostion action * Get the event from the dispostion action
* *
* @param da * @param da
* @param eventName * @param eventName
* @return * @return

View File

@@ -212,7 +212,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
validateAndReset(caveatConfigNodeRef); validateAndReset(caveatConfigNodeRef);
} }
} }
/** /**
* @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean)
*/ */
@@ -232,7 +232,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@Override @Override
@Behaviour(kind = BehaviourKind.CLASS) @Behaviour(kind = BehaviourKind.CLASS)
public void beforeDeleteNode(NodeRef nodeRef) public void beforeDeleteNode(NodeRef nodeRef)
{ {
if (logger.isInfoEnabled()) if (logger.isInfoEnabled())
@@ -247,7 +247,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef)
*/ */
@Override @Override
@Behaviour(kind = BehaviourKind.CLASS) @Behaviour(kind = BehaviourKind.CLASS)
public void onCreateNode(ChildAssociationRef childAssocRef) public void onCreateNode(ChildAssociationRef childAssocRef)
{ {
if (logger.isInfoEnabled()) if (logger.isInfoEnabled())
@@ -352,6 +352,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
Map<String, List<String>> caveatMap = (Map<String, List<String>>)conEntry.getValue(); Map<String, List<String>> caveatMap = (Map<String, List<String>>)conEntry.getValue();
List<String> allowedValues = null; List<String> allowedValues = null;
@SuppressWarnings("unused")
boolean found = false; boolean found = false;
for (QName propertyName : props) for (QName propertyName : props)
@@ -382,10 +383,10 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
} }
} }
if (! found) //if (! found)
{ //{
//throw new AlfrescoRuntimeException("Constraint does not exist (or is not used): "+conStr); //throw new AlfrescoRuntimeException("Constraint does not exist (or is not used): "+conStr);
} //}
if (allowedValues != null) if (allowedValues != null)
{ {
@@ -547,7 +548,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (! (AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser())) if (! (AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser()))
{ {
// note: userName and userGroupNames must not be null // note: userName and userGroupNames must not be null
caveatConfig.get(constraintName); caveatConfig.get(constraintName);
Set<String> userGroupFullNames = authorityService.getAuthoritiesForUser(userName); Set<String> userGroupFullNames = authorityService.getAuthoritiesForUser(userName);
allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName); allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName);
@@ -922,11 +923,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
readLock.lock(); readLock.lock();
members = caveatConfig.get(listName); members = caveatConfig.get(listName);
if(members == null) if (members != null)
{
// list does not exist
}
else
{ {
try try
{ {
@@ -934,11 +931,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
writeLock.lock(); writeLock.lock();
// check again // check again
members = caveatConfig.get(listName); members = caveatConfig.get(listName);
if(members == null) if (members != null)
{
// list does not exist
}
else
{ {
// authorities contains authority, values[] // authorities contains authority, values[]
// pivot contains value, members[] // pivot contains value, members[]
@@ -964,7 +957,6 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
readLock.lock(); readLock.lock();
writeLock.unlock(); writeLock.unlock();
} }
} }
} }
finally finally

View File

@@ -603,12 +603,8 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
} }
// Prepend it to the path // Prepend it to the path
nodeRefPath.addFirst(nodeRef); nodeRefPath.addFirst(nodeRef);
// Are we at the root // Are we not at the root
if (isFilePlan(nodeRef) == true) if (isFilePlan(nodeRef) == false)
{
// We're done
}
else
{ {
ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef);
if (assocRef == null) if (assocRef == null)