Remove redundant throws declarations from internal APIs

Closes gh-31176
This commit is contained in:
Andy Wilkinson
2022-05-26 14:24:55 +01:00
parent cbf42dea14
commit ee45fd2fc8
69 changed files with 157 additions and 193 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ public class ChatService {
@org.atmosphere.config.service.Message(encoders = JacksonEncoderDecoder.class,
decoders = JacksonEncoderDecoder.class)
public Message onMessage(Message message) throws IOException {
public Message onMessage(Message message) {
this.logger.info("Author " + message.getAuthor() + " sent message " + message.getMessage());
return message;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ public class SampleAtmosphereApplication {
return registration;
}
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
SpringApplication.run(SampleAtmosphereApplication.class, args);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,12 +53,12 @@ public class SampleBatchApplication {
}
@Bean
public Job job() throws Exception {
public Job job() {
return this.jobs.get("job").start(step1()).build();
}
@Bean
protected Step step1() throws Exception {
protected Step step1() {
return this.steps.get("step1").tasklet(tasklet()).build();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ import org.springframework.integration.file.FileWritingMessageHandler;
@SpringBootApplication
public class SampleParentContextApplication {
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
new SpringApplicationBuilder(Parent.class).child(SampleParentContextApplication.class).run(args);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ import static org.hamcrest.Matchers.containsString;
class SampleIntegrationParentApplicationTests {
@Test
void testVanillaExchange(@TempDir Path temp) throws Exception {
void testVanillaExchange(@TempDir Path temp) {
File inputDir = new File(temp.toFile(), "input");
File outputDir = new File(temp.toFile(), "output");
try (ConfigurableApplicationContext app = SpringApplication.run(SampleParentContextApplication.class,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,13 +41,13 @@ class CorsSampleActuatorApplicationTests {
}
@Test
void preflightRequestToEndpointShouldReturnOk() throws Exception {
void preflightRequestToEndpointShouldReturnOk() {
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:8080")
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isOk();
}
@Test
void preflightRequestWhenCorsConfigInvalidShouldReturnForbidden() throws Exception {
void preflightRequestWhenCorsConfigInvalidShouldReturnForbidden() {
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:9095")
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isForbidden();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public class SampleMethodSecurityApplication implements WebMvcConfigurer {
@SuppressWarnings("deprecation")
@Bean
public InMemoryUserDetailsManager inMemoryUserDetailsManager() throws Exception {
public InMemoryUserDetailsManager inMemoryUserDetailsManager() {
return new InMemoryUserDetailsManager(
User.withDefaultPasswordEncoder().username("admin").password("admin")
.roles("ADMIN", "USER", "ACTUATOR").build(),

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +19,7 @@ package smoketest.webservices.endpoint;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.Namespace;
import org.jdom2.filter.Filters;
import org.jdom2.xpath.XPathExpression;
@@ -47,8 +43,7 @@ public class HolidayEndpoint {
private HumanResourceService humanResourceService;
public HolidayEndpoint(HumanResourceService humanResourceService)
throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
public HolidayEndpoint(HumanResourceService humanResourceService) {
this.humanResourceService = humanResourceService;
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
XPathFactory xPathFactory = XPathFactory.instance();

View File

@@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {

View File

@@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {

View File

@@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {