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:
parent
df3b4de13f
commit
712cba2d99
1 changed files with 11 additions and 3 deletions
|
@ -335,17 +335,25 @@ public final class ResponseTrans implements Externalizable {
|
||||||
if (charset == null)
|
if (charset == null)
|
||||||
charset = "ISO-8859-1";
|
charset = "ISO-8859-1";
|
||||||
boolean encodingError = false;
|
boolean encodingError = false;
|
||||||
|
// only close if the response hasn't been closed yet
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
if (buffer != null) {
|
// if debug buffer exists, append it to main buffer
|
||||||
if (debugBuffer != null)
|
if (debugBuffer != null) {
|
||||||
|
if (buffer == null)
|
||||||
|
buffer = debugBuffer;
|
||||||
|
else
|
||||||
buffer.append (debugBuffer);
|
buffer.append (debugBuffer);
|
||||||
|
}
|
||||||
|
// get the buffer's bytes in the specified encoding
|
||||||
|
if (buffer != null) {
|
||||||
try {
|
try {
|
||||||
response = buffer.toString ().getBytes (charset);
|
response = buffer.toString ().getBytes (charset);
|
||||||
} catch (UnsupportedEncodingException uee) {
|
} catch (UnsupportedEncodingException uee) {
|
||||||
encodingError = true;
|
encodingError = true;
|
||||||
response = buffer.toString ().getBytes ();
|
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 {
|
} else {
|
||||||
response = new byte[0];
|
response = new byte[0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue