Author: rmannibucau
Date: Thu Jun  8 22:42:01 2017
New Revision: 1798136

URL: http://svn.apache.org/viewvc?rev=1798136&view=rev
Log:
avoid npe if cxf is not only used for jaxrs

Modified:
    
openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/CxfCdiAutoSetup.java

Modified: 
openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/CxfCdiAutoSetup.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/CxfCdiAutoSetup.java?rev=1798136&r1=1798135&r2=1798136&view=diff
==============================================================================
--- 
openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/CxfCdiAutoSetup.java
 (original)
+++ 
openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/CxfCdiAutoSetup.java
 Thu Jun  8 22:42:01 2017
@@ -60,6 +60,7 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.Enumeration;
 import java.util.List;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Stream;
@@ -323,6 +324,9 @@ public class CxfCdiAutoSetup implements
                         final Endpoint endpoint = 
ChainInitiationObserver.class.cast(sd.getMessageObserver()).getEndpoint();
                         final ApplicationInfo app = 
ApplicationInfo.class.cast(endpoint.get(Application.class.getName()));
                         final JAXRSServiceFactoryBean sfb = 
JAXRSServiceFactoryBean.class.cast(endpoint.get(JAXRSServiceFactoryBean.class.getName()));
+                        if (sfb == null) {
+                            return null;
+                        }
 
                         final List<Logs.LogResourceEndpointInfo> 
resourcesToLog = new ArrayList<>();
                         int classSize = 0;
@@ -395,7 +399,7 @@ public class CxfCdiAutoSetup implements
                         }
 
                         return base;
-                    }).toArray(String[]::new);
+                    }).filter(Objects::nonNull).toArray(String[]::new);
         }
 
         private void dump(final LogFacade log, final ServerProviderFactory 
spf, final String description, final String fieldName) {


Reply via email to