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

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

    [ https://issues.apache.org/jira/browse/CAMEL-12038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16266200#comment-16266200 ] 

Claus Ibsen commented on CAMEL-12038:
-------------------------------------

Can you provide information how you run this and get this error. The configuration should ideally be there, and the not null check is the least good fix.

> 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.1
>            Reporter: Jeff Domeyer
>             Fix For: 2.20.2, 2.21.0
>
>
> 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)