cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-6060] Avoid checking the providers if the out message is null
Date Tue, 28 Oct 2014 17:39:49 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 02a7533c9 -> bd624a88b


[CXF-6060] Avoid checking the providers if the out message is null


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

Branch: refs/heads/3.0.x-fixes
Commit: bd624a88b47708daeefc726f8de3ada4a33fdb52
Parents: 02a7533
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Oct 28 17:38:32 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Oct 28 17:39:25 2014 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java |  2 +-
 .../java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java  | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bd624a88/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
index 373ffae..c101a67 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
@@ -354,7 +354,7 @@ public final class ResponseImpl extends Response {
         }
         
         // we need to check for readers even if no IS is set - the readers may still do it
-        List<ReaderInterceptor> readers = ProviderFactory.getInstance(outMessage)
+        List<ReaderInterceptor> readers = outMessage == null ? null : ProviderFactory.getInstance(outMessage)
             .createMessageBodyReaderInterceptor(cls, t, anns, mediaType, outMessage, entityStreamAvailable,
null);
         
         if (readers != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/bd624a88/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 748f475..1c788da 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
@@ -68,6 +68,16 @@ import org.junit.Test;
 public class ResponseImplTest extends Assert {
     
     @Test
+    public void testReadEntityWithNullOutMessage() {
+        final String str = "ouch";
+
+        Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR)
+                  .entity(str)
+                  .build();
+        Assert.assertEquals(str, response.readEntity(String.class));
+    }
+    
+    @Test
     public void testReadBufferedStaxUtils() throws Exception {
         ResponseImpl r = new ResponseImpl(200);
         Source responseSource = readResponseSource(r);


Mime
View raw message