* Minor code improvement in write() method.

This commit is contained in:
hns 2006-08-16 11:05:26 +00:00
parent 736769cc80
commit f779decdfc

View file

@ -321,9 +321,10 @@ public final class ResponseTrans extends Writer implements Serializable {
* Write object to response buffer and append a platform dependent newline sequence.
*/
public synchronized void writeln(Object what) {
write(what);
// if what is null, buffer may still be uninitialized
if (buffer == null) {
if (what != null) {
write(what.toString());
} else if (buffer == null) {
// if what is null, buffer may still be uninitialized
buffer = new StringBuffer(INITIAL_BUFFER_SIZE);
}
buffer.append(newLine);