Fortify Unclosed Stream Issue
Issue #132
resolved
I have ran Fortify Static Code Analysis code analyzer on my project, and it is giving error that an un-closed stream is present in class SwaggerRequestValidationService. Following are the lines that gets highlighted.
SwaggerRequestValidationService(final EncodedResource restInterface) throws IOException {
this(SwaggerRequestResponseValidator.createFor(readReader(restInterface.getReader())).build());
}
My suggestion is to add following line at the end of above function.
restInterface.getReader().close();
I have ran it and its working fine, can you please confirm this change will not disturb the Swagger validation functionality.
Cheers
Comments (3)
-
-
Thanks a lot
-
- changed status to resolved
Available in v1.4.6
- Log in to comment
You are right.
I've created a pull request fixing this issue: https://bitbucket.org/atlassian/swagger-request-validator/pull-requests/85
Edit: This change will not disturb the Swagger validation for Spring MVC requests in any kind.