summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-02-13 13:24:53 +0000
committerNarayan Kamath <narayan@google.com>2014-02-13 13:24:53 +0000
commit7fbd82c654d1ad2348769b9340a1181abfa98fe9 (patch)
tree94d87d7ee2732d4d3c4b6323860ee3d965d98aa7 /luni
parent2e413ba8dfbd9d6c7720afc36699b26eda7aebac (diff)
downloadlibcore-7fbd82c654d1ad2348769b9340a1181abfa98fe9.zip
libcore-7fbd82c654d1ad2348769b9340a1181abfa98fe9.tar.gz
libcore-7fbd82c654d1ad2348769b9340a1181abfa98fe9.tar.bz2
Tidy up Console, fix ConsoleTest
- Use a more specific exception type. The use of IOException led me to believe that the constructor was performing i/o ops on the underlying file descriptors. (They were not.) - Delete a test that asserted that System.console() was always non-null. It will be non-null only for command line apps (tests run from vogar), and not for "regular" android apps (tests run from CTS) because stdin / stdout will not be TTY devices regular apps. bug: 12490236 Change-Id: I8c1e37bcb21de5862dc8ea198852995a020437a7
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/java/io/Console.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/luni/src/main/java/java/io/Console.java b/luni/src/main/java/java/io/Console.java
index a1d2097..b6532eb 100644
--- a/luni/src/main/java/java/io/Console.java
+++ b/luni/src/main/java/java/io/Console.java
@@ -16,9 +16,7 @@
package java.io;
import java.util.Formatter;
-import libcore.io.ErrnoException;
import libcore.io.Libcore;
-import static libcore.io.OsConstants.*;
/**
* Provides access to the console, if available. The system-wide instance can
@@ -48,12 +46,12 @@ public final class Console implements Flushable {
}
try {
return new Console(System.in, System.out);
- } catch (IOException ex) {
+ } catch (UnsupportedEncodingException ex) {
throw new AssertionError(ex);
}
}
- private Console(InputStream in, OutputStream out) throws IOException {
+ private Console(InputStream in, OutputStream out) throws UnsupportedEncodingException {
this.reader = new ConsoleReader(in);
this.writer = new ConsoleWriter(out);
}
@@ -181,7 +179,7 @@ public final class Console implements Flushable {
}
private static class ConsoleReader extends BufferedReader {
- public ConsoleReader(InputStream in) throws IOException {
+ public ConsoleReader(InputStream in) throws UnsupportedEncodingException {
super(new InputStreamReader(in, System.getProperty("file.encoding")), 256);
lock = CONSOLE_LOCK;
}