提交 5f1f5d2c 编写于 作者: A alanb

7021327: Changes for 7020888 included changes to other files in error

Reviewed-by: chegar
上级 57de7398
......@@ -512,14 +512,11 @@ public class BufferedReader extends Reader {
public void close() throws IOException {
synchronized (lock) {
if (in != null) {
try {
in.close();
} finally {
in = null;
cb = null;
}
}
if (in == null)
return;
in.close();
in = null;
cb = null;
}
}
}
......@@ -255,16 +255,17 @@ public class BufferedWriter extends Writer {
}
}
@SuppressWarnings("try")
public void close() throws IOException {
synchronized (lock) {
if (out != null) {
try (Writer w = out) {
flushBuffer();
} finally {
out = null;
cb = null;
}
if (out == null) {
return;
}
try {
flushBuffer();
} finally {
out.close();
out = null;
cb = null;
}
}
}
......
......@@ -152,10 +152,11 @@ class FilterOutputStream extends OutputStream {
* @see java.io.FilterOutputStream#flush()
* @see java.io.FilterOutputStream#out
*/
@SuppressWarnings("try")
public void close() throws IOException {
try (OutputStream ostream = out) {
flush();
try {
flush();
} catch (IOException ignored) {
}
out.close();
}
}
......@@ -374,13 +374,10 @@ class PushbackInputStream extends FilterInputStream {
* @exception IOException if an I/O error occurs.
*/
public synchronized void close() throws IOException {
if (in != null) {
try {
in.close();
} finally {
in = null;
buf = null;
}
}
if (in == null)
return;
in.close();
in = null;
buf = null;
}
}
......@@ -245,11 +245,8 @@ public class PushbackReader extends FilterReader {
* @exception IOException If an I/O error occurs
*/
public void close() throws IOException {
try {
super.close();
} finally {
buf = null;
}
super.close();
buf = null;
}
/**
......
......@@ -1762,9 +1762,9 @@ public class Basic {
equal(p.exitValue(), 5);
try { p.getInputStream().close(); } catch (IOException ignore) { }
try {p.getErrorStream().close(); } catch (IOException ignore) { }
try { p.getOutputStream().close(); } catch (IOException ignore) { }
p.getInputStream().close();
p.getErrorStream().close();
p.getOutputStream().close();
InputStream[] streams = { p.getInputStream(), p.getErrorStream() };
for (final InputStream in : streams) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册