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:25:02 UTC

[cxf-dosgi] 13/16: Tiny simplifications

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 68591a25ac72c977ec02994c674469745d00b293
Author: Amichai Rothman <am...@apache.org>
AuthorDate: Tue May 28 22:27:38 2019 +0300

    Tiny simplifications
---
 .../org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java  | 2 +-
 .../apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java | 6 ++++--
 .../main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java | 2 +-
 .../cxf/dosgi/itests/multi/customintent/ChangeTitleInterceptor.java | 2 +-
 .../cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java | 3 +--
 .../api/src/main/java/org/apache/cxf/dosgi/samples/rest/Task.java   | 2 +-
 .../api/src/main/java/org/apache/cxf/dosgi/samples/soap/Task.java   | 2 +-
 7 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java
index b9b4525..f1fd5ce 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java
@@ -134,7 +134,7 @@ public class IntentManagerImpl implements IntentManager {
         if (selectedIntents.size() > 1) {
             LOG.warn("More than one intent of type " + type + " present. Using only the first one.");
         }
-        return (T)selectedIntents.iterator().next();
+        return selectedIntents.iterator().next();
     }
 
     @Override
diff --git a/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java b/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java
index 985a9a0..fbdeaa7 100644
--- a/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java
+++ b/common/src/test/java/org/apache/cxf/dosgi/common/proxy/ServiceInvocationHandlerTest.java
@@ -33,7 +33,9 @@ import org.junit.Test;
 
 public class ServiceInvocationHandlerTest {
 
-    private static final Map<String, Method> OBJECT_METHODS = new HashMap<>(); {
+    private static final Map<String, Method> OBJECT_METHODS = new HashMap<>();
+
+    {
         for (Method m : Object.class.getMethods()) {
             OBJECT_METHODS.put(m.getName(), m);
         }
@@ -42,7 +44,7 @@ public class ServiceInvocationHandlerTest {
     @Test
     public void testInvoke() throws Throwable {
         ServiceInvocationHandler sih = new ServiceInvocationHandler("hello", String.class);
-        Method m = String.class.getMethod("length", new Class[] {});
+        Method m = String.class.getMethod("length");
         assertEquals(5, sih.invoke(null, m, new Object[] {}));
     }
 
diff --git a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
index 02578f3..00c2848 100644
--- a/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
+++ b/decorator/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
@@ -54,7 +54,7 @@ public class InterfaceRule implements Rule {
         if (type != null && !String.class.getName().equals(type)) {
             try {
                 Class<?> cls = getClass().getClassLoader().loadClass(type);
-                Constructor<?> ctor = cls.getConstructor(new Class[] {String.class});
+                Constructor<?> ctor = cls.getConstructor(String.class);
                 obj = ctor.newInstance(value);
             } catch (Throwable th) {
                 LOG.warn("Could not handle property '" + name
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/ChangeTitleInterceptor.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/ChangeTitleInterceptor.java
index 066117b..a3c0bef 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/ChangeTitleInterceptor.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/ChangeTitleInterceptor.java
@@ -41,7 +41,7 @@ public final class ChangeTitleInterceptor extends AbstractPhaseInterceptor<Messa
         try {
             MessageContentsList contents = MessageContentsList.getContentsList(message);
             Object response = contents.get(0);
-            Method method = response.getClass().getMethod("getReturn", new Class[]{});
+            Method method = response.getClass().getMethod("getReturn");
             Task task = (Task)method.invoke(response);
             task.setTitle("changed");
         } catch (Exception e) {
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 9e232d9..306d8be 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
@@ -133,8 +133,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         EasyMock.expectLastCall().atLeastOnce();
 
         c.replay();
-        ClassLoader cl = null;
-        Object proxy = p.importEndpoint(cl, requestingContext, exportedInterfaces, endpoint);
+        Object proxy = p.importEndpoint(null, requestingContext, exportedInterfaces, endpoint);
         assertNotNull(proxy);
         assertTrue("Proxy is not of the requested type! ", proxy instanceof Runnable);
         c.verify();
diff --git a/samples/rest/api/src/main/java/org/apache/cxf/dosgi/samples/rest/Task.java b/samples/rest/api/src/main/java/org/apache/cxf/dosgi/samples/rest/Task.java
index 6decde1..7d9e295 100644
--- a/samples/rest/api/src/main/java/org/apache/cxf/dosgi/samples/rest/Task.java
+++ b/samples/rest/api/src/main/java/org/apache/cxf/dosgi/samples/rest/Task.java
@@ -45,7 +45,7 @@ public class Task {
     }
 
     public void setId(Integer id) {
-        this.id = new Integer(id);
+        this.id = id;
     }
 
     public String getTitle() {
diff --git a/samples/soap/api/src/main/java/org/apache/cxf/dosgi/samples/soap/Task.java b/samples/soap/api/src/main/java/org/apache/cxf/dosgi/samples/soap/Task.java
index 2609f4c..50e4c0e 100644
--- a/samples/soap/api/src/main/java/org/apache/cxf/dosgi/samples/soap/Task.java
+++ b/samples/soap/api/src/main/java/org/apache/cxf/dosgi/samples/soap/Task.java
@@ -45,7 +45,7 @@ public class Task {
     }
 
     public void setId(Integer id) {
-        this.id = new Integer(id);
+        this.id = id;
     }
 
     public String getTitle() {