Fixed major issues ("Illegal Throws") reported in Sonar

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@71958 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-05-27 22:20:44 +00:00
parent 1441c42f45
commit cbe6192307
27 changed files with 88 additions and 90 deletions

View File

@@ -32,26 +32,26 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* Records management action condition evaluator abstract base implementation.
*
*
* @author Roy Wetherall
* @since 2.1
*/
public abstract class RecordsManagementActionConditionEvaluatorAbstractBase extends ActionConditionEvaluatorAbstractBase
public abstract class RecordsManagementActionConditionEvaluatorAbstractBase extends ActionConditionEvaluatorAbstractBase
implements RecordsManagementActionCondition,
BeanNameAware
{
/** records management action service */
protected RecordsManagementActionService recordsManagementActionService;
/** File Plan Service */
protected FilePlanService filePlanService;
/** bean name */
private String name;
/** public condition */
protected boolean publicCondition = true;
private RetryingTransactionHelper retryingTransactionHelper;
/**
@@ -61,11 +61,11 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
{
this.recordsManagementActionService = recordsManagementActionService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
@@ -93,7 +93,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
{
RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
public Void execute()
{
recordsManagementActionService.register(RecordsManagementActionConditionEvaluatorAbstractBase.this);
@@ -107,13 +107,13 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
}, AuthenticationUtil.getSystemUserName());
}
@Override
public void setPublicCondition(boolean publicCondition)
{
this.publicCondition = publicCondition;
}
/**
* @see org.alfresco.repo.action.CommonResourceAbstractBase#setBeanName(java.lang.String)
*/
@@ -123,7 +123,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
this.name = name;
super.setBeanName(name);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAction#getName()
*/
@@ -131,7 +131,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
{
return this.name;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel()
*/
@@ -139,19 +139,19 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
{
return getActionConditionDefintion().getTitle();
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription()
*/
public String getDescription()
{
{
return getActionConditionDefintion().getDescription();
}
/**
* @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#getActionConditionDefintion()
*
* TODO base class should provide "createActionDefinition" method that can be over-ridden like the ActionExecuter
*
* TODO base class should provide "createActionDefinition" method that can be over-ridden like the ActionExecuter
* base class to prevent duplication of code and a cleaner extension.
*/
@Override
@@ -168,7 +168,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
}
return this.actionConditionDefinition;
}
/**
* @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List)
*/
@@ -186,7 +186,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
{
return publicCondition;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getRecordsManagementActionConditionDefinition()
*/

View File

@@ -84,7 +84,7 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
/**
* @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable)
*/
public Serializable extractData(Serializable value) throws Throwable
public Serializable extractData(Serializable value)
{
NodeRef nodeRef = (NodeRef) value;
String user = AuthenticationUtil.getFullyAuthenticatedUser();

View File

@@ -58,7 +58,7 @@ public final class FilePlanIdentifierDataExtractor extends AbstractDataExtractor
return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_RECORD_COMPONENT_ID);
}
public Serializable extractData(Serializable value) throws Throwable
public Serializable extractData(Serializable value)
{
NodeRef nodeRef = (NodeRef) value;

View File

@@ -75,7 +75,7 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
/**
* @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable)
*/
public Serializable extractData(Serializable value) throws Throwable
public Serializable extractData(Serializable value)
{
NodeRef nodeRef = (NodeRef) value;

View File

@@ -68,7 +68,7 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT);
}
public Serializable extractData(Serializable value) throws Throwable
public Serializable extractData(Serializable value)
{
NodeRef nodeRef = (NodeRef) value;

View File

@@ -64,7 +64,7 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent
*/
@Override
protected void executeInternal() throws Throwable
{
{
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID);
if (!nodeService.exists(nodeRef))
{
@@ -72,6 +72,6 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent
// init module schema number
modulePatchExecuter.initSchemaVersion();
}
}
}
}

View File

@@ -32,7 +32,7 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean;
/**
* RM module bootstrap
*
*
* @author janv
*/
public class RecordsManagementBootstrap extends AbstractLifecycleBean
@@ -41,23 +41,23 @@ public class RecordsManagementBootstrap extends AbstractLifecycleBean
private RMCaveatConfigService caveatConfigService;
private CustomEmailMappingService customEmailMappingService;
private RecordsManagementAdminService adminService;
public void setTransactionService(TransactionService transactionService)
{
this.transactionService = transactionService;
}
public void setCaveatConfigService(RMCaveatConfigService caveatConfigService)
{
this.caveatConfigService = caveatConfigService;
}
public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService)
{
this.customEmailMappingService = customEmailMappingService;
}
public void setRecordsManagementAdminService(RecordsManagementAdminService adminService)
public void setRecordsManagementAdminService(RecordsManagementAdminService adminService)
{
this.adminService = adminService;
}
@@ -66,7 +66,7 @@ public class RecordsManagementBootstrap extends AbstractLifecycleBean
{
return customEmailMappingService;
}
@Override
protected void onBootstrap(ApplicationEvent event)
{
@@ -77,28 +77,28 @@ public class RecordsManagementBootstrap extends AbstractLifecycleBean
{
RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
public Void execute()
{
// initialise caveat config
caveatConfigService.init();
// Initialise the custom model
adminService.initialiseCustomModel();
// Initialise the SplitEmailAction
SplitEmailAction action = (SplitEmailAction)getApplicationContext().getBean("splitEmail");
action.bootstrap();
return null;
}
};
transactionService.getRetryingTransactionHelper().doInTransaction(callback);
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
@Override
protected void onShutdown(ApplicationEvent event)
{

View File

@@ -392,7 +392,7 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
{
RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
public Void execute()
{
try
{

View File

@@ -53,10 +53,10 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
{
/** logger */
private static Log logger = LogFactory.getLog(DispositionLifecycleJobExecuter.class);
/** list of disposition actions to automatically execute */
private List<String> dispositionActions;
/** query string */
private String query;
@@ -71,14 +71,14 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
/**
* List of disposition actions to automatically execute when eligible.
*
*
* @param dispositionActions disposition actions
*/
public void setDispositionActions(List<String> dispositionActions)
{
this.dispositionActions = dispositionActions;
}
/**
* @param recordsManagementActionService records management action service
*/
@@ -102,21 +102,21 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
{
this.searchService = searchService;
}
/**
* Get the search query string.
*
*
* @return job query string
*/
private String getQuery()
{
if (query == null)
{
{
StringBuilder sb = new StringBuilder();
sb.append("+TYPE:\"rma:dispositionAction\" ");
sb.append("+(@rma\\:dispositionAction:(");
boolean bFirst = true;
for (String dispositionAction : dispositionActions)
{
@@ -128,20 +128,20 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
{
sb.append(" OR ");
}
sb.append("\"").append(dispositionAction).append("\"");
}
}
sb.append("))");
sb.append("+ISNULL:\"rma:dispositionActionCompletedAt\" ");
sb.append("+( ");
sb.append("@rma\\:dispositionEventsEligible:true ");
sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] ");
sb.append(") ");
query = sb.toString();
}
return query;
}
@@ -153,30 +153,30 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
try
{
logger.debug("Job Starting");
if (dispositionActions != null && !dispositionActions.isEmpty())
{
// execute search
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, getQuery());
List<NodeRef> resultNodes = results.getNodeRefs();
results.close();
if (logger.isDebugEnabled())
{
logger.debug("Processing " + resultNodes.size() + " nodes");
}
// process search results
for (NodeRef node : resultNodes)
{
final NodeRef currentNode = node;
RetryingTransactionCallback<Boolean> processTranCB = new RetryingTransactionCallback<Boolean>()
{
public Boolean execute() throws Throwable
public Boolean execute()
{
final String dispAction = (String) nodeService.getProperty(currentNode, RecordsManagementModel.PROP_DISPOSITION_ACTION);
// Run disposition action
if (dispAction != null && dispositionActions.contains(dispAction))
{
@@ -185,21 +185,21 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
{
Map<String, Serializable> props = new HashMap<String, Serializable>(1);
props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE);
// execute disposition action
recordsManagementActionService.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
if (logger.isDebugEnabled())
{
logger.debug("Processed action: " + dispAction + "on" + parent);
}
}
}
return Boolean.TRUE;
}
};
// if exists
if (nodeService.exists(currentNode))
{

View File

@@ -107,7 +107,7 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob
RetryingTransactionCallback<Boolean> txCallbackSendEmail = new RetryingTransactionCallback<Boolean>()
{
// Set the notification issued property.
public Boolean execute() throws Throwable
public Boolean execute()
{
// Send notification
recordsManagementNotificationHelper.recordsDueForReviewEmailNotification(resultNodes);
@@ -119,7 +119,7 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob
RetryingTransactionCallback<Boolean> txUpdateNodesCallback = new RetryingTransactionCallback<Boolean>()
{
// Set the notification issued property.
public Boolean execute() throws Throwable
public Boolean execute()
{
for (NodeRef node : resultNodes)
{

View File

@@ -201,7 +201,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
new RetryingTransactionHelper.RetryingTransactionCallback<List<NodeRef>>()
{
@Override
public List<NodeRef> execute() throws Throwable
public List<NodeRef> execute()
{
// Build the query string
StringBuilder sb = new StringBuilder();
@@ -251,7 +251,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
public Void execute()
{
if (logger.isDebugEnabled())
{
@@ -287,7 +287,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
public Void execute()
{
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
try
@@ -358,7 +358,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
public Void execute()
{
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
try

View File

@@ -63,7 +63,7 @@ public abstract class RecordsManagementJobExecuter implements RecordsManagementM
retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
public Void execute()
{
executeImpl();

View File

@@ -233,7 +233,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
* @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute()
*/
@Override
public Void execute() throws Throwable
public Void execute()
{
applyInternal();
return null;

View File

@@ -97,7 +97,7 @@ public class ModulePatchExecuterImpl extends AbstractModuleComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executeInternal() throws Throwable
protected void executeInternal()
{
// get current schema version
int currentSchema = getCurrentSchema();

View File

@@ -85,7 +85,7 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executeInternal() throws Throwable
protected void executeInternal()
{
try
{
@@ -98,7 +98,7 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
public Void execute()
{
behaviourFilter.disableBehaviour();
try
@@ -132,8 +132,6 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
/**
* Execute patch work.
*
* @throws Throwable
*/
protected abstract void executePatch() throws Throwable;
protected abstract void executePatch();
}

View File

@@ -126,7 +126,7 @@ public class NotificationTemplatePatch extends ModulePatchComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
NodeRef supersededTemplate = notificationHelper.getSupersededTemplate();
updateTemplate(supersededTemplate, PATH_SUPERSEDED);

View File

@@ -106,7 +106,7 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
Pair<Long, QName> aspectPair = qnameDAO.getQName(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT);
if (aspectPair != null)

View File

@@ -66,7 +66,7 @@ public class RMv2ModelPatch extends ModulePatchComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
updateQName(QName.createQName(DOD_URI, "filePlan"), TYPE_FILE_PLAN, "TYPE");
updateQName(QName.createQName(DOD_URI, "recordCategory"), TYPE_RECORD_CATEGORY, "TYPE");

View File

@@ -82,7 +82,7 @@ public class RMv2SavedSearchPatch extends ModulePatchComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
if (siteService.getSite(RM_SITE_ID) != null)
{

View File

@@ -82,7 +82,7 @@ public class NotificationTemplatePatch_v21 extends RMv21PatchComponent
}
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID);
// get the parent node

View File

@@ -85,7 +85,7 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be
* @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
// check that the rm config root has been correctly bootstrapped
if (!nodeService.exists(RM_CONFIG))

View File

@@ -123,7 +123,7 @@ public class RMv21CapabilityPatch extends RMv21PatchComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
Set<NodeRef> filePlans = getFilePlans();

View File

@@ -134,7 +134,7 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
Set<NodeRef> filePlans = filePlanService.getFilePlans();

View File

@@ -109,7 +109,7 @@ public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNa
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
String user = filePlanAuthenticationService.getRmAdminUserName();
String firstName = I18NUtil.getMessage(MSG_FIRST_NAME);

View File

@@ -102,7 +102,7 @@ public class RMv21RecordInheritancePatch extends RMv21PatchComponent
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
Pair<Long, QName> aspectPair = qnameDAO.getQName(ASPECT_RECORD);
if (aspectPair != null)

View File

@@ -69,7 +69,7 @@ public class RMv21ReportServicePatch extends RMv21PatchComponent
}
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
// check whether report dir exists or not
if (nodeService.exists(RM_CONFIG_FOLDER) && !nodeService.exists(TEMPLATE_ROOT))

View File

@@ -67,7 +67,7 @@ public class RMv21RolesPatch extends RMv21PatchComponent implements BeanNameAwar
* @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch()
*/
@Override
protected void executePatch() throws Throwable
protected void executePatch()
{
Set<NodeRef> filePlans = filePlanService.getFilePlans();