You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2019/09/17 20:32:17 UTC

[cxf] branch 3.2.x-fixes updated: [CXF-8118]CXF LoggingInInterceptor: CachedWriter leaks

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.2.x-fixes by this push:
     new 10ee74c  [CXF-8118]CXF LoggingInInterceptor: CachedWriter leaks
10ee74c is described below

commit 10ee74cd32cfcc23250f679b6ea33d6d1576ae67
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Tue Sep 17 16:30:37 2019 -0400

    [CXF-8118]CXF LoggingInInterceptor: CachedWriter leaks
    
    (cherry picked from commit 0f25f2fd12286f1410e917d1a6c750aea065b165)
---
 core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java  | 1 +
 .../src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
index f2c571e..907b288 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
@@ -183,6 +183,7 @@ public class LoggingInInterceptor extends AbstractLoggingInterceptor {
                 buffer.getMessage().append("(message truncated to " + limit + " bytes)\n");
             }
             writer.writeCacheTo(buffer.getPayload(), limit);
+            writer.close();
         } catch (Exception e) {
             throw new Fault(e);
         }
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
index 9ab3edf..0b4c14a 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
@@ -110,6 +110,7 @@ public class LoggingInInterceptor extends AbstractLoggingInterceptor {
         boolean isTruncated = writer.size() > limit && limit != -1;
         StringBuilder payload = new StringBuilder();
         writer.writeCacheTo(payload, limit);
+        writer.close();
         event.setPayload(payload.toString());
         event.setTruncated(isTruncated);
         event.setFullContentFile(writer.getTempFile());