Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
2.20.1
-
None
-
Patch Available
-
Unknown
Description
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:
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); }