Fixed critical issues reported by sonar (Performance - Method invokes inefficient Number constructor; use static valueOf instead)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63805 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-03-09 21:54:42 +00:00
parent 3810d137d7
commit b64f1467b4
4 changed files with 56 additions and 56 deletions

View File

@@ -1057,7 +1057,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
Date fromDate = getFromDate(date); Date fromDate = getFromDate(date);
if (fromDate != null) if (fromDate != null)
{ {
fromDateTime = new Long(fromDate.getTime()); fromDateTime = Long.valueOf(fromDate.getTime());
} }
return fromDateTime; return fromDateTime;
} }
@@ -1099,7 +1099,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
Date toDate = getToDate(date); Date toDate = getToDate(date);
if (toDate != null) if (toDate != null)
{ {
toDateTime = new Long(toDate.getTime()); toDateTime = Long.valueOf(toDate.getTime());
} }
return toDateTime; return toDateTime;
} }

View File

@@ -285,7 +285,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
{ {
for (ConfigAttributeDefintion cad : supportedDefinitions) for (ConfigAttributeDefintion cad : supportedDefinitions)
{ {
if (cad.parent == true && parentResult == AccessDecisionVoter.ACCESS_DENIED) if (cad.parent && parentResult == AccessDecisionVoter.ACCESS_DENIED)
{ {
throw new AccessDeniedException("Access Denied"); throw new AccessDeniedException("Access Denied");
} }
@@ -344,7 +344,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
{ {
NodeRef testNodeRef = null; NodeRef testNodeRef = null;
if (cad.typeString.equals(cad.parent) == true) if (cad.typeString.equals(cad.parent))
{ {
testNodeRef = returnedObject.getParentRef(); testNodeRef = returnedObject.getParentRef();
} }
@@ -360,7 +360,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
continue; continue;
} }
if (cad.typeString.equals(cad.parent) == true && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED) if (cad.typeString.equals(cad.parent) && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED)
{ {
throw new AccessDeniedException("Access Denied"); throw new AccessDeniedException("Access Denied");
} }
@@ -441,16 +441,16 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
Integer maxSize = null; Integer maxSize = null;
if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems() >= 0) if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems() >= 0)
{ {
maxSize = new Integer(returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems()); maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems());
} }
if ((maxSize == null) && (returnedObject.getResultSetMetaData().getSearchParameters().getLimitBy() == LimitBy.FINAL_SIZE)) if ((maxSize == null) && (returnedObject.getResultSetMetaData().getSearchParameters().getLimitBy() == LimitBy.FINAL_SIZE))
{ {
maxSize = new Integer(returnedObject.getResultSetMetaData().getSearchParameters().getLimit()); maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getLimit());
} }
// Allow for skip // Allow for skip
if ((maxSize != null) && (returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount() >= 0)) if ((maxSize != null) && (returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount() >= 0))
{ {
maxSize = new Integer(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount()); maxSize = Integer.valueOf(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount());
} }
// int maxChecks = maxPermissionChecks; // int maxChecks = maxPermissionChecks;
@@ -867,7 +867,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
} }
int readCheck = childReadChek; int readCheck = childReadChek;
if (cad.parent == true) if (cad.parent)
{ {
readCheck = parentReadCheck; readCheck = parentReadCheck;
} }

View File

@@ -137,7 +137,7 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
{ {
public Integer doWork() throws Exception public Integer doWork() throws Exception
{ {
return new Integer(compareImpl(f1, f2)); return Integer.valueOf(compareImpl(f1, f2));
} }
}).intValue(); }).intValue();
@@ -181,7 +181,7 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
{ {
eventsCount2 = dad2.getEvents().size(); eventsCount2 = dad2.getEvents().size();
} }
return new Integer(eventsCount1).compareTo(eventsCount2); return Integer.valueOf(eventsCount1).compareTo(eventsCount2);
} }
} }

View File

@@ -154,7 +154,7 @@ public class ModulePatchExecuterImpl extends AbstractModuleComponent
*/ */
protected void updateSchema(int newSchema) protected void updateSchema(int newSchema)
{ {
attributeService.setAttribute(new Integer(newSchema), KEY_MODULE_SCHEMA, getModuleId()); attributeService.setAttribute(Integer.valueOf(newSchema), KEY_MODULE_SCHEMA, getModuleId());
} }
/** /**