7021327: Changes for 7020888 included changes to other files in error
Reviewed-by: chegar
--- a/jdk/src/share/classes/java/io/BufferedReader.java Tue Feb 22 12:04:48 2011 +0000
+++ b/jdk/src/share/classes/java/io/BufferedReader.java Tue Feb 22 14:28:13 2011 +0000
@@ -512,14 +512,11 @@
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;
}
}
}
--- a/jdk/src/share/classes/java/io/BufferedWriter.java Tue Feb 22 12:04:48 2011 +0000
+++ b/jdk/src/share/classes/java/io/BufferedWriter.java Tue Feb 22 14:28:13 2011 +0000
@@ -255,16 +255,17 @@
}
}
- @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;
}
}
}
--- a/jdk/src/share/classes/java/io/FilterOutputStream.java Tue Feb 22 12:04:48 2011 +0000
+++ b/jdk/src/share/classes/java/io/FilterOutputStream.java Tue Feb 22 14:28:13 2011 +0000
@@ -152,10 +152,11 @@
* @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();
}
}
--- a/jdk/src/share/classes/java/io/PushbackInputStream.java Tue Feb 22 12:04:48 2011 +0000
+++ b/jdk/src/share/classes/java/io/PushbackInputStream.java Tue Feb 22 14:28:13 2011 +0000
@@ -374,13 +374,10 @@
* @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;
}
}
--- a/jdk/src/share/classes/java/io/PushbackReader.java Tue Feb 22 12:04:48 2011 +0000
+++ b/jdk/src/share/classes/java/io/PushbackReader.java Tue Feb 22 14:28:13 2011 +0000
@@ -245,11 +245,8 @@
* @exception IOException If an I/O error occurs
*/
public void close() throws IOException {
- try {
- super.close();
- } finally {
- buf = null;
- }
+ super.close();
+ buf = null;
}
/**
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java Tue Feb 22 12:04:48 2011 +0000
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java Tue Feb 22 14:28:13 2011 +0000
@@ -1762,9 +1762,9 @@
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) {