Output debug buffer even if main response buffer has not been created.

Fixes bug 212:
http://helma.org/bugs/show_bug.cgi?id=212
This commit is contained in:
hns 2003-01-28 12:22:46 +00:00
parent df3b4de13f
commit 712cba2d99

View file

@ -335,17 +335,25 @@ public final class ResponseTrans implements Externalizable {
if (charset == null)
charset = "ISO-8859-1";
boolean encodingError = false;
// only close if the response hasn't been closed yet
if (response == null) {
if (buffer != null) {
if (debugBuffer != null)
// if debug buffer exists, append it to main buffer
if (debugBuffer != null) {
if (buffer == null)
buffer = debugBuffer;
else
buffer.append (debugBuffer);
}
// get the buffer's bytes in the specified encoding
if (buffer != null) {
try {
response = buffer.toString ().getBytes (charset);
} catch (UnsupportedEncodingException uee) {
encodingError = true;
response = buffer.toString ().getBytes ();
}
buffer = null; // make sure this is done only once, even with more requsts attached
// make sure this is done only once, even with more requsts attached
buffer = null;
} else {
response = new byte[0];
}