cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: Fix a bunch of eclipse warnings
Date Wed, 26 Jul 2017 17:46:04 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 7facb09bd -> 974c9d346


Fix a bunch of eclipse warnings


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

Branch: refs/heads/master
Commit: 974c9d346ca9229d60a4d176b892f5920b994668
Parents: 7facb09
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Jul 26 13:45:49 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Jul 26 13:45:49 2017 -0400

----------------------------------------------------------------------
 .../cxf/jaxrs/impl/AsyncResponseImpl.java       |  1 +
 .../jaxrs/interceptor/JAXRSOutInterceptor.java  |  1 +
 .../apache/cxf/jaxrs/impl/ResponseImplTest.java | 43 ++++++++++----------
 .../apache/cxf/jaxrs/utils/JAXBUtilsTest.java   |  2 +-
 .../ws/security/wss4j/WSS4JInInterceptor.java   | 10 +++--
 5 files changed, 31 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/974c9d34/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
index ace39eac..80a7fe5 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
@@ -270,6 +270,7 @@ public class AsyncResponseImpl implements AsyncResponse, ContinuationCallback
{
         }
     }
 
+    @SuppressWarnings("resource") // Response that is built here shouldn't be closed here
     public Object getResponseObject() {
         Object obj = cont.getObject();
         if (!(obj instanceof Response) && !(obj instanceof Throwable)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/974c9d34/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
index 6154ad2..8aaf82f 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
@@ -88,6 +88,7 @@ public class JAXRSOutInterceptor extends AbstractOutDatabindingInterceptor
{
 
     }
 
+    @SuppressWarnings("resource") // Response shouldn't be closed here
     private void processResponse(ServerProviderFactory providerFactory, Message message)
{
 
         if (isResponseAlreadyHandled(message)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/974c9d34/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java
index 38e9a9a..7ecfa0f 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java
@@ -65,6 +65,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 
+@SuppressWarnings("resource") // Responses built in this test don't need to be closed
 public class ResponseImplTest extends Assert {
 
     @Test
@@ -402,27 +403,27 @@ public class ResponseImplTest extends Assert {
 
     @Test
     public void testGetLinksNoRel() {
-        ResponseImpl ri = new ResponseImpl(200);
-        MetadataMap<String, Object> meta = new MetadataMap<String, Object>();
-        ri.addMetadata(meta);
-
-        Set<Link> links = ri.getLinks();
-        assertTrue(links.isEmpty());
-
-        meta.add(HttpHeaders.LINK, "<http://next>");
-        meta.add(HttpHeaders.LINK, "<http://prev>");
-
-        assertFalse(ri.hasLink("next"));
-        Link next = ri.getLink("next");
-        assertNull(next);
-        assertFalse(ri.hasLink("prev"));
-        Link prev = ri.getLink("prev");
-        assertNull(prev);
-
-        links = ri.getLinks();
-        assertTrue(links.contains(Link.fromUri("http://next").build()));
-        assertTrue(links.contains(Link.fromUri("http://prev").build()));
-
+        try (ResponseImpl ri = new ResponseImpl(200)) {
+            MetadataMap<String, Object> meta = new MetadataMap<String, Object>();
+            ri.addMetadata(meta);
+    
+            Set<Link> links = ri.getLinks();
+            assertTrue(links.isEmpty());
+    
+            meta.add(HttpHeaders.LINK, "<http://next>");
+            meta.add(HttpHeaders.LINK, "<http://prev>");
+    
+            assertFalse(ri.hasLink("next"));
+            Link next = ri.getLink("next");
+            assertNull(next);
+            assertFalse(ri.hasLink("prev"));
+            Link prev = ri.getLink("prev");
+            assertNull(prev);
+    
+            links = ri.getLinks();
+            assertTrue(links.contains(Link.fromUri("http://next").build()));
+            assertTrue(links.contains(Link.fromUri("http://prev").build()));
+        }
     }
 
     public static class StringBean {

http://git-wip-us.apache.org/repos/asf/cxf/blob/974c9d34/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXBUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXBUtilsTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXBUtilsTest.java
index 61a5aef..b96f974 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXBUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXBUtilsTest.java
@@ -48,7 +48,7 @@ public class JAXBUtilsTest {
     private void correctValueType(Class<?> clazz) {
         Field field = clazz.getDeclaredFields()[0];
         Annotation[] paramAnns = field.getDeclaredAnnotations();
-        Class valueType = JAXBUtils.getValueTypeFromAdapter(LocalDate.class, LocalDate.class,
paramAnns);
+        Class<?> valueType = JAXBUtils.getValueTypeFromAdapter(LocalDate.class, LocalDate.class,
paramAnns);
         Assert.assertEquals(String.class, valueType);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/974c9d34/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
index 442469e..6fdd656 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
@@ -378,8 +378,9 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
                     List<WSSecurityEngineResult> encryptResults = wsResult.getActionResults().get(WSConstants.ENCR);
                     if (encryptResults != null) {
                         for (WSSecurityEngineResult result : wsResult.getActionResults().get(WSConstants.ENCR))
{
-                            for (WSDataRef dataRef
-                                : (List<WSDataRef>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS))
{
+                            List<WSDataRef> dataRefs = CastUtils.cast((List<?>)result
+                                                                      .get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
+                            for (WSDataRef dataRef : dataRefs) {
                                 if (dataRef.getProtectedElement() == node) {
                                     dataRef.setProtectedElement((Element)newNode);
                                 }
@@ -398,8 +399,9 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
                         signedResults.addAll(wsResult.getActionResults().get(WSConstants.ST_SIGNED));
                     }
                     for (WSSecurityEngineResult result : signedResults) {
-                        for (WSDataRef dataRef
-                            : (List<WSDataRef>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS))
{
+                        List<WSDataRef> dataRefs = CastUtils.cast((List<?>)result
+                                                                  .get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
+                        for (WSDataRef dataRef :dataRefs) {
                             if (dataRef.getProtectedElement() == node) {
                                 dataRef.setProtectedElement((Element)newNode);
                             }


Mime
View raw message