Fixes leaking file reader.
See: https://groups.google.com/forum/#!topic/closure-compiler-discuss/S1Q5Icai9vU
@@ -613,7 +613,9 @@ public class SourceFile implements StaticSourceFile, Serializable {
if (cachedCode == null) {
try {
- cachedCode = CharStreams.toString(getCodeReader());
+ try (Reader r = getCodeReader()) {
+ cachedCode = CharStreams.toString(r);
+ }
} catch (java.nio.charset.MalformedInputException e) {
throw new IOException("Failed to read: " + path + ", is this input UTF-8 encoded?", e);
}
