Chromium Code Reviews| 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 |
| + } |
| + } |
| } |
| } |