You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2026/10/21 05:35:58 UTC
(cxf) branch 4.1.x-fixes updated: CXF-8156 - Include the matched JAX-RS resource operation in fault log messages (#3608)
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch 4.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/4.1.x-fixes by this push:
new d9d8c94154d CXF-8156 - Include the matched JAX-RS resource operation in fault log messages (#3608)
d9d8c94154d is described below
commit d9d8c94154d0ed75c89bf02f91ad173105178c4f
Author: Colm O hEigeartaigh <co...@users.noreply.github.com>
AuthorDate: Wed Oct 21 06:26:24 2026 +0100
CXF-8156 - Include the matched JAX-RS resource operation in fault log messages (#3608)
(cherry picked from commit 63ebc1415a9aff06a2bce36073fcee225345d177)
---
.../apache/cxf/phase/PhaseInterceptorChain.java | 5 ++++
.../cxf/phase/PhaseInterceptorChainTest.java | 27 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/core/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java b/core/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
index 316e58d26f3..6629deb1e6e 100644
--- a/core/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
+++ b/core/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
@@ -389,6 +389,11 @@ public class PhaseInterceptorChain implements InterceptorChain {
OperationInfo opInfo = boi != null ? boi.getOperationInfo() : null;
if (opInfo != null) {
description.append('#').append(opInfo.getName());
+ } else {
+ Object resourceOperation = exchange.get(Message.RESOURCE_OPERATION_NAME);
+ if (resourceOperation != null) {
+ description.append('#').append(resourceOperation);
+ }
}
description.append("\' ");
}
diff --git a/core/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java b/core/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
index 8067b0fdf05..b021bb14c11 100644
--- a/core/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
+++ b/core/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
@@ -26,14 +26,19 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
+import javax.xml.namespace.QName;
+
import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.common.util.SortedArraySet;
import org.apache.cxf.continuations.SuspendedInvocationException;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.interceptor.InterceptorChain;
import org.apache.cxf.logging.FaultListener;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.FaultMode;
import org.apache.cxf.message.Message;
+import org.apache.cxf.service.Service;
import org.junit.Before;
import org.junit.Test;
@@ -341,6 +346,28 @@ public class PhaseInterceptorChainTest {
verifyPhaseInterceptorInvocations(p2, false, false);
}
+ @Test
+ public void testFaultDescriptionIncludesResourceOperation() throws Exception {
+ Service service = mock(Service.class);
+ when(service.getName()).thenReturn(new QName("http://test", "FirstResource"));
+ Exchange exchange = new ExchangeImpl();
+ exchange.put(Service.class, service);
+ exchange.put(Message.RESOURCE_OPERATION_NAME, "SecondResource#getItem");
+ when(message.getExchange()).thenReturn(exchange);
+
+ FaultListener listener = mock(FaultListener.class);
+ when(message.getContextualProperty(FaultListener.class.getName())).thenReturn(listener);
+
+ AbstractPhaseInterceptor<Message> p = setUpPhaseInterceptor("phase1", "p1");
+ setUpPhaseInterceptorInvocations(p, true, false);
+ chain.add(p);
+ chain.doIntercept(message);
+
+ verify(listener).faultOccurred(isA(Exception.class),
+ eq("'{http://test}FirstResource#SecondResource#getItem' "),
+ eq(message));
+ }
+
@Test
public void testWrappedInvocation() throws Exception {
CountingPhaseInterceptor p1 = new CountingPhaseInterceptor("phase1",