cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: [CXF-5504] Fix potential NPE in Logging interceptors
Date Tue, 08 Apr 2014 21:17:38 GMT
Repository: cxf
Updated Branches:
  refs/heads/master cd4adda07 -> 2e6ce3106


[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/2e6ce310
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2e6ce310
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2e6ce310

Branch: refs/heads/master
Commit: 2e6ce310695f110e8a809297276fdbfaca04c395
Parents: cd4adda
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:16:27 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/2e6ce310/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
b/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
index 077e321..b43f0d5 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
@@ -36,6 +36,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.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -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/2e6ce310/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