cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject cxf git commit: CXF-6601: avoid NPE
Date Wed, 23 Sep 2015 15:53:15 GMT
Repository: cxf
Updated Branches:
  refs/heads/master cb2160fee -> 5c2d09810


CXF-6601: avoid NPE


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

Branch: refs/heads/master
Commit: 5c2d0981036a9c26e935b4748489d8898583d70c
Parents: cb2160f
Author: David J. M. Karlsen <david@davidkarlsen.com>
Authored: Tue Sep 22 09:12:04 2015 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Wed Sep 23 17:53:09 2015 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2d0981/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
index 432b08f..7a68622 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
@@ -25,6 +25,7 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.PreMatching;
@@ -174,7 +175,8 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
 
         @Override
         public void filter(ContainerRequestContext requestContext) throws IOException {
-            if (mc.getServletContext().getAttribute(ReaderConfig.class.getName()) == null)
{
+            ServletContext servletContext = mc.getServletContext();
+            if (servletContext != null && servletContext.getAttribute(ReaderConfig.class.getName())
== null) {
                 if (mc.getServletConfig() != null
                     && Boolean.valueOf(mc.getServletConfig().getInitParameter("scan.all.resources")))
{
                     addReaderConfig(mc.getServletConfig().getInitParameter("ignore.routes"));


Mime
View raw message