You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/02/03 16:45:06 UTC

cxf git commit: FIx a bunch of warnings in Eclipse

Repository: cxf
Updated Branches:
  refs/heads/master 48be4bd64 -> 4a30203a0


FIx a bunch of warnings in Eclipse


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4a30203a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4a30203a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4a30203a

Branch: refs/heads/master
Commit: 4a30203a08ea11f96b52b454220ed5ce9419e3be
Parents: 48be4bd
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Feb 3 10:52:19 2017 -0500
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Feb 3 10:52:19 2017 -0500

----------------------------------------------------------------------
 .../cxf/cdi/JAXRSCdiResourceExtensionTest.java  |   8 +-
 .../cxf/osgi/itests/CXFOSGiTestSupport.java     |  17 ++-
 .../http_jetty/JettyHTTPServerEngine.java       |   1 -
 .../cxf/ws/rm/soap/RedeliveryQueueImpl.java     |   2 +-
 .../org/apache/cxf/sts/claims/LdapUtils.java    |   4 +-
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java |   2 +-
 .../ws/rm/sec/WSRMWithWSSecurityPolicyTest.java | 103 ++++++++++---------
 .../toolspec/parser/CommandLineParser.java      |   3 +-
 8 files changed, 69 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/integration/cdi/src/test/java/org/apache/cxf/cdi/JAXRSCdiResourceExtensionTest.java
