On Tuesday 11 January 2011 11:50:00 am Glen Mazza wrote: > Does it make sense to have a CONTENT_TYPE key but no value for it -- any > legitimate use case? Otherwise it may be better (if possible) to throw > some runtime exception to alert the developer of the client or web > service provider that he or she is erroneously adding the CONTENT_TYPE > key but not giving it a value.
In the case of a the response for a oneway, there is no CONTENT_TYPE key and there isn't a contentType set any other way. Thus, it's completely null. We need to make sure we don't call setContentType if it is null. That's all this is doing. Dan > > Glen > > On 10.01.2011 17:02, [email protected] wrote: > > Author: dkulp > > Date: Mon Jan 10 22:02:25 2011 > > New Revision: 1057390 > > > > URL: http://svn.apache.org/viewvc?rev=1057390&view=rev > > Log: > > [CXF-3232] Add a NPE guard around setting the content type > > > > Modified: > > cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/ > > http/Headers.java > > > > Modified: > > cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http > > /Headers.java URL: > > http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/ > > org/apache/cxf/transport/http/Headers.java?rev=1057390&r1=1057389&r2=1057 > > 390&view=diff > > ======================================================================== > > ====== --- > > cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http > > /Headers.java (original) +++ > > cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http > > /Headers.java Mon Jan 10 22:02:25 2011 @@ -362,7 +362,7 @@ public class > > Headers { > > > > protected void copyToResponse(HttpServletResponse response) { > > > > String contentType = getContentTypeFromMessage(); > > > > - if (!headers.containsKey(Message.CONTENT_TYPE)) { > > + if (!headers.containsKey(Message.CONTENT_TYPE)&& contentType != > > null) { > > > > response.setContentType(contentType); > > > > } -- Daniel Kulp [email protected] http://dankulp.com/blog
