diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-08-15 22:59:10 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-08-15 22:59:10 +0200 |
commit | 4c23804837e854c4f4ebb0008b10241467550d3f (patch) | |
tree | 9f2023ee0dae9ebaf2651fc0ce07ff6bbabfe54c /test | |
parent | 1f1fd17350bd61169e2aa01e5c3377801fb18a08 (diff) | |
download | lombok-4c23804837e854c4f4ebb0008b10241467550d3f.tar.gz lombok-4c23804837e854c4f4ebb0008b10241467550d3f.tar.bz2 lombok-4c23804837e854c4f4ebb0008b10241467550d3f.zip |
Update to force reading of test sources as UTF-8, which they are.
Diffstat (limited to 'test')
-rw-r--r-- | test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java b/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java index ad5a3cee..2caf9372 100644 --- a/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java +++ b/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java @@ -25,8 +25,9 @@ import static org.junit.Assert.*; import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; +import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStreamReader; import java.io.StringWriter; import java.util.Arrays; import java.util.Collections; @@ -196,7 +197,7 @@ public class TestClassFileMetaData { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); File tempDir = getTempDir(); tempDir.mkdirs(); - List<String> options = Arrays.asList("-nowarn", "-proc:none", "-d", tempDir.getAbsolutePath()); + List<String> options = Arrays.asList("-proc:none", "-d", tempDir.getAbsolutePath()); StringWriter captureWarnings = new StringWriter(); CompilationTask task = compiler.getTask(captureWarnings, null, null, options, null, Collections.singleton(new ContentBasedJavaFileObject(file.getPath(), readFileAsString(file)))); assertTrue(task.call()); @@ -239,16 +240,21 @@ public class TestClassFileMetaData { private static String readFileAsString(File file) { try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - StringWriter writer = new StringWriter(); - String line = reader.readLine(); - while(line != null) { - writer.append(line).append("\n"); - line = reader.readLine(); + FileInputStream in = new FileInputStream(file); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); + StringWriter writer = new StringWriter(); + String line = reader.readLine(); + while(line != null) { + writer.append(line).append("\n"); + line = reader.readLine(); + } + reader.close(); + writer.close(); + return writer.toString(); + } finally { + in.close(); } - reader.close(); - writer.close(); - return writer.toString(); } catch (Exception e) { throw Lombok.sneakyThrow(e); } |