Copilot commented on code in PR #3372:
URL: https://github.com/apache/cxf/pull/3372#discussion_r3839145111


##########
rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java:
##########
@@ -234,4 +240,8 @@ private String findBoundary(String payload) {
         Matcher m = BOUNDARY_PATTERN.matcher(payload);
         return m.find() ? "--" + m.group(1) : null;
     }
+
+    static String getRequestorSuffix(Message message) {
+        return MessageUtils.isRequestor(message) ? "in" : "out";
+    }

Review Comment:
   `getRequestorSuffix` is derived from `MessageUtils.isRequestor`, but the key 
suffix values are `in`/`out`. This does not distinguish server-side REQ_IN vs 
RESP_OUT (both have `isRequestor == false` per DefaultLogEventMapper’s 
event-type logic), so if message properties are copied from the inbound request 
to the outbound response the response can still be treated as already-logged. 
Consider suffixing by inbound/outbound direction (e.g., 
`MessageUtils.isOutbound`) instead of requestor role (or combining both) so 
REQ_IN and RESP_OUT cannot collide on the same LIVE_LOGGING_PROP key.



##########
rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java:
##########
@@ -305,6 +312,42 @@ public void handleMessage(Message message) throws Fault {
 
     }
 
+    @Test
+    public void testEndpointWithLogging() throws Exception {
+        GreeterImpl service = new GreeterImpl();
+        String namespace = "http://apache.org/hello_world_soap_http";;
+        try (EndpointImpl ep = new EndpointImpl(getBus(), service, (String) 
null)) {
+            ep.publish("local://localhost:9092/hello");
+
+            EndpointInfo ei = 
ep.getService().getServiceInfos().get(0).getEndpoint(new QName(namespace, 
"SoapPort"));
+            JaxWsEndpointImpl endpoint = new JaxWsEndpointImpl(getBus(), 
ep.getService(), ei);
+
+            final List<LogEvent> events = new ArrayList<>();

Review Comment:
   `events` is a plain `ArrayList`, but LocalTransport can dispatch to the 
service on an executor/background thread (see LocalConduit dispatch logic), so 
`LogEventSender.send` may be invoked concurrently with assertions. Use a 
thread-safe list (e.g., `CopyOnWriteArrayList` or 
`Collections.synchronizedList`) and/or wait until the expected event count is 
reached to avoid racy test failures.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to