Author: ningjiang
Date: Wed Jun 15 02:35:09 2011
New Revision: 1135899
URL: http://svn.apache.org/viewvc?rev=1135899&view=rev
Log:
CXF-3590 fixed the Exception of Logging*Interceptor when the CachedOutputStream
size is 0
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java?rev=1135899&r1=1135898&r2=1135899&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
Wed Jun 15 02:35:09 2011
@@ -102,8 +102,8 @@ public abstract class AbstractLoggingInt
protected void writePayload(StringBuilder builder, CachedOutputStream cos,
String encoding, String contentType)
throws Exception {
- // Just transform the XML message
- if (isPrettyLogging() && (contentType != null &&
contentType.indexOf("xml") >= 0)) {
+ // Just transform the XML message when the cos has content
+ if (isPrettyLogging() && (contentType != null &&
contentType.indexOf("xml") >= 0) && cos.size() > 0) {
Transformer serializer = XMLUtils.newTransformer(2);
// Setup indenting to "pretty print"
serializer.setOutputProperty(OutputKeys.INDENT, "yes");