Fortify Unclosed Stream Issue

Issue #132 resolved
Former user created an issue

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)

  1. Log in to comment