diff --git a/jdk/src/share/classes/java/io/FileInputStream.java b/jdk/src/share/classes/java/io/FileInputStream.java index 8575e6d9397..a37c69c6239 100644 --- a/jdk/src/share/classes/java/io/FileInputStream.java +++ b/jdk/src/share/classes/java/io/FileInputStream.java @@ -48,15 +48,15 @@ public class FileInputStream extends InputStream { /* File Descriptor - handle to the open file */ - private FileDescriptor fd; + private final FileDescriptor fd; private FileChannel channel = null; - private Object closeLock = new Object(); + private final Object closeLock = new Object(); private volatile boolean closed = false; - private static ThreadLocal runningFinalize = - new ThreadLocal(); + private static final ThreadLocal runningFinalize = + new ThreadLocal(); private static boolean isRunningFinalize() { Boolean val; @@ -151,7 +151,7 @@ class FileInputStream extends InputStream * is thrown. *

* This constructor does not throw an exception if fdObj - * is {link java.io.FileDescriptor#valid() invalid}. + * is {@link java.io.FileDescriptor#valid() invalid}. * However, if the methods are invoked on the resulting stream to attempt * I/O on the stream, an IOException is thrown. * @@ -389,7 +389,7 @@ class FileInputStream extends InputStream * @see java.io.FileInputStream#close() */ protected void finalize() throws IOException { - if ((fd != null) && (fd != fd.in)) { + if ((fd != null) && (fd != FileDescriptor.in)) { /* * Finalizer should not release the FileDescriptor if another diff --git a/jdk/src/share/classes/java/io/FileOutputStream.java b/jdk/src/share/classes/java/io/FileOutputStream.java index 695f43150fe..f6b880a503e 100644 --- a/jdk/src/share/classes/java/io/FileOutputStream.java +++ b/jdk/src/share/classes/java/io/FileOutputStream.java @@ -52,20 +52,18 @@ public class FileOutputStream extends OutputStream { /** - * The system dependent file descriptor. The value is - * 1 more than actual file descriptor. This means that - * the default value 0 indicates that the file is not open. + * The system dependent file descriptor. */ - private FileDescriptor fd; + private final FileDescriptor fd; private FileChannel channel= null; private boolean append = false; - private Object closeLock = new Object(); + private final Object closeLock = new Object(); private volatile boolean closed = false; - private static ThreadLocal runningFinalize = - new ThreadLocal(); + private static final ThreadLocal runningFinalize = + new ThreadLocal(); private static boolean isRunningFinalize() { Boolean val; @@ -75,7 +73,7 @@ class FileOutputStream extends OutputStream } /** - * Creates an output file stream to write to the file with the + * Creates a file output stream to write to the file with the * specified name. A new FileDescriptor object is * created to represent this file connection. *

@@ -100,8 +98,8 @@ class FileOutputStream extends OutputStream } /** - * Creates an output file stream to write to the file with the specified - * name. If the second argument is true, then + * Creates a file output stream to write to the file with the specified + * name. If the second argument is true, then * bytes will be written to the end of the file rather than the beginning. * A new FileDescriptor object is created to represent this * file connection. @@ -211,7 +209,7 @@ class FileOutputStream extends OutputStream } /** - * Creates an output file stream to write to the specified file + * Creates a file output stream to write to the specified file * descriptor, which represents an existing connection to an actual * file in the file system. *

@@ -223,7 +221,7 @@ class FileOutputStream extends OutputStream * is thrown. *

* This constructor does not throw an exception if fdObj - * is {link java.io.FileDescriptor#valid() invalid}. + * is {@link java.io.FileDescriptor#valid() invalid}. * However, if the methods are invoked on the resulting stream to attempt * I/O on the stream, an IOException is thrown. * @@ -408,7 +406,7 @@ class FileOutputStream extends OutputStream */ protected void finalize() throws IOException { if (fd != null) { - if (fd == fd.out || fd == fd.err) { + if (fd == FileDescriptor.out || fd == FileDescriptor.err) { flush(); } else {