amarkevich commented on a change in pull request #637: Cxf 8208 - Handle 
exceptions when looking up swagger ui resources
URL: https://github.com/apache/cxf/pull/637#discussion_r376896483
 
 

 ##########
 File path: 
rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/ui/SwaggerUiResourceLocator.java
 ##########
 @@ -50,8 +50,14 @@ public URL locate(String resourcePath) throws 
MalformedURLException {
         if (resourcePath.startsWith("/")) {
             resourcePath = resourcePath.substring(1);
         }
+        URL ret;
 
-        return URI.create(swaggerUiRoot + resourcePath).toURL();
+        try {
+            ret = URI.create(swaggerUiRoot + resourcePath).toURL();
+        } catch (Exception ex) {
 
 Review comment:
   To avoid additional knowledge about internal RuntimeException rising a 
regular constructor with checked URISyntaxException can be used:
   ```
           try {
               return new URI(swaggerUiRoot + resourcePath).toURL();
           } catch (URISyntaxException ex) {
               throw new MalformedURLException(ex.getMessage());
           }
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to