This:
- Provides a default for the system property line.separator in PrintStream.
- Creates a local copy of the channels field in FileDescriptor.valid()
to improve threading safety.
2006-08-15 Roman Kennke <[EMAIL PROTECTED]>
* java/io/PrintStream.java
(line_separator): Provide default for system property.
* java/io/FileDescriptor.java
(valid): Create local copy of channel field for better
threading safetly.
/Roman
Index: java/io/FileDescriptor.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/FileDescriptor.java,v
retrieving revision 1.25
diff -u -1 -2 -r1.25 FileDescriptor.java
--- java/io/FileDescriptor.java 2 Jul 2005 20:32:37 -0000 1.25
+++ java/io/FileDescriptor.java 15 Aug 2006 11:34:55 -0000
@@ -124,16 +124,17 @@
}
}
}
/**
* This methods tests whether or not this object represents a valid open
* native file handle.
*
* @return <code>true</code> if this object represents a valid
* native file handle, <code>false</code> otherwise
*/
public boolean valid ()
- {
- return channel != null && channel.isOpen();
+ {
+ ByteChannel c = channel;
+ return (c != null) && (c.isOpen());
}
}
Index: java/io/PrintStream.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/PrintStream.java,v
retrieving revision 1.27
diff -u -1 -2 -r1.27 PrintStream.java
--- java/io/PrintStream.java 16 Jul 2006 11:57:02 -0000 1.27
+++ java/io/PrintStream.java 15 Aug 2006 11:34:55 -0000
@@ -58,25 +58,25 @@
*
* @author Aaron M. Renn ([EMAIL PROTECTED])
* @author Tom Tromey ([EMAIL PROTECTED])
*/
public class PrintStream extends FilterOutputStream
{
/* Notice the implementation is quite similar to OutputStreamWriter.
* This leads to some minor duplication, because neither inherits
* from the other, and we want to maximize performance. */
// Line separator string.
private static final char[] line_separator
- = SystemProperties.getProperty("line.separator").toCharArray();
+ = SystemProperties.getProperty("line.separator", "\n").toCharArray();
/**
* Encoding name
*/
private String encoding;
/**
* This boolean indicates whether or not an error has ever occurred
* on this stream.
*/
private boolean error_occurred = false;