[
http://issues.apache.org/jira/browse/AXIS-2496?page=comments#action_12415336 ]
Emmanuel Pellereau commented on AXIS-2496:
------------------------------------------
here is a patch againt axis 1.4 using a java.io.ByteArrayOutputStream:
@@ -25,6 +25,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
@@ -617,11 +618,11 @@
public void run() {
try {
byte[] buffer = new byte[4096];
- byte[] tmpbuffer = new byte[8192];
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
String message = null;
int saved = 0 ;
int len ;
- int i1, i2 ;
+ int i1;
int i ;
int reqSaved = 0 ;
int tabWidth = 3 ;
@@ -718,7 +719,6 @@
bufferLen += len ;
}
i1 = 0 ;
- i2 = 0 ;
saved = 0 ;
for ( ; i1 < bufferLen ; i1++ ) {
// Except when we're at EOF, saved last char
@@ -745,19 +745,20 @@
}
if ( thisIndent != -1 ) {
if ( thisIndent > 0 ) {
- tmpbuffer[i2++] = (byte) '\n';
+ baos.write('\n');
}
for ( i = tabWidth * thisIndent; i > 0; i-- ) {
- tmpbuffer[i2++] = (byte) ' ';
+ baos.write(' ');
}
}
atMargin = ( buffer[i1] == '\n' || buffer[i1] ==
'\r');
if ( !inXML || !atMargin ) {
- tmpbuffer[i2++] = buffer[i1];
+ baos.write(buffer[i1]);
}
}
- message = new String( tmpbuffer, 0, i2, getEncoding()
);
+ message = baos.toString(getEncoding());
+ baos.reset();
if (numericEnc) {
textArea.append(
StringUtils.escapeNumericChar(message) );
} else {
> TcpMon failing in 'XML format' with big responses
> -------------------------------------------------
>
> Key: AXIS-2496
> URL: http://issues.apache.org/jira/browse/AXIS-2496
> Project: Apache Axis
> Type: Bug
> Versions: 1.4
> Environment: any
> Reporter: Emmanuel Pellereau
> Priority: Minor
>
> when handling big xml response (>10ko) with the XML format activated, the
> following exception may occur:
> java.lang.ArrayIndexOutOfBoundsException: 8192
> at org.apache.axis.utils.tcpmon$SocketRR.run(tcpmon.java:751)
> it is due to a buffer overflow. When processing a input buffer of 4096 bytes,
> a tmpBuffer is allocated 8192 bytes to handle extra caracters (mainly
> indentation for xml formating). for large XMLs, this buffer might be too
> small.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]