cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1156183 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
Date Wed, 10 Aug 2011 13:50:08 GMT
Author: sergeyb
Date: Wed Aug 10 13:50:08 2011
New Revision: 1156183

URL: http://svn.apache.org/viewvc?rev=1156183&view=rev
Log:
[CXF-3719] Checking for null OutputStream

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java?rev=1156183&r1=1156182&r2=1156183&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
Wed Aug 10 13:50:08 2011
@@ -294,6 +294,15 @@ public class JSONProvider extends Abstra
     public void writeTo(Object obj, Class<?> cls, Type genericType, Annotation[] anns,
 
         MediaType m, MultivaluedMap<String, Object> headers, OutputStream os)
         throws IOException {
+        if (os == null) {
+            StringBuilder sb = new StringBuilder();
+            sb.append("Jettison needs initialized OutputStream");
+            if (getContext() != null && getContext().getContent(XMLStreamWriter.class)
== null) {
+                sb.append("; if you need to customize Jettison output with the custom XMLStreamWriter"
+                          + " then extend JSONProvider or when possible configure it directly.");
+            }
+            throw new IOException(sb.toString());
+        }
         try {
             
             String encoding = HttpUtils.getSetEncoding(m, headers, "UTF-8");



Mime
View raw message