You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jeff Domeyer (JIRA)" <ji...@apache.org> on 2017/11/26 20:49:00 UTC

[jira] [Created] (CAMEL-12038) rest-dsl - Allow to turn off vendor extension... NPE

Jeff Domeyer created CAMEL-12038:
------------------------------------

             Summary: rest-dsl - Allow to turn off vendor extension... NPE
                 Key: CAMEL-12038
                 URL: https://issues.apache.org/jira/browse/CAMEL-12038
             Project: Camel
          Issue Type: Bug
          Components: camel-core, camel-swagger
    Affects Versions: 2.20.0
            Reporter: Jeff Domeyer


CAMEL-11957 introduced a NPE as org.apache.camel.swagger.servlet.RestSwaggerServlet calls (RestSwaggerSupport).renderResourceListing (line 192) passing null is the value for configuration.

RestSwaggerSupport.renderResourceListing utilizes the configuration argument without checking for null. (Or you could pass in a non-null configuration from RestSwaggerServlet.

Patch:
{code}
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java
index 7bd53aa..5a5184d 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java
@@ -212,7 +212,8 @@
                 // read the rest-dsl into swagger model
                 Swagger swagger = reader.read(rests, route, swaggerConfig, contextId, classResolver);
 
-                if (!configuration.isApiVendorExtension()) {
+                //Fix for CAMEL-11957
+                if (configuration != null && !configuration.isApiVendorExtension()) {
                     clearVendorExtensions(swagger);
                 }
 
@@ -231,7 +232,8 @@
                 // read the rest-dsl into swagger model
                 Swagger swagger = reader.read(rests, route, swaggerConfig, contextId, classResolver);
 
-                if (!configuration.isApiVendorExtension()) {
+                //Fix for CAMEL-11957
+                if (configuration != null && !configuration.isApiVendorExtension()) {
                     clearVendorExtensions(swagger);
                 }
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)