reta 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_r376656400
##########
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:
Thanks for the response, it is fine to raise `MalformedURLException` as you
did, the `URI.create` does not do anything beside parsing and throwing
`IllegalArgumentException`:
```
try {
return URI.create(swaggerUiRoot + resourcePath).toURL();
} catch (IllegalArgumentException ex) {
throw new MalformedURLException(ex.getMessage(), ex);
}
```
Thank you.
----------------------------------------------------------------
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