cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [3/6] cxf git commit: Fix a bunch of eclipse warnings
Date Fri, 28 Jul 2017 16:15:16 GMT
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/55c2f0e9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/55c2f0e9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/55c2f0e9

Branch: refs/heads/3.1.x-fixes
Commit: 55c2f0e9f1c53501ab7078c2d0b9adaa3d67f1ab
Parents: f7df387
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Jul 26 13:45:49 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Jul 28 12:13:21 2017 -0400

----------------------------------------------------------------------
 .../cxf/jaxrs/impl/AsyncResponseImpl.java       |  3 +-
 .../jaxrs/interceptor/JAXRSOutInterceptor.java  |  3 +-
 .../apache/cxf/jaxrs/impl/ResponseImplTest.java | 43 ++++++++++----------
 3 files changed, 26 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/55c2f0e9/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 f1606c9..f4395d8 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
@@ -269,7 +269,8 @@ public class AsyncResponseImpl implements AsyncResponse, ContinuationCallback
{
             return false;
         }
     }
-    
+
+    @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/55c2f0e9/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 9ee4c7d..7adbdbb 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
@@ -87,7 +87,8 @@ 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/55c2f0e9/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 72d90d5..915a3b6 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
@@ -391,27 +392,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 {


Mime
View raw message