Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: compiler/java/com/google/dart/compiler/common/SourceInfo.java

Issue 9716005: Close a stream when done (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/common/SourceInfo.java
===================================================================
--- compiler/java/com/google/dart/compiler/common/SourceInfo.java (revision 5526)
+++ compiler/java/com/google/dart/compiler/common/SourceInfo.java (working copy)
@@ -11,6 +11,7 @@
import com.google.dart.compiler.Source;
import java.io.BufferedReader;
+import java.io.IOException;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
@@ -66,8 +67,9 @@
* <code>null</code>.
*/
private static LinesInfo createLinesInfo(Source source) {
+ BufferedReader reader = null;
try {
- BufferedReader reader = new BufferedReader(source.getSourceReader());
+ reader = new BufferedReader(source.getSourceReader());
int offset = 0;
boolean ignoreLF = false;
List<Integer> lineOffsets = Lists.newArrayList(0);
@@ -86,6 +88,14 @@
return new LinesInfo(lineOffsets);
} catch (Throwable e) {
return new LinesInfo(ImmutableList.of(0));
+ } finally {
+ if (reader != null) {
scheglov 2012/03/16 21:33:22 com.google.common.io.Closeables.closeQuietly(Close
Brian Wilkerson 2012/03/16 21:45:07 Sure, but in a later CL.
+ try {
+ reader.close();
+ } catch (IOException e) {
+ // Ignored
+ }
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698