You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2025/07/22 00:39:54 UTC

(cxf) branch 3.6.x-fixes updated (f05b7b183e -> 7ba3a4c606)

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

reta pushed a change to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


    from f05b7b183e Recording .gitmergeinfo Changes
     new 5ca66f188d Bump org.jruby:jruby from 10.0.0.1 to 10.0.1.0 (#2519)
     new 3ff8e31973 Bump com.fasterxml.jackson.core:jackson-databind from 2.19.1 to 2.19.2 (#2522)
     new 3cb6cfa303 CXF-9145: Inconcise handling of logging features logMulitpart and logBinary (#2520)
     new 7ba3a4c606 Recording .gitmergeinfo Changes

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitmergeinfo                                      |   3 +
 .../release/samples/ruby_spring_support/pom.xml    |   2 +-
 parent/pom.xml                                     |   4 +-
 .../ext/logging/AbstractLoggingInterceptor.java    |  50 ++++++++-
 .../ext/logging/event/DefaultLogEventMapper.java   |  15 ++-
 .../cxf/ext/logging/LoggingInInterceptorTest.java  | 120 +++++++++++++++++++++
 6 files changed, 185 insertions(+), 9 deletions(-)


(cxf) 02/04: Bump com.fasterxml.jackson.core:jackson-databind from 2.19.1 to 2.19.2 (#2522)

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3ff8e31973e84ab2f2b241d6d18650a6af00b40d
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Mon Jul 21 10:30:07 2025 -0400

    Bump com.fasterxml.jackson.core:jackson-databind from 2.19.1 to 2.19.2 (#2522)
    
    * Bump com.fasterxml.jackson.core:jackson-databind from 2.19.1 to 2.19.2
    
    ---
    updated-dependencies:
    - dependency-name: com.fasterxml.jackson.core:jackson-databind
      dependency-version: 2.19.2
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    
    * Update parent/pom.xml
    
    ---------
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
    Co-authored-by: Andriy Redko <dr...@gmail.com>
    (cherry picked from commit 580d32fa8a974ceebfa5dac4b9883a7f39a28590)
    
    # Conflicts:
    #       parent/pom.xml
    (cherry picked from commit f0f14c3480bf3898e8c02b9185c20cf88d37c0b4)
---
 parent/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 35aa708317..617fa69580 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -128,8 +128,8 @@
         <cxf.httpcomponents.core.version>4.4.16</cxf.httpcomponents.core.version>
         <cxf.httpcomponents.client5.version>5.3.1</cxf.httpcomponents.client5.version>
         <cxf.httpcomponents.core5.version>5.2.5</cxf.httpcomponents.core5.version>
-        <cxf.jackson.version>2.19.1</cxf.jackson.version>
-        <cxf.jackson.databind.version>2.19.1</cxf.jackson.databind.version>
+        <cxf.jackson.version>2.19.2</cxf.jackson.version>
+        <cxf.jackson.databind.version>2.19.2</cxf.jackson.databind.version>
         <cxf.jacorb.version>3.9</cxf.jacorb.version>
         <cxf.jaeger.version>1.8.1</cxf.jaeger.version>
         <cxf.jakarta.activation.version>1.2.2</cxf.jakarta.activation.version>


(cxf) 03/04: CXF-9145: Inconcise handling of logging features logMulitpart and logBinary (#2520)

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3cb6cfa303abf54609005da37e02c5c8a97144e8
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Mon Jul 21 18:49:25 2025 -0400

    CXF-9145: Inconcise handling of logging features logMulitpart and logBinary (#2520)
    
    (cherry picked from commit afa25c791082e937c9fc5c17d7c7c75ceb39da5a)
    (cherry picked from commit bb667a2fdc733c26858c634b22c963f03b448c58)
---
 .../ext/logging/AbstractLoggingInterceptor.java    |  50 ++++++++-
 .../ext/logging/event/DefaultLogEventMapper.java   |  15 ++-
 .../cxf/ext/logging/LoggingInInterceptorTest.java  | 120 +++++++++++++++++++++
 3 files changed, 179 insertions(+), 6 deletions(-)

diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
index 971335854c..67e27633d3 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
@@ -153,16 +153,21 @@ public abstract class AbstractLoggingInterceptor extends AbstractPhaseIntercepto
                 String[] parts = originalLogString.split(Pattern.quote(boundary));
                 String payload = "";
                 for (String str : parts) {
-                    if (findContentType(str) != null
+                    final String contentType = findContentType(str);
+                    if (contentType != null
                         && eventMapper.isBinaryContent(
-                           findContentType(str).substring("Content-Type:".length()).trim())) {
-                        payload = payload + "\r\n" + CONTENT_SUPPRESSED + "\r\n";
+                                contentType.substring("Content-Type:".length()).trim())) {
+                        final String headers = extractHeaders(str);
+                        if (headers == null || headers.isEmpty()) {
+                            payload = payload + "\r\n" + CONTENT_SUPPRESSED + "\r\n";
+                        } else {
+                            payload = payload + "\r\n" + headers + "\r\n" + CONTENT_SUPPRESSED + "\r\n";
+                        }
                     } else {
                         payload = payload + str;
                         payload = payload + boundary;
                     }
                 }
-            
                 originalLogString = payload;
             }
         } catch (Exception ex) {
@@ -172,6 +177,43 @@ public abstract class AbstractLoggingInterceptor extends AbstractPhaseIntercepto
         
     }
     
+    private static String extractHeaders(String str) {
+        // We know that content header is present, let's start from that
+        final Matcher m = CONTENT_TYPE_PATTERN.matcher(str);
+        if  (m.find()) {
+            int payloadStart = 0;
+
+            // Look for empty line to find out where the actual payload starts (it should
+            // follow headers)
+            int buffer = 0;
+            for (int i = m.start(0); i < str.length(); ++i) {
+                final char c = str.charAt(i);
+                // a linefeed is a terminator, always.
+                if (c == '\n') {
+                    if (buffer == 0) {
+                        payloadStart = i;
+                        break;
+                    } else {
+                        buffer = 0;
+                    }
+                } else if (c == '\r') {
+                    //just ignore the CR.  The next character SHOULD be an NL.  If not, we're
+                    //just going to discard this
+                    continue;
+                } else {
+                    // just count is as a buffer
+                    ++buffer;
+                }
+            }
+
+            if (payloadStart > 0 && payloadStart < str.length()) {
+                return str.substring(0, payloadStart).trim();
+            }
+        }
+
+        return null;
+    }
+
     private String findContentType(String payload) {
         // Use regex to get the Content-Type and return null if it's not found
         Matcher m = CONTENT_TYPE_PATTERN.matcher(payload);
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
index 4e8ee740d3..ee3a386bec 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
@@ -234,11 +234,22 @@ public class DefaultLogEventMapper {
 
     private boolean isBinaryContent(Message message) {
         String contentType = safeGet(message, Message.CONTENT_TYPE);
-        return contentType != null && binaryContentMediaTypes.contains(contentType);
+        return isBinaryContent(contentType);
     }
 
     public boolean isBinaryContent(String contentType) {
-        return contentType != null && binaryContentMediaTypes.contains(contentType);
+        if (contentType == null) {
+            return false;
+        } else {
+            // Consider compound header values, like: 
+            //    Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
+            final int index = contentType.indexOf(';');
+            if (index > 0) {
+                return binaryContentMediaTypes.contains(contentType.substring(0, index).trim());
+            } else {
+                return binaryContentMediaTypes.contains(contentType);
+            }
+        }
     }
     
     private boolean isMultipartContent(Message message) {
diff --git a/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/LoggingInInterceptorTest.java b/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/LoggingInInterceptorTest.java
index fda5b7bf04..d7b7578150 100644
--- a/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/LoggingInInterceptorTest.java
+++ b/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/LoggingInInterceptorTest.java
@@ -19,6 +19,9 @@
 
 package org.apache.cxf.ext.logging;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -27,6 +30,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.cxf.ext.logging.event.LogEvent;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -36,6 +40,7 @@ import org.junit.Test;
 
 import static org.apache.cxf.ext.logging.event.DefaultLogEventMapper.MASKED_HEADER_VALUE;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalToIgnoringCase;
 import static org.hamcrest.Matchers.hasSize;
 import static org.junit.Assert.assertEquals;
 
@@ -114,4 +119,119 @@ public class LoggingInInterceptorTest {
 
         assertEquals(TEST_HEADER_VALUE, event.getHeaders().get(TEST_HEADER_NAME));
     }
+
+    @Test
+    public void shouldLogMultipartPayload() throws IOException {
+        message.put(Message.ENDPOINT_ADDRESS, "http://localhost:9001/");
+        message.put(Message.REQUEST_URI, "/api");
+
+        StringBuilder buf = new StringBuilder(512);
+        buf.append("------=_Part_0_2180223.1203118300920\n");
+        buf.append("Content-Type: application/xop+xml; charset=UTF-8; type=\"text/xml\"\n");
+        buf.append("Content-Transfer-Encoding: 8bit\n");
+        buf.append("Content-ID: <so...@xfire.codehaus.org>\n");
+        buf.append('\n');
+        buf.append("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+                   + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
+                   + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+                   + "<soap:Body><getNextMessage xmlns=\"http://foo.bar\" /></soap:Body>"
+                   + "</soap:Envelope>\n");
+        buf.append("------=_Part_0_2180223.1203118300920--\n");
+
+        String ct = "multipart/related; type=\"application/xop+xml\"; "
+                + "boundary=\"----=_Part_0_2180223.1203118300920\"";
+
+        final byte[] bytes = buf.toString().getBytes(StandardCharsets.UTF_8);
+        final OutputStream os = new CachedOutputStream();
+        os.write(bytes, 0, bytes.length);
+        message.setContent(CachedOutputStream.class, os);
+        message.put(Message.CONTENT_TYPE, ct);
+
+        interceptor.addBinaryContentMediaTypes("application/xop+xml");
+        interceptor.setLogMultipart(true);
+        interceptor.setLogBinary(true);
+        interceptor.handleMessage(message);
+        
+        assertThat(sender.getEvents(), hasSize(1));
+        final LogEvent event = sender.getEvents().get(0);
+
+        assertThat(event.getPayload(), equalToIgnoringCase(buf.toString()));
+    }
+
+    @Test
+    public void shouldLogMultipartHeadersOnly() throws IOException {
+        message.put(Message.ENDPOINT_ADDRESS, "http://localhost:9001/");
+        message.put(Message.REQUEST_URI, "/api");
+
+        final StringBuilder headers = new StringBuilder(512);
+        headers.append("------=_Part_0_2180223.1203118300920\n");
+        headers.append("Content-Type: application/xop+xml; charset=UTF-8; type=\"text/xml\"\n");
+        headers.append("Content-Transfer-Encoding: 8bit\n");
+        headers.append("Content-ID: <so...@xfire.codehaus.org>\n");
+
+        final StringBuilder buf = new StringBuilder(512);
+        buf.append(headers);
+        buf.append('\n');
+        buf.append("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+                   + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
+                   + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+                   + "<soap:Body><getNextMessage xmlns=\"http://foo.bar\" /></soap:Body>"
+                   + "</soap:Envelope>\n");
+        buf.append("------=_Part_0_2180223.1203118300920--\n");
+
+        String ct = "multipart/related; type=\"application/xop+xml\"; "
+                + "boundary=\"----=_Part_0_2180223.1203118300920\"";
+
+        final byte[] bytes = buf.toString().getBytes(StandardCharsets.UTF_8);
+        final OutputStream os = new CachedOutputStream();
+        os.write(bytes, 0, bytes.length);
+        message.setContent(CachedOutputStream.class, os);
+        message.put(Message.CONTENT_TYPE, ct);
+
+        interceptor.addBinaryContentMediaTypes("application/xop+xml");
+        interceptor.setLogMultipart(true);
+        interceptor.setLogBinary(false);
+        interceptor.handleMessage(message);
+        
+        assertThat(sender.getEvents(), hasSize(1));
+        final LogEvent event = sender.getEvents().get(0);
+
+        assertThat(event.getPayload().replaceAll("\r\n", "\n"), equalToIgnoringCase(headers.toString()
+            + "--- Content suppressed ---\n--\n------=_Part_0_2180223.1203118300920"));
+    }
+
+    @Test
+    public void shouldLogMultipartPayloadNoHeaders() throws IOException {
+        message.put(Message.ENDPOINT_ADDRESS, "http://localhost:9001/");
+        message.put(Message.REQUEST_URI, "/api");
+
+        StringBuilder buf = new StringBuilder(512);
+        buf.append("------=_Part_0_2180223.1203118300920\n");
+        buf.append('\n');
+        buf.append("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+                   + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
+                   + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+                   + "<soap:Body><getNextMessage xmlns=\"http://foo.bar\" /></soap:Body>"
+                   + "</soap:Envelope>\n");
+        buf.append("------=_Part_0_2180223.1203118300920--\n");
+
+        String ct = "multipart/related; type=\"application/xop+xml\"; "
+                + "boundary=\"----=_Part_0_2180223.1203118300920\"";
+
+        final byte[] bytes = buf.toString().getBytes(StandardCharsets.UTF_8);
+        final OutputStream os = new CachedOutputStream();
+        os.write(bytes, 0, bytes.length);
+        message.setContent(CachedOutputStream.class, os);
+        message.put(Message.CONTENT_TYPE, ct);
+
+        interceptor.addBinaryContentMediaTypes("application/xop+xml");
+        interceptor.setLogMultipart(true);
+        interceptor.setLogBinary(true);
+        interceptor.handleMessage(message);
+        
+        assertThat(sender.getEvents(), hasSize(1));
+        final LogEvent event = sender.getEvents().get(0);
+
+        assertThat(event.getPayload(), equalToIgnoringCase(buf.toString()));
+    }
 }


(cxf) 04/04: Recording .gitmergeinfo Changes

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7ba3a4c606504af535f32e71890ee94baad7d086
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Mon Jul 21 20:35:34 2025 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index e5fad7b6aa..7d184de54e 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -19,6 +19,7 @@ B 0acadd4d9846811ff4dae3771fc1af7037a28b26
 B 0b20a379799028089c9de1f3d1a92cdb82fedffd
 B 0b95b17bab3257c2295adedca6ad3a86a98578fb
 B 0ba155897309bfe6047c7b5263ab5692ef0a2d62
+B 0c16e708e9b854c085a6a1b560d297cad0296f9c
 B 0c265936f7c8da9cb68cb3353e4dd7a001f4006a
 B 0c91009cc4bb2ce54812cc23304269f2a6e19f2c
 B 0cbff3172141d315968382979b473ca77dc1422f
@@ -1026,6 +1027,7 @@ M 87aa62518ee8fcbd393293bedadeb54a3e1a000e
 M 880d5ba4876cfaad954cb4d18581c350a3b7e9ee
 M 88d17d47218d9cfd427efbb835807541821bb916
 M 88e8ec843c77ce0d556b850a8751308b9b746419
+M 88eead1bcd3940a9d3603d945ecc90aefc4b7bca
 M 88fcb1cd8420365f1b59b600c5762fa410636b92
 M 890195ced00f76d0be680def9c6f08d85d63cbcd
 M 895dcae484dd74fb769b058e8989e87c910aa67f
@@ -1553,6 +1555,7 @@ M f00ca03f0852b8be195adbcee20c164a189e8b6e
 M f03c3b0f9dccf7ebec8e1016247091cb363344ea
 M f05bdcfeafebdbe93c6d189514e084ae1d40cac0
 M f0cd0884594281e630c83de19d9ec7d6a45046bb
+M f0f14c3480bf3898e8c02b9185c20cf88d37c0b4
 M f125c9675817f159fbfc565c0cc0406dcfd2216d
 M f1ae3569ecd72800d9114278a0d4aa4a2d2370b7
 M f1b299cf408b827ab962fa94004c38682d3777f4


(cxf) 01/04: Bump org.jruby:jruby from 10.0.0.1 to 10.0.1.0 (#2519)

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5ca66f188db5e3dbc8ab627c2eb86f36a25e4a5e
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Fri Jul 18 07:16:42 2025 -0400

    Bump org.jruby:jruby from 10.0.0.1 to 10.0.1.0 (#2519)
    
    Bumps org.jruby:jruby from 10.0.0.1 to 10.0.1.0.
    
    ---
    updated-dependencies:
    - dependency-name: org.jruby:jruby
      dependency-version: 10.0.1.0
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
    (cherry picked from commit 1105aa54ae1106237f183c9652becfc9ae5417d5)
    (cherry picked from commit 90c739f07544387a739603b266014bbcbdd6d3a6)
---
 distribution/src/main/release/samples/ruby_spring_support/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distribution/src/main/release/samples/ruby_spring_support/pom.xml b/distribution/src/main/release/samples/ruby_spring_support/pom.xml
index d7ac64cb06..6967e72723 100644
--- a/distribution/src/main/release/samples/ruby_spring_support/pom.xml
+++ b/distribution/src/main/release/samples/ruby_spring_support/pom.xml
@@ -110,7 +110,7 @@
         <dependency>
             <groupId>org.jruby</groupId>
             <artifactId>jruby</artifactId>
-            <version>10.0.0.1</version>
+            <version>10.0.1.0</version>
         </dependency>
         <dependency>
             <groupId>cglib</groupId>