----------------------------------------------------------------------
diff --git a/integration/cdi/src/test/java/org/apache/cxf/cdi/JAXRSCdiResourceExtensionTest.java b/integration/cdi/src/test/java/org/apache/cxf/cdi/JAXRSCdiResourceExtensionTest.java
index de4c0a6..c0997c0 100644
--- a/integration/cdi/src/test/java/org/apache/cxf/cdi/JAXRSCdiResourceExtensionTest.java
+++ b/integration/cdi/src/test/java/org/apache/cxf/cdi/JAXRSCdiResourceExtensionTest.java
@@ -44,9 +44,9 @@ public class JAXRSCdiResourceExtensionTest {
     @Mock
     private AfterBeanDiscovery event;
     @Mock
-    private Bean busBean;
+    private Bean<Bus> busBean;
     @Mock
-    private ProcessBean<? extends Object> processBean;
+    private ProcessBean<Bus> processBean;
     @Mock
     private Annotated annotated;
 
@@ -58,11 +58,13 @@ public class JAXRSCdiResourceExtensionTest {
         verify(event, never()).addBean(any(DefaultApplicationBean.class));
     }
 
+    @SuppressWarnings({"rawtypes", "unchecked"})
     @Test
     public void shouldNotAddBusBeanIfBeanAlreadySent() {
         when(processBean.getBean()).thenReturn(busBean);
         when(processBean.getAnnotated()).thenReturn(annotated);
-        when(busBean.getBeanClass()).thenReturn(Bus.class);
+        Class cls = Bus.class;
+        when(busBean.getBeanClass()).thenReturn(cls);
         when(busBean.getName()).thenReturn(CdiBusBean.CXF);
         extension.collect(processBean);
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
----------------------------------------------------------------------
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
index 19f684e..cd6e41c 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
@@ -286,11 +286,8 @@ public class CXFOSGiTestSupport {
         return getOsgiService(type, null, SERVICE_TIMEOUT);
     }
 
-    @SuppressWarnings({
-        "unchecked"
-    })
     protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
-        ServiceTracker tracker = null;
+        ServiceTracker<T, ?> tracker = null;
         try {
             String flt;
             if (filter != null) {
@@ -303,7 +300,7 @@ public class CXFOSGiTestSupport {
                 flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
             }
             Filter osgiFilter = FrameworkUtil.createFilter(flt);
-            tracker = new ServiceTracker(bundleContext, osgiFilter, null);
+            tracker = new ServiceTracker<T, Object>(bundleContext, osgiFilter, null);
             tracker.open(true);
             // Note that the tracker is not closed to keep the reference
             // This is buggy, as the service reference may change i think
@@ -312,11 +309,11 @@ public class CXFOSGiTestSupport {
                 Dictionary<String, String> dic = bundleContext.getBundle().getHeaders();
                 System.err.println("Test bundle headers: " + explode(dic));
 
-                for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, null))) {
+                for (ServiceReference<?> ref : asCollection(bundleContext.getAllServiceReferences(null, null))) {
                     System.err.println("ServiceReference: " + ref);
                 }
 
-                for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) {
+                for (ServiceReference<?> ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) {
                     System.err.println("Filtered ServiceReference: " + ref);
                 }
 
@@ -373,8 +370,8 @@ public class CXFOSGiTestSupport {
     /**
      * Provides an iterable collection of references, even if the original array is null
      */
-    private static Collection<ServiceReference> asCollection(ServiceReference[] references) {
-        return references != null ? Arrays.asList(references) : Collections.<ServiceReference> emptyList();
+    private static Collection<ServiceReference<?>> asCollection(ServiceReference<?>[] references) {
+        return references != null ? Arrays.asList(references) : Collections.<ServiceReference<?>> emptyList();
     }
 
     protected void assertBundleStarted(String name) {
@@ -395,7 +392,7 @@ public class CXFOSGiTestSupport {
     public void assertServicePublished(String filter, int timeout) {
         try {
             Filter serviceFilter = bundleContext.createFilter(filter);
-            ServiceTracker tracker = new ServiceTracker(bundleContext, serviceFilter, null);
+            ServiceTracker<?, ?> tracker = new ServiceTracker<>(bundleContext, serviceFilter, null);
             tracker.open();
             Object service = tracker.waitForService(timeout);
             tracker.close();

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
index b37b90d..db3ab99 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
@@ -354,7 +354,6 @@ public class JettyHTTPServerEngine implements ServerEngine {
         // need an error handler that won't leak information about the exception
         // back to the client.
         ErrorHandler eh = new ErrorHandler() {
-            @SuppressWarnings("deprecation")
             public void handle(String target, Request baseRequest, HttpServletRequest request,
                                HttpServletResponse response) throws IOException {
                 String msg = (String)request.getAttribute(RequestDispatcher.ERROR_MESSAGE);

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RedeliveryQueueImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RedeliveryQueueImpl.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RedeliveryQueueImpl.java
index e2ff271..af12259 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RedeliveryQueueImpl.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RedeliveryQueueImpl.java
@@ -630,7 +630,7 @@ public class RedeliveryQueueImpl implements RedeliveryQueue {
                 }
                 message.removeContent(XMLStreamReader.class);
             }
-            List olist = message.getContent(List.class);
+            List<?> olist = message.getContent(List.class);
             if (olist != null && olist.size() == 1) {
                 Object o = olist.get(0);
                 if (o instanceof XMLStreamReader) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapUtils.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapUtils.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapUtils.java
index 09138fb..39ec624 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapUtils.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapUtils.java
@@ -109,8 +109,8 @@ public final class LdapUtils {
 
         List<String> ldapAttributes = null;
 
-        AttributesMapper mapper = 
-            new AttributesMapper() {
+        AttributesMapper<Object> mapper = 
+            new AttributesMapper<Object>() {
             public Object mapFromAttributes(Attributes attrs) throws NamingException {
                 NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
                 while (attrEnum.hasMore()) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
index a91c8ef..19b01df 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
@@ -118,7 +118,7 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase {
         clientPolicy.setConnectionTimeout(500);
         try {
             Book book = wc.invoke("PATCH", new Book("Timeout", 123L), Book.class);
-            fail("should throw an exception due to timeout");
+            fail("should throw an exception due to timeout, instead got " + book);
         } catch (javax.ws.rs.ProcessingException e) {
             //expected!!!
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
index f3d2c19..3f7c2ac 100644
--- a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
+++ b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/sec/WSRMWithWSSecurityPolicyTest.java
@@ -69,63 +69,64 @@ public class WSRMWithWSSecurityPolicyTest extends AbstractBusClientServerTestBas
     public void testWithSecurityInPolicy() throws Exception {
         LOG.fine("Creating greeter client");
 
-        ClassPathXmlApplicationContext context = 
-            new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml");
+        try (ClassPathXmlApplicationContext context = 
+            new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml")) {
 
-        Bus bus = (Bus)context.getBean("bus");
-        BusFactory.setDefaultBus(bus);
-        BusFactory.setThreadDefaultBus(bus);
-        
-        Greeter greeter = (Greeter)context.getBean("GreeterCombinedClient");
-
-        RMManager manager = bus.getExtension(RMManager.class);
-        boolean empty = manager.getRetransmissionQueue().isEmpty();
-        assertTrue("RetransmissionQueue is not empty", empty);
-        
-        LOG.fine("Invoking greeter");
-        greeter.greetMeOneWay("one");
-
-        Thread.sleep(3000);
-
-        empty = manager.getRetransmissionQueue().isEmpty();
-        assertTrue("RetransmissionQueue not empty", empty);
+            Bus bus = (Bus)context.getBean("bus");
+            BusFactory.setDefaultBus(bus);
+            BusFactory.setThreadDefaultBus(bus);
+            
+            Greeter greeter = (Greeter)context.getBean("GreeterCombinedClient");
+    
+            RMManager manager = bus.getExtension(RMManager.class);
+            boolean empty = manager.getRetransmissionQueue().isEmpty();
+            assertTrue("RetransmissionQueue is not empty", empty);
+            
+            LOG.fine("Invoking greeter");
+            greeter.greetMeOneWay("one");
+    
+            Thread.sleep(3000);
+    
+            empty = manager.getRetransmissionQueue().isEmpty();
+            assertTrue("RetransmissionQueue not empty", empty);
 
-        context.close();
+        }
     }
 
     @Test
     public void testContextProperty() throws Exception {
-        ClassPathXmlApplicationContext context =
-                new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml");
-        Bus bus = (Bus)context.getBean("bus");
-        BusFactory.setDefaultBus(bus);
-        BusFactory.setThreadDefaultBus(bus);
-        Greeter greeter = (Greeter)context.getBean("GreeterCombinedClientNoProperty");
-        Client client = ClientProxy.getClient(greeter);
-        QName operationQName = new QName("http://cxf.apache.org/greeter_control", "greetMe");
-        BindingOperationInfo boi = client.getEndpoint().getBinding().getBindingInfo().getOperation(operationQName);
-        Map<String, Object> invocationContext = new HashMap<String, Object>();
-        Map<String, Object> requestContext = new HashMap<String, Object>();
-        Map<String, Object> responseContext = new HashMap<String, Object>();
-        invocationContext.put(Client.REQUEST_CONTEXT, requestContext);
-        invocationContext.put(Client.RESPONSE_CONTEXT, responseContext);
-
-        requestContext.put("ws-security.username", "Alice");
-        requestContext.put("ws-security.callback-handler", "org.apache.cxf.systest.ws.rm.sec.UTPasswordCallback");
-        requestContext.put("ws-security.encryption.properties", "bob.properties");
-        requestContext.put("ws-security.encryption.username", "bob");
-        requestContext.put("ws-security.signature.properties", "alice.properties");
-        requestContext.put("ws-security.signature.username", "alice");
-        RMManager manager = bus.getExtension(RMManager.class);
-        boolean empty = manager.getRetransmissionQueue().isEmpty();
-        assertTrue("RetransmissionQueue is not empty", empty);
-        GreetMe param = new GreetMe();
-        param.setRequestType("testContextProperty");
-        Object[] answer = client.invoke(boi, new Object[]{param}, invocationContext);
-        Assert.assertEquals("TESTCONTEXTPROPERTY", answer[0].toString());
-        Thread.sleep(5000);
-        empty = manager.getRetransmissionQueue().isEmpty();
-        assertTrue("RetransmissionQueue not empty", empty);
+        try (ClassPathXmlApplicationContext context =
+                new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml")) {
+            Bus bus = (Bus)context.getBean("bus");
+            BusFactory.setDefaultBus(bus);
+            BusFactory.setThreadDefaultBus(bus);
+            Greeter greeter = (Greeter)context.getBean("GreeterCombinedClientNoProperty");
+            Client client = ClientProxy.getClient(greeter);
+            QName operationQName = new QName("http://cxf.apache.org/greeter_control", "greetMe");
+            BindingOperationInfo boi = client.getEndpoint().getBinding().getBindingInfo().getOperation(operationQName);
+            Map<String, Object> invocationContext = new HashMap<String, Object>();
+            Map<String, Object> requestContext = new HashMap<String, Object>();
+            Map<String, Object> responseContext = new HashMap<String, Object>();
+            invocationContext.put(Client.REQUEST_CONTEXT, requestContext);
+            invocationContext.put(Client.RESPONSE_CONTEXT, responseContext);
+    
+            requestContext.put("ws-security.username", "Alice");
+            requestContext.put("ws-security.callback-handler", "org.apache.cxf.systest.ws.rm.sec.UTPasswordCallback");
+            requestContext.put("ws-security.encryption.properties", "bob.properties");
+            requestContext.put("ws-security.encryption.username", "bob");
+            requestContext.put("ws-security.signature.properties", "alice.properties");
+            requestContext.put("ws-security.signature.username", "alice");
+            RMManager manager = bus.getExtension(RMManager.class);
+            boolean empty = manager.getRetransmissionQueue().isEmpty();
+            assertTrue("RetransmissionQueue is not empty", empty);
+            GreetMe param = new GreetMe();
+            param.setRequestType("testContextProperty");
+            Object[] answer = client.invoke(boi, new Object[]{param}, invocationContext);
+            Assert.assertEquals("TESTCONTEXTPROPERTY", answer[0].toString());
+            Thread.sleep(5000);
+            empty = manager.getRetransmissionQueue().isEmpty();
+            assertTrue("RetransmissionQueue not empty", empty);
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a30203a/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
----------------------------------------------------------------------
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java b/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
index bb757db..7036eb4 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
+++ b/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
@@ -181,8 +181,7 @@ public class CommandLineParser {
             try {
                 TransformerFactory transformerFactory = TransformerFactory.newInstance();
                 transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                Transformer serializer = transformerFactory.newInstance()
-                    .newTransformer(
+                Transformer serializer = transformerFactory.newTransformer(
                                     new StreamSource(Tool.class
                                         .getResourceAsStream("indent-no-xml-declaration.xsl")));