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 2010/05/06 21:11:14 UTC

svn commit: r941865 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/ rt/transports/http/src/test/java/org/apache/cxf/transport/http/gzip/

Author: dkulp
Date: Thu May  6 19:11:14 2010
New Revision: 941865

URL: http://svn.apache.org/viewvc?rev=941865&view=rev
Log:
Merged revisions 941863 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r941863 | dkulp | 2010-05-06 15:09:32 -0400 (Thu, 06 May 2010) | 2 lines
  
  Update a couple of the stream interceptors to not barf completely if a
  stream isn't there
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPOutInterceptor.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/gzip/GZIPAcceptEncodingTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:941863

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java?rev=941865&r1=941864&r2=941865&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentInInterceptor.java Thu May  6 19:11:14 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.interceptor;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Collections;
 import java.util.List;
 import java.util.logging.Logger;
@@ -52,6 +53,9 @@ public class AttachmentInInterceptor ext
             LOG.fine("AttachmentInInterceptor skipped in HTTP GET method");
             return;
         }
+        if (message.getContent(InputStream.class) == null) {
+            return;
+        }
         
         String contentType = (String) message.get(Message.CONTENT_TYPE);
         if (AttachmentUtil.isTypeSupported(contentType, getSupportedTypes())) {

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java?rev=941865&r1=941864&r2=941865&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java Thu May  6 19:11:14 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.interceptor;
 
 import java.io.IOException;
+import java.io.OutputStream;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -56,6 +57,9 @@ public class AttachmentOutInterceptor ex
         if (!mtomEnabled && !writeAtts) {
             return;
         }
+        if (message.getContent(OutputStream.class) == null) {
+            return;
+        }
 
         AttachmentSerializer serializer = 
             new AttachmentSerializer(message, getMultipartType(), getRootHeaders());

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java?rev=941865&r1=941864&r2=941865&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java Thu May  6 19:11:14 2010
@@ -62,7 +62,9 @@ public class StaxInInterceptor extends A
             return;
         }
         InputStream is = message.getContent(InputStream.class);
-        assert is != null;
+        if (is == null) {
+            return;
+        }
 
         String contentType = (String)message.get(Message.CONTENT_TYPE);
         

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java?rev=941865&r1=941864&r2=941865&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java Thu May  6 19:11:14 2010
@@ -73,6 +73,9 @@ public class GZIPInInterceptor extends A
                 try {
                     LOG.fine("Uncompressing response");
                     InputStream is = message.getContent(InputStream.class);
+                    if (is == null) {
+                        return;
+                    }
 
                     // wrap an unzipping stream around the original one
                     GZIPInputStream zipInput = new GZIPInputStream(is);

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPOutInterceptor.java?rev=941865&r1=941864&r2=941865&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPOutInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPOutInterceptor.java Thu May  6 19:11:14 2010
@@ -119,6 +119,9 @@ public class GZIPOutInterceptor extends 
             // remember the original output stream, we will write compressed
             // data to this later
             OutputStream os = message.getContent(OutputStream.class);
+            if (os == null) {
+                return;
+            }
             message.put(ORIGINAL_OUTPUT_STREAM_KEY, os);
             message.put(USE_GZIP_KEY, use);
 

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/gzip/GZIPAcceptEncodingTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/gzip/GZIPAcceptEncodingTest.java?rev=941865&r1=941864&r2=941865&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/gzip/GZIPAcceptEncodingTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/gzip/GZIPAcceptEncodingTest.java Thu May  6 19:11:14 2010
@@ -18,6 +18,10 @@
  */
 package org.apache.cxf.transport.http.gzip;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -59,8 +63,10 @@ public class GZIPAcceptEncodingTest exte
         Exchange exchange = new ExchangeImpl();
         exchange.setInMessage(inMessage);
         inMessage.setExchange(exchange);
+        inMessage.setContent(InputStream.class, new ByteArrayInputStream(new byte[0]));
         exchange.setOutMessage(outMessage);
         outMessage.setExchange(exchange);
+        outMessage.setContent(OutputStream.class, new ByteArrayOutputStream());
         outInterceptors = EasyMock.createMock(InterceptorChain.class);
         outMessage.setInterceptorChain(outInterceptors);
     }