You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by am...@apache.org on 2019/05/28 21:24:54 UTC
[cxf-dosgi] 05/16: Remove redundant throws clause
This is an automated email from the ASF dual-hosted git repository.
amichai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-dosgi.git
commit 5c9c12a6e06e51b4dec7ee0042789101dc712f57
Author: Amichai Rothman <am...@apache.org>
AuthorDate: Tue May 28 15:30:58 2019 +0300
Remove redundant throws clause
---
.../apache/cxf/dosgi/common/endpoint/ServerEndpoint.java | 4 +---
.../org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java | 2 +-
.../dosgi/common/httpservice/HttpServiceManagerTest.java | 5 ++---
.../httpservice/SecurityDelegatingHttpContextTest.java | 13 ++++++-------
.../java/org/apache/cxf/dosgi/dsw/decorator/Activator.java | 4 ++--
.../apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java | 2 +-
.../cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java | 4 ++--
.../apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java | 2 +-
.../org/apache/cxf/dosgi/itests/multi/MultiBundleTools.java | 4 ++--
.../org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java | 4 ++--
.../org/apache/cxf/dosgi/itests/multi/TestExportPolicy.java | 4 ++--
.../apache/cxf/dosgi/itests/multi/TestExportService.java | 4 ++--
.../apache/cxf/dosgi/itests/multi/TestImportService.java | 4 ++--
.../itests/multi/customintent/CustomIntentActivator.java | 4 ++--
.../dsw/handlers/rest/provider/RsProviderCustomTest.java | 2 +-
.../dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java | 12 ++++++------
.../cxf/dosgi/samples/security/SampleSecurityFilter.java | 2 +-
17 files changed, 36 insertions(+), 40 deletions(-)
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/endpoint/ServerEndpoint.java b/common/src/main/java/org/apache/cxf/dosgi/common/endpoint/ServerEndpoint.java
index a0ad662..08f5eb7 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/endpoint/ServerEndpoint.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/endpoint/ServerEndpoint.java
@@ -18,8 +18,6 @@
*/
package org.apache.cxf.dosgi.common.endpoint;
-import java.io.IOException;
-
import org.apache.aries.rsa.spi.Endpoint;
import org.apache.cxf.endpoint.Server;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
@@ -38,7 +36,7 @@ public class ServerEndpoint implements Endpoint {
}
@Override
- public void close() throws IOException {
+ public void close() {
this.server.destroy();
}
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java b/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java
index 4601d9c..01d7ef4 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/proxy/ExceptionMapper.java
@@ -34,7 +34,7 @@ public class ExceptionMapper {
introspectTypeForExceptions(iType);
}
- public Throwable mapException(Method m, Throwable ex) throws Throwable {
+ public Throwable mapException(Method m, Throwable ex) {
Throwable cause = ex.getCause() == null ? ex : ex.getCause();
Set<Class<?>> excTypes = exceptionsMap.get(m);
if (excTypes != null) {
diff --git a/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManagerTest.java b/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManagerTest.java
index 1f49f09..a97a330 100644
--- a/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManagerTest.java
+++ b/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManagerTest.java
@@ -41,7 +41,6 @@ import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpContext;
import org.osgi.service.http.HttpService;
-import org.osgi.service.http.NamespaceException;
import junit.framework.TestCase;
@@ -98,12 +97,12 @@ public class HttpServiceManagerTest extends TestCase {
@SuppressWarnings("rawtypes")
public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
- throws ServletException, NamespaceException {
+ throws ServletException {
Assert.assertEquals("/myService", alias);
servlet.init(config);
}
- public void registerResources(String alias, String name, HttpContext context) throws NamespaceException {
+ public void registerResources(String alias, String name, HttpContext context) {
throw new RuntimeException("This method should not be called");
}
diff --git a/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/SecurityDelegatingHttpContextTest.java b/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/SecurityDelegatingHttpContextTest.java
index aac1204..8b36548 100644
--- a/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/SecurityDelegatingHttpContextTest.java
+++ b/common/src/test/java/org/apache/cxf/dosgi/common/httpservice/SecurityDelegatingHttpContextTest.java
@@ -24,7 +24,6 @@ import java.net.URL;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
@@ -202,7 +201,7 @@ public class SecurityDelegatingHttpContextTest extends TestCase {
Assert.assertFalse(accessDeniedFilter.called);
}
- public void testDelegation() throws Exception {
+ public void testDelegation() {
BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
EasyMock.replay(bundleContext);
@@ -219,14 +218,14 @@ class CommitResponseFilter implements Filter {
boolean called;
- public void init(FilterConfig filterConfig) throws ServletException {
+ public void init(FilterConfig filterConfig) {
}
public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
- throws java.io.IOException, javax.servlet.ServletException {
+ throws java.io.IOException {
called = true;
response.getWriter().write("committing the response");
}
@@ -236,7 +235,7 @@ class DoNothingFilter implements Filter {
boolean called;
- public void init(FilterConfig filterConfig) throws ServletException {
+ public void init(FilterConfig filterConfig) {
}
public void destroy() {
@@ -253,14 +252,14 @@ class AccessDeniedFilter implements Filter {
boolean called;
- public void init(FilterConfig filterConfig) throws ServletException {
+ public void init(FilterConfig filterConfig) {
}
public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
- throws java.io.IOException, javax.servlet.ServletException {
+ throws java.io.IOException {
called = true;
((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
}
diff --git a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Activator.java b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Activator.java
index 372d7b1..673ebfc 100644
--- a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Activator.java
+++ b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Activator.java
@@ -27,14 +27,14 @@ public class Activator implements BundleActivator {
private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
private ServiceDecoratorBundleListener bundleListener;
- public void start(BundleContext context) throws Exception {
+ public void start(BundleContext context) {
ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl();
bundleListener = new ServiceDecoratorBundleListener(serviceDecorator);
context.addBundleListener(bundleListener);
context.registerService(ServiceDecorator.class.getName(), serviceDecorator, null);
}
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext context) {
LOG.debug("RemoteServiceAdmin Implementation is shutting down now");
if (bundleListener != null) {
context.removeBundleListener(bundleListener);
diff --git a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
index c66642b..c0a685b 100644
--- a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
+++ b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
@@ -150,7 +150,7 @@ public class InterfaceRuleTest extends TestCase {
private ServiceReference mockServiceReference(final Map<String, Object> serviceProps) {
ServiceReference sref = EasyMock.createMock(ServiceReference.class);
EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
+ public Object answer() {
return serviceProps.get(EasyMock.getCurrentArguments()[0]);
}
}).anyTimes();
diff --git a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
index da8928a..72d2476 100644
--- a/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
+++ b/decorator/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
@@ -56,7 +56,7 @@ public class ServiceDecoratorImplTest extends TestCase {
Map<String, Object> target = new HashMap<String, Object>();
ServiceReference sref = EasyMock.createMock(ServiceReference.class);
EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
+ public Object answer() {
return serviceProps.get(EasyMock.getCurrentArguments()[0]);
}
}).anyTimes();
@@ -160,7 +160,7 @@ public class ServiceDecoratorImplTest extends TestCase {
Map<String, Object> target = new HashMap<String, Object>();
ServiceReference sref = EasyMock.createMock(ServiceReference.class);
EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
+ public Object answer() {
return serviceProps.get(EasyMock.getCurrentArguments()[0]);
}
}).anyTimes();
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java
index 2c14c84..4f37af4 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java
@@ -281,7 +281,7 @@ public class AbstractDosgiTest {
.artifactId("cxf-dosgi-samples-rest-impl").versionAsInProject();
}
- protected static Option basicTestOptions() throws Exception {
+ protected static Option basicTestOptions() {
return composite(CoreOptions.junitBundles(), //
MultiBundleTools.getDistro(), //
// javax.xml.soap is imported since CXF 3.3.0 (CXF-7872, commit a95593cf),
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/MultiBundleTools.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/MultiBundleTools.java
index 4fd49ab..e3d96ba 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/MultiBundleTools.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/MultiBundleTools.java
@@ -33,7 +33,7 @@ public final class MultiBundleTools {
private MultiBundleTools() {
}
- private static Collection<String> getDistroBundles(File distroDir) throws Exception {
+ private static Collection<String> getDistroBundles(File distroDir) {
List<String> bundles = new ArrayList<>();
File bundlesDir = new File(distroDir, "bundle");
File[] files = bundlesDir.listFiles(new FilenameFilter() {
@@ -57,7 +57,7 @@ public final class MultiBundleTools {
return curBase.getParentFile().getParentFile();
}
- public static Option getDistro() throws Exception {
+ public static Option getDistro() {
File root = getRootDirectory();
File depRoot = new File(root, "target/dependency");
File distroDir = depRoot.listFiles()[0];
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
index 06eafd4..1c12e07 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
@@ -42,7 +42,7 @@ import org.osgi.framework.Constants;
public class TestCustomIntent extends AbstractDosgiTest {
@Configuration
- public static Option[] configure() throws Exception {
+ public static Option[] configure() {
return new Option[] //
{
basicTestOptions(), //
@@ -57,7 +57,7 @@ public class TestCustomIntent extends AbstractDosgiTest {
String serviceUri = HTTP_BASE_URI + "/cxf/taskservice";
final TaskService taskService = TaskServiceProxyFactory.create(serviceUri);
Task task = tryTo("Call TaskService", new Callable<Task>() {
- public Task call() throws Exception {
+ public Task call() {
return taskService.get(1);
}
});
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportPolicy.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportPolicy.java
index d7ba62d..056dc9b 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportPolicy.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportPolicy.java
@@ -44,7 +44,7 @@ public class TestExportPolicy extends AbstractDosgiTest {
ExportPolicy policy;
@Configuration
- public static Option[] configure() throws Exception {
+ public static Option[] configure() {
return new Option[] //
{//
basicTestOptions(), //
@@ -53,7 +53,7 @@ public class TestExportPolicy extends AbstractDosgiTest {
}
@Test
- public void testPolicyPresent() throws Exception {
+ public void testPolicyPresent() {
Assert.assertNotNull(policy);
}
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java
index ba2b2a5..7b08d1d 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java
@@ -55,7 +55,7 @@ public class TestExportService extends AbstractDosgiTest {
"/osgi/service_registry/http:##localhost:8181#cxf#taskservice";
@Configuration
- public static Option[] configure() throws Exception {
+ public static Option[] configure() {
return new Option[] //
{//
basicTestOptions(), //
@@ -84,7 +84,7 @@ public class TestExportService extends AbstractDosgiTest {
client.accept(MediaType.APPLICATION_XML_TYPE);
org.apache.cxf.dosgi.samples.rest.Task task = tryTo("Call REST Resource",
new Callable<org.apache.cxf.dosgi.samples.rest.Task>() {
- public org.apache.cxf.dosgi.samples.rest.Task call() throws Exception {
+ public org.apache.cxf.dosgi.samples.rest.Task call() {
return client.get(org.apache.cxf.dosgi.samples.rest.Task.class);
}
}
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestImportService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestImportService.java
index af840f1..344d297 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestImportService.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestImportService.java
@@ -52,7 +52,7 @@ public class TestImportService extends AbstractDosgiTest {
private Server server;
@Configuration
- public static Option[] configure() throws Exception {
+ public static Option[] configure() {
return new Option[] //
{//
basicTestOptions(), //
@@ -78,7 +78,7 @@ public class TestImportService extends AbstractDosgiTest {
}
@Test
- public void testClientConsumer() throws Exception {
+ public void testClientConsumer() {
Task task = taskService.get(1);
Assert.assertEquals("test", task.getTitle());
}
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
index 7765ef3..b0555fd 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
@@ -29,7 +29,7 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
public class CustomIntentActivator implements BundleActivator {
- public void start(BundleContext context) throws Exception {
+ public void start(BundleContext context) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("org.apache.cxf.dosgi.IntentName", "myIntent");
context.registerService(CustomFeatureProvider.class, new CustomFeatureProvider(), props);
@@ -42,6 +42,6 @@ public class CustomIntentActivator implements BundleActivator {
context.registerService(TaskService.class, new DummyTaskServiceImpl(), props2);
}
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext context) {
}
}
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java
index 2bb31bd..a127ffb 100644
--- a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java
@@ -85,7 +85,7 @@ public class RsProviderCustomTest {
private Callable<List<Object>> intentProvider(final Object... intents) {
return new Callable<List<Object>>() {
@Override
- public List<Object> call() throws Exception {
+ public List<Object> call() {
return Arrays.asList(intents);
}
};
diff --git a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
index 0b87da4..f234014 100644
--- a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
+++ b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
@@ -140,7 +140,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
c.verify();
}
- public void testCreateServerWithAddressProperty() throws Exception {
+ public void testCreateServerWithAddressProperty() {
BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
EasyMock.replay(dswContext);
@@ -176,7 +176,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
assertEquals("http://alternate_host:80/myString", edProps.get(RemoteConstants.ENDPOINT_ID));
}
- public void testAddressing() throws Exception {
+ public void testAddressing() {
runAddressingTest(new HashMap<String, Object>(), "http://localhost:9000/java/lang/Runnable");
Map<String, Object> p1 = new HashMap<String, Object>();
@@ -192,7 +192,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
runAddressingTest(p4, "http://localhost:8181/java/lang/Runnable");
}
- private void runAddressingTest(Map<String, Object> properties, String expectedAddress) throws Exception {
+ private void runAddressingTest(Map<String, Object> properties, String expectedAddress) {
Class<?>[] exportedInterface = new Class[] {Runnable.class};
EndpointHelper.addObjectClass(properties, exportedInterface);
BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
@@ -272,14 +272,14 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
EasyMock.expect(sfb.create()).andReturn(server);
sfb.setAddress((String)EasyMock.anyObject());
EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
+ public Object answer() {
serverURI.setLength(0);
serverURI.append(EasyMock.getCurrentArguments()[0]);
return null;
}
});
EasyMock.expect(sfb.getAddress()).andAnswer(new IAnswer<String>() {
- public String answer() throws Throwable {
+ public String answer() {
return serverURI.toString();
}
});
@@ -290,7 +290,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
private Server createMockServer(final ServerFactoryBean sfb) {
AttributedURIType addr = EasyMock.createMock(AttributedURIType.class);
EasyMock.expect(addr.getValue()).andAnswer(new IAnswer<String>() {
- public String answer() throws Throwable {
+ public String answer() {
return sfb.getAddress();
}
});
diff --git a/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java b/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
index 92c65b3..4da2894 100644
--- a/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
+++ b/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
@@ -65,7 +65,7 @@ public class SampleSecurityFilter implements Filter {
}
}
- public void init(FilterConfig config) throws ServletException {
+ public void init(FilterConfig config) {
LOG.info("init()");
}
}