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/21 23:02:58 UTC
(cxf) branch 4.0.x-fixes updated (88eead1bcd -> 0c16e708e9)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a change to branch 4.0.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
from 88eead1bcd Fix PMD violations (#2516)
new 90c739f075 Bump org.jruby:jruby from 10.0.0.1 to 10.0.1.0 (#2519)
new f0f14c3480 Bump com.fasterxml.jackson.core:jackson-databind from 2.19.1 to 2.19.2 (#2522)
new bb667a2fdc CXF-9145: Inconcise handling of logging features logMulitpart and logBinary (#2520)
new 0c16e708e9 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 | 4 +
.../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, 186 insertions(+), 9 deletions(-)
(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 4.0.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 0c16e708e9b854c085a6a1b560d297cad0296f9c
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Mon Jul 21 18:54:41 2025 -0400
Recording .gitmergeinfo Changes
---
.gitmergeinfo | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 4549d17b76..b7d493dc24 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -40,6 +40,7 @@ M 0eb3eace90256f3139ea1380990846fcd8e71bd9
M 10048c1322c2a561b216115543d9708bf2bc69c1
M 102b142f9b551b671adf83a00dbb5b41cf6d42bd
M 10df8d333443ae5931bcb151fb425cd48efeb62f
+M 1105aa54ae1106237f183c9652becfc9ae5417d5
M 11917a26c9570a54f4ca6c508a33a5ca9c6a713b
M 124c6b8324e4793858aea7c7cd9bd8a5afa9cd2f
M 1261d18047c10883496525685175afd327fad78d
@@ -208,6 +209,7 @@ M 54bdaca5fc884d107c4e56f7a762a1ec8b165695
M 54c3ce63ef139f99c12f2290b2107c2f428fba51
M 5612e135d1ec7f1a6b36b75f598d6212c3f9ba37
M 5744ce42c98422a96ca4f2c92213e9ff56f97804
+M 580d32fa8a974ceebfa5dac4b9883a7f39a28590
M 5820a625f1485793b148e1479a37989ebd4bc15b
M 5890526011f501e1b6f0ac1b8ef04cc90a6190cf
M 58ad38cd0ce8dabca103072c529d31093ef9f2a3
@@ -271,6 +273,7 @@ M 6fd4129c9271b2da48ec5e91634ca1f60a01a39f
M 70e43523223968acd4cc4a5c7cad01db348070eb
M 70ef3c2996e5e54c1ddbd64d56e9652511b378a8
M 71655d914132ba079a34a21523d5b2732584c6da
+M 71a7ab19df0759c557d492093ca0962d2afd618e
M 7226804d39d494a3229319fcc85a95173f8fec00
M 72ded2d9ae177964dbcf21a78f4e40b6f6665bfe
M 7354d9dc679be18723c2906bec45d7555d8dd157
@@ -346,6 +349,7 @@ M 94a851c1942e0348fd28a6f1923bdcc5992cd975
M 94d649af6f76058334250334dd2b85fa555824fb
M 94da28f77b803108de3eca058c25f9de03632abf
M 950636cf6284b83f3736ecc2ca8ac24fd20583d5
+M 95ac3a98c841099e07595a20ee8cd00f06d09caa
M 961cae16ac2c15514f0047c7890bffb06f51dd95
M 964c4cf65fff7901d0d51f8637e1e64cfabfd971
M 96717fda5668ba3b3730fb8fbd09ab1bf6781bf6
(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 4.0.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit bb667a2fdc733c26858c634b22c963f03b448c58
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)
---
.../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) 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 4.0.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit f0f14c3480bf3898e8c02b9185c20cf88d37c0b4
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
---
parent/pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/parent/pom.xml b/parent/pom.xml
index b620815844..385f4108ec 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -131,8 +131,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>2.1.3</cxf.jakarta.activation.version>
(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 4.0.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 90c739f07544387a739603b266014bbcbdd6d3a6
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)
---
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 f1b24a61cd..7c5c7eb6d2 100644
--- a/distribution/src/main/release/samples/ruby_spring_support/pom.xml
+++ b/distribution/src/main/release/samples/ruby_spring_support/pom.xml
@@ -124,7 +124,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>