CacheResourceLoader leaking FileInputStream
wmccusker opened this issue · 0 comments
When using the raml parser to validate a definition I was running into an issue that the raml file and any files it referenced could not be deleted on Windows. I was able to find the stack trace below that created the FileInputStream that was never closed. From reviewing the code it looks like CacheResourceLoader reads from the input stream but never closes the stream causing the leak.
I will submit a pull request soon.
Stack Track
at java.io.FileInputStream.(FileInputStream.java:139)
at java.io.FileInputStream.(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at org.raml.v2.api.loader.RootRamlUrlResourceLoader.fetchResource(RootRamlUrlResourceLoader.java:48)
at org.raml.v2.api.loader.CompositeResourceLoader.fetchResource(CompositeResourceLoader.java:41)
at org.raml.v2.api.loader.CacheResourceLoader.fetchResource(CacheResourceLoader.java:69)
at org.raml.v2.internal.impl.commons.phase.IncludeResolver.transform(IncludeResolver.java:70)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:45)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.yagi.framework.phase.TransformationPhase.apply(TransformationPhase.java:54)
at org.raml.v2.internal.impl.v10.Raml10Builder.runPhases(Raml10Builder.java:145)
at org.raml.v2.internal.impl.v10.Raml10Builder.build(Raml10Builder.java:123)
at org.raml.v2.internal.impl.v10.Raml10Builder.build(Raml10Builder.java:89)
at org.raml.v2.internal.impl.RamlBuilder.build(RamlBuilder.java:126)
at org.raml.v2.internal.impl.RamlBuilder.build(RamlBuilder.java:108)
at org.raml.v2.api.RamlModelBuilder.buildApi(RamlModelBuilder.java:125)