Fixed minor bugs (Redundant Throws) reported in Sonar

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@73861 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-06-15 12:16:08 +00:00
parent 114c198b44
commit 20f6fee1db
13 changed files with 59 additions and 78 deletions

View File

@@ -22,7 +22,6 @@ import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditSe
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.repository.NodeRef;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -66,7 +65,7 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
public void setApplicationContext(ApplicationContext applicationContext)
{
this.applicationContext = applicationContext;
}

View File

@@ -129,7 +129,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
}
@SuppressWarnings("rawtypes")
public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object returnedObject) throws AccessDeniedException
public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object returnedObject)
{
if (logger.isDebugEnabled())
{
@@ -239,14 +239,14 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
}
private PermissionCheckedValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckedValue returnedObject) throws AccessDeniedException
private PermissionCheckedValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckedValue returnedObject)
{
// This passes as it has already been filtered
// TODO: Get the filter that was applied and double-check
return returnedObject;
}
private PermissionCheckValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckValue returnedObject) throws AccessDeniedException
private PermissionCheckValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckValue returnedObject)
{
// Get the wrapped value
NodeRef nodeRef = returnedObject.getNodeRef();
@@ -255,8 +255,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
return returnedObject;
}
private NodeRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, NodeRef returnedObject) throws AccessDeniedException
private NodeRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, NodeRef returnedObject)
{
if (returnedObject == null)
{
@@ -322,8 +321,6 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
}
private ChildAssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ChildAssociationRef returnedObject)
throws AccessDeniedException
{
if (returnedObject == null)
{
@@ -373,8 +370,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
return returnedObject;
}
private AssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, AssociationRef returnedObject) throws AccessDeniedException
private AssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, AssociationRef returnedObject)
{
if (returnedObject == null)
{
@@ -416,16 +412,14 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
return returnedObject;
}
private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PagingLuceneResultSet returnedObject) throws AccessDeniedException
private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PagingLuceneResultSet returnedObject)
{
ResultSet raw = returnedObject.getWrapped();
ResultSet filteredForPermissions = decide(authentication, object, config, raw);
return new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService);
}
private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject) throws AccessDeniedException
private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject)
{
if (returnedObject == null)
{
@@ -569,8 +563,6 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
}
private QueryEngineResults decide(Authentication authentication, Object object, ConfigAttributeDefinition config, QueryEngineResults returnedObject)
throws AccessDeniedException
{
Map<Set<String>, ResultSet> map = returnedObject.getResults();
Map<Set<String>, ResultSet> answer = new HashMap<Set<String>, ResultSet>(map.size(), 1.0f);
@@ -594,7 +586,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private Collection decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Collection returnedObject) throws AccessDeniedException
private Collection decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Collection returnedObject)
{
if (returnedObject == null)
{
@@ -788,7 +780,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
return PermissionCheckedCollectionMixin.create(returnedObject, cutoff, checksRemaining, sizeOriginal);
}
private Object[] decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object[] returnedObject) throws AccessDeniedException
private Object[] decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object[] returnedObject)
{
// Assumption: value is not null
BitSet incudedSet = new BitSet(returnedObject.length);
@@ -952,7 +944,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
}
@SuppressWarnings({"unchecked", "rawtypes" })
private Map decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Map returnedObject) throws AccessDeniedException
private Map decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Map returnedObject)
{
try {
if (returnedObject.containsKey(RecordsManagementModel.PROP_HOLD_REASON))

View File

@@ -36,7 +36,6 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -71,7 +70,7 @@ public class RMSecurityCommon implements ApplicationContextAware
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
public void setApplicationContext(ApplicationContext applicationContext)
{
this.applicationContext = applicationContext;
}
@@ -222,12 +221,12 @@ public class RMSecurityCommon implements ApplicationContextAware
{
// log message
RMMethodSecurityInterceptor.addMessage("User does not have read record permission on node, access denied. (nodeRef={0}, user={1})", nodeRef, AuthenticationUtil.getRunAsUser());
if (logger.isDebugEnabled())
{
logger.debug("\t\tUser does not have read record permission on node, access denied. (nodeRef=" + nodeRef.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")");
}
return setTransactionCache("checkRmRead", nodeRef, AccessDecisionVoter.ACCESS_DENIED);
}
@@ -235,7 +234,7 @@ public class RMSecurityCommon implements ApplicationContextAware
{
// log capability details
RMMethodSecurityInterceptor.reportCapabilityStatus(RMPermissionModel.VIEW_RECORDS, AccessDecisionVoter.ACCESS_DENIED);
if (logger.isDebugEnabled())
{
logger.debug("\t\tUser does not have view records capability permission on node, access denied. (filePlan=" + filePlan.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")");

View File

@@ -1,6 +1,5 @@
package org.alfresco.module.org_alfresco_module_rm.model.compatibility;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
@@ -9,7 +8,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
* Dictionary bootstap post processor.
* <p>
* Ensures compatibility with 4.2 and 4.2.1 as well as 4.2.2.
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -18,20 +17,20 @@ public class DictionaryBootstrapPostProcessor implements BeanFactoryPostProcesso
/** bean id's */
private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap";
private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap";
/**
* @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
*/
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
{
// if the site service bootstrap bean and the RM dictionary bean are present in the bean factory
if (beanFactory.containsBean(BEAN_SITESERVICE_BOOTSTRAP) &&
if (beanFactory.containsBean(BEAN_SITESERVICE_BOOTSTRAP) &&
beanFactory.containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP))
{
// get the RM dictionary bootstrap bean definition
BeanDefinition beanDef = beanFactory.getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP);
// set the dependency
beanDef.setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP});
}

View File

@@ -22,13 +22,12 @@ import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent;
import org.alfresco.repo.module.ModuleComponent;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* Convenience class to ensure all V2.0 patches are executed before v2.1
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -38,16 +37,16 @@ public abstract class RMv21PatchComponent extends ModulePatchComponent
{
/** application context */
private ApplicationContext applicationContext;
/**
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
public void setApplicationContext(ApplicationContext applicationContext)
{
this.applicationContext = applicationContext;
}
/**
* init method
*/
@@ -55,7 +54,7 @@ public abstract class RMv21PatchComponent extends ModulePatchComponent
public void init()
{
super.init();
// manual addition of V20 patch dependencies
List<ModuleComponent> depends = getDependsOn();
addDependency(depends, "org_alfresco_module_rm_notificationTemplatePatch");
@@ -63,7 +62,7 @@ public abstract class RMv21PatchComponent extends ModulePatchComponent
addDependency(depends, "org_alfresco_module_rm_RMv2FilePlanNodeRefPatch");
addDependency(depends, "org_alfresco_module_rm_RMv2SavedSearchPatch");
}
/**
* @param depends list of module dependencies
* @param beanName bean name

View File

@@ -21,7 +21,6 @@ package org.alfresco.module.org_alfresco_module_rm.report.generator;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.report.Report;
import org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator;
import org.alfresco.module.org_alfresco_module_rm.report.ReportService;
@@ -33,7 +32,7 @@ import org.alfresco.util.ParameterCheck;
/**
* Base report generator.
*
*
* @author Roy Wetherall
* @since 2.1
*/
@@ -63,7 +62,7 @@ public abstract class BaseReportGenerator implements ReportGenerator
{
this.namespaceService = namespaceService;
}
/**
* @param reportType report type
*/
@@ -71,7 +70,7 @@ public abstract class BaseReportGenerator implements ReportGenerator
{
this.reportType = reportType;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#getReportType()
*/
@@ -88,7 +87,7 @@ public abstract class BaseReportGenerator implements ReportGenerator
{
// ensure required values have been set
ParameterCheck.mandatory("reportType", reportType);
// register report generator
reportService.registerReportGenerator(this);
}
@@ -104,29 +103,28 @@ public abstract class BaseReportGenerator implements ReportGenerator
// check the applicability of the report generator for the given reported upon node
checkReportApplicability(reportedUponNodeRef);
// generate the report name
String reportName = generateReportName(reportedUponNodeRef, mimetype);
// generate the report meta-data
Map<QName, Serializable> reportProperties = generateReportMetadata(reportedUponNodeRef);
// generate the report content
ContentReader contentReader = generateReportContent(reportedUponNodeRef, mimetype, generateReportTemplateContext(reportedUponNodeRef));
// return the report information object
return new ReportInfo(reportType, reportName, reportProperties, contentReader);
}
/**
* Checks whether the report generator is applicable given the reported upon node reference.
* <p>
* Throws AlfrescoRuntimeException if applicability fails, with reason.
*
*
* @param reportedUponNodeRef reported upon node reference
* @throws AlfrescoRuntimeException if applicability check fails
*/
protected abstract void checkReportApplicability(NodeRef reportedUponNodeRef) throws AlfrescoRuntimeException;
protected abstract void checkReportApplicability(NodeRef reportedUponNodeRef);
/**
* Generate the report name
@@ -137,7 +135,7 @@ public abstract class BaseReportGenerator implements ReportGenerator
* Generate the report template context.
*/
protected abstract Map<String, Serializable> generateReportTemplateContext(NodeRef reportedUponNodeRef);
/**
* Generate report meta-data
*/

View File

@@ -313,7 +313,7 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
* @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#checkReportApplicability(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void checkReportApplicability(NodeRef reportedUponNodeRef) throws AlfrescoRuntimeException
protected void checkReportApplicability(NodeRef reportedUponNodeRef)
{
if (applicableTypes != null && applicableTypes.size() != 0)
{

View File

@@ -27,7 +27,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.AuthorityType;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -96,7 +95,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
public void setApplicationContext(ApplicationContext applicationContext)
{
this.applicationContext = applicationContext;
}

View File

@@ -26,7 +26,6 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
@@ -80,7 +79,7 @@ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor
* @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
*/
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
{
for (String bean : getSecurityBeanNames(beanFactory))
{

View File

@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.util;
import org.alfresco.util.ParameterCheck;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@@ -32,7 +31,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
* Extends the definition of a bean with another.
* <p>
* Implements bean factory post processor.
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -40,10 +39,10 @@ public class BeanExtender implements BeanFactoryPostProcessor
{
/** name of bean to extend */
private String beanName;
/** extending bean name */
private String extendingBeanName;
/**
* @param beanName bean name
*/
@@ -51,7 +50,7 @@ public class BeanExtender implements BeanFactoryPostProcessor
{
this.beanName = beanName;
}
/**
* @param extendingBeanName extending bean name
*/
@@ -59,12 +58,12 @@ public class BeanExtender implements BeanFactoryPostProcessor
{
this.extendingBeanName = extendingBeanName;
}
/**
* @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
*/
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
{
ParameterCheck.mandatory("beanName", beanName);
ParameterCheck.mandatory("extendingBeanName", extendingBeanName);
@@ -74,24 +73,24 @@ public class BeanExtender implements BeanFactoryPostProcessor
{
throw new NoSuchBeanDefinitionException("Can't find bean '" + beanName + "' to be extended.");
}
// check for extending bean
if (!beanFactory.containsBean(extendingBeanName))
{
throw new NoSuchBeanDefinitionException("Can't find bean '" + extendingBeanName + "' that is going to extend origional bean definition.");
}
}
// get the bean definitions
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
BeanDefinition extendingBeanDefinition = beanFactory.getBeanDefinition(extendingBeanName);
// update class
if (StringUtils.isNotBlank(extendingBeanDefinition.getBeanClassName()) &&
!beanDefinition.getBeanClassName().equals(extendingBeanDefinition.getBeanClassName()))
{
beanDefinition.setBeanClassName(extendingBeanDefinition.getBeanClassName());
}
// update properties
MutablePropertyValues properties = beanDefinition.getPropertyValues();
MutablePropertyValues extendingProperties = extendingBeanDefinition.getPropertyValues();

View File

@@ -25,7 +25,7 @@ import org.alfresco.service.namespace.QName;
/**
* QName type editor.
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -33,7 +33,7 @@ public class QNameTypeEditor extends PropertyEditorSupport
{
/** namespace service */
private NamespaceService namespaceService;
/**
* @param namespaceService namespace service
*/
@@ -41,12 +41,12 @@ public class QNameTypeEditor extends PropertyEditorSupport
{
this.namespaceService = namespaceService;
}
/**
* @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
*/
@Override
public void setAsText(String text) throws IllegalArgumentException
public void setAsText(String text)
{
// convert prefix string to QName
setValue(QName.createQName(text, namespaceService));

View File

@@ -33,7 +33,6 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck;
import org.alfresco.util.PropertyMap;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -58,7 +57,7 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
public void setApplicationContext(ApplicationContext applicationContext)
{
this.applicationContext = applicationContext;
}

View File

@@ -27,7 +27,6 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
/**
@@ -68,7 +67,7 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
*/
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
public Object postProcessAfterInitialization(Object bean, String beanName)
{
// register annotated behavior methods
registerBehaviours(bean, beanName);
@@ -81,7 +80,7 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
*/
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
public Object postProcessBeforeInitialization(Object bean, String beanName)
{
// do nothing
return bean;