From 331dc61787a8b811a73894962ae64e5188934627 Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 18 Aug 2003 09:58:26 +0000 Subject: [PATCH] =?UTF-8?q?Committed=20code=20improvements=20proposed=20by?= =?UTF-8?q?=20J=C3=BCrg=20Lehni=20http://grazia.helma.at/pipermail/helma-d?= =?UTF-8?q?ev/2003-August/000330.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helma/framework/ResponseTrans.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/helma/framework/ResponseTrans.java b/src/helma/framework/ResponseTrans.java index 03511a63..8e6a38cf 100644 --- a/src/helma/framework/ResponseTrans.java +++ b/src/helma/framework/ResponseTrans.java @@ -31,6 +31,8 @@ public final class ResponseTrans implements Externalizable { static final long serialVersionUID = -8627370766119740844L; static final int INITIAL_BUFFER_SIZE = 2048; + static final String newLine = System.getProperty("line.separator"); + /** * Set the MIME content type of the response. */ @@ -236,7 +238,7 @@ public final class ResponseTrans implements Externalizable { buffer = new StringBuffer(Math.max(str.length() + 100, INITIAL_BUFFER_SIZE)); } - buffer.append(what.toString()); + buffer.append(str); } } @@ -244,15 +246,9 @@ public final class ResponseTrans implements Externalizable { * Utility function that appends a
to whatever is written. */ public void writeln(Object what) { - if (buffer == null) { - buffer = new StringBuffer(INITIAL_BUFFER_SIZE); - } - - if (what != null) { - buffer.append(what.toString()); - } - - buffer.append("
\r\n"); + this.write(what); + buffer.append("
"); + buffer.append(newLine); } /**