cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/2] git commit: [CXF-5504] Fix potential NPE in Logging interceptors
Date Tue, 08 Apr 2014 21:21:18 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 277bfdeab -> 18b5c10c5


[CXF-5504] Fix potential NPE in Logging interceptors


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c662d5d5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c662d5d5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c662d5d5

Branch: refs/heads/2.7.x-fixes
Commit: c662d5d55eb041fe520a772ce8ae4703ee717507
Parents: 277bfde
Author: Daniel Kulp <dkulp@apache.org>
Authored: Tue Apr 8 15:16:27 2014 -0600
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Tue Apr 8 15:20:46 2014 -0600

----------------------------------------------------------------------
 .../apache/cxf/interceptor/AbstractLoggingInterceptor.java    | 7 ++++++-
 .../test/java/org/apache/cxf/systest/versioning/Server.java   | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c662d5d5/api/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
b/api/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
index fde0abf..8ba74dd 100644
--- a/api/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
+++ b/api/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
@@ -37,6 +37,7 @@ import javax.xml.transform.stream.StreamSource;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
@@ -76,7 +77,11 @@ public abstract class AbstractLoggingInterceptor extends AbstractPhaseIntercepto
     protected abstract Logger getLogger();
     
     Logger getMessageLogger(Message message) {
-        EndpointInfo endpoint = message.getExchange().getEndpoint().getEndpointInfo();
+        Endpoint ep = message.getExchange().getEndpoint();
+        if (ep == null || ep.getEndpointInfo() == null) {
+            return getLogger();
+        }
+        EndpointInfo endpoint = ep.getEndpointInfo();
         if (endpoint.getService() == null) {
             return getLogger();
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c662d5d5/systests/uncategorized/src/test/java/org/apache/cxf/systest/versioning/Server.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/versioning/Server.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/versioning/Server.java
index 44717e2..acd7d73 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/versioning/Server.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/versioning/Server.java
@@ -21,6 +21,8 @@ package org.apache.cxf.systest.versioning;
 
 import javax.xml.ws.Endpoint;
 
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.transport.MultipleEndpointObserver;
@@ -31,6 +33,8 @@ public class Server extends AbstractBusTestServerBase {
     public static final String PORT = allocatePort(Server.class);
     
     protected void run() {
+        setBus(BusFactory.getDefaultBus());
+        getBus().getInInterceptors().add(new LoggingInInterceptor());
         String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
 
         Object implementor1 = new GreeterImplMixedStyle(" version1");


Mime
View raw message