7021327: Changes for 7020888 included changes to other files in error
Reviewed-by: chegar
This commit is contained in:
parent
17cace4c58
commit
4c2006a780
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user