Remove redundant throws clauses
Removes exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
This commit is contained in:
@@ -43,46 +43,46 @@ public class AspectJInterceptorTests {
|
||||
private SecuredService securedService;
|
||||
|
||||
@Test
|
||||
public void testPublicMethod() throws Exception {
|
||||
public void testPublicMethod() {
|
||||
service.publicMethod();
|
||||
}
|
||||
|
||||
@Test(expected = AuthenticationCredentialsNotFoundException.class)
|
||||
public void testSecuredMethodNotAuthenticated() throws Exception {
|
||||
public void testSecuredMethodNotAuthenticated() {
|
||||
service.secureMethod();
|
||||
}
|
||||
|
||||
@Test(expected = AccessDeniedException.class)
|
||||
public void testSecuredMethodWrongRole() throws Exception {
|
||||
public void testSecuredMethodWrongRole() {
|
||||
SecurityContextHolder.getContext().setAuthentication(admin);
|
||||
service.secureMethod();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecuredMethodEverythingOk() throws Exception {
|
||||
public void testSecuredMethodEverythingOk() {
|
||||
SecurityContextHolder.getContext().setAuthentication(user);
|
||||
service.secureMethod();
|
||||
}
|
||||
|
||||
@Test(expected = AuthenticationCredentialsNotFoundException.class)
|
||||
public void testSecuredClassNotAuthenticated() throws Exception {
|
||||
public void testSecuredClassNotAuthenticated() {
|
||||
securedService.secureMethod();
|
||||
}
|
||||
|
||||
@Test(expected = AccessDeniedException.class)
|
||||
public void testSecuredClassWrongRole() throws Exception {
|
||||
public void testSecuredClassWrongRole() {
|
||||
SecurityContextHolder.getContext().setAuthentication(admin);
|
||||
securedService.secureMethod();
|
||||
}
|
||||
|
||||
@Test(expected = AccessDeniedException.class)
|
||||
public void testSecuredClassWrongRoleOnNewedInstance() throws Exception {
|
||||
public void testSecuredClassWrongRoleOnNewedInstance() {
|
||||
SecurityContextHolder.getContext().setAuthentication(admin);
|
||||
new SecuredService().secureMethod();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecuredClassEverythingOk() throws Exception {
|
||||
public void testSecuredClassEverythingOk() {
|
||||
SecurityContextHolder.getContext().setAuthentication(user);
|
||||
securedService.secureMethod();
|
||||
new SecuredService().secureMethod();
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class ProxyTicketSampleServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
throws IOException {
|
||||
// NOTE: The CasAuthenticationToken can also be obtained using
|
||||
// SecurityContextHolder.getContext().getAuthentication()
|
||||
final CasAuthenticationToken token = (CasAuthenticationToken) request
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(contactDao, "contactDao required");
|
||||
Assert.notNull(mutableAclService, "mutableAclService required");
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(mutableAclService, "mutableAclService required");
|
||||
Assert.notNull(template, "dataSource required");
|
||||
Assert.notNull(tt, "platformTransactionManager required");
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
this.documentDao = documentDao;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
// ACL tables
|
||||
template.execute("CREATE TABLE ACL_SID(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY,PRINCIPAL BOOLEAN NOT NULL,SID VARCHAR_IGNORECASE(100) NOT NULL,CONSTRAINT UNIQUE_UK_1 UNIQUE(SID,PRINCIPAL));");
|
||||
template.execute("CREATE TABLE ACL_CLASS(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY,CLASS VARCHAR_IGNORECASE(100) NOT NULL,CLASS_ID_TYPE VARCHAR_IGNORECASE(100),CONSTRAINT UNIQUE_UK_2 UNIQUE(CLASS));");
|
||||
|
||||
@@ -120,7 +120,7 @@ public class GaeAuthenticationFilter extends GenericFilterBean {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws ServletException {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(authenticationManager, "AuthenticationManager must be set");
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.google.appengine.api.users.UserServiceFactory;
|
||||
public class GoogleAccountsAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException, ServletException {
|
||||
AuthenticationException authException) throws IOException {
|
||||
UserService userService = UserServiceFactory.getUserService();
|
||||
|
||||
response.sendRedirect(userService.createLoginURL(request.getRequestURI()));
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AppRoleTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bitsAreCorrect() throws Exception {
|
||||
public void bitsAreCorrect() {
|
||||
// If this fails, someone has modified the Enum and the Datastore is probably
|
||||
// corrupt!
|
||||
assertThat(ADMIN.getBit()).isZero();
|
||||
|
||||
@@ -35,12 +35,12 @@ public class GaeDataStoreUserRegistryTests {
|
||||
new LocalDatastoreServiceTestConfig());
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
helper.setUp();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void tearDown() {
|
||||
helper.tearDown();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ public class UsernameEqualsPasswordLoginModule implements LoginModule {
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public boolean abort() throws LoginException {
|
||||
public boolean abort() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean commit() throws LoginException {
|
||||
public boolean commit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class UsernameEqualsPasswordLoginModule implements LoginModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean logout() throws LoginException {
|
||||
public boolean logout() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,12 +102,10 @@ public class ServletApiController {
|
||||
* @param loginForm
|
||||
* @param result
|
||||
* @return
|
||||
* @throws ServletException
|
||||
*/
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
public String login(HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute LoginForm loginForm, BindingResult result)
|
||||
throws ServletException {
|
||||
@ModelAttribute LoginForm loginForm, BindingResult result) {
|
||||
try {
|
||||
request.login(loginForm.getUsername(), loginForm.getPassword());
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.util.Assert;
|
||||
public class SeedData implements InitializingBean {
|
||||
private BankDao bankDao;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(bankDao, "bankDao cannot be null");
|
||||
bankDao.createOrUpdateAccount(new Account("rod"));
|
||||
bankDao.createOrUpdateAccount(new Account("dianne"));
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ListAccounts implements Controller {
|
||||
}
|
||||
|
||||
public ModelAndView handleRequest(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
HttpServletResponse response) {
|
||||
// Security check (this is unnecessary if Spring Security is performing the
|
||||
// authorization)
|
||||
// if (request.getUserPrincipal() == null) {
|
||||
|
||||
Reference in New Issue
Block a user