cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Axel Dehning (JIRA)" <j...@apache.org>
Subject [jira] Created: (CXF-1571) CachedOutputStream#writeCacheTo(StringBuilder, int) fails with StringIndexOutOfBoundsException
Date Tue, 06 May 2008 09:47:55 GMT
CachedOutputStream#writeCacheTo(StringBuilder, int) fails with StringIndexOutOfBoundsException
----------------------------------------------------------------------------------------------

                 Key: CXF-1571
                 URL: https://issues.apache.org/jira/browse/CXF-1571
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.1
            Reporter: Axel Dehning


    public void writeCacheTo(StringBuilder out, int limit) throws IOException {
    ...
                if ((count + x) > limit) {
                    x = count - limit;                               <<< this has
to be:    x = limit - count;
                }
                out.append(new String(bytes, 0, x));
                count += x;
    ...
    }

If limit is reached x becomes negative and String construction fails with

java.lang.StringIndexOutOfBoundsException: String index out of range: -784
	at java.lang.String.checkBounds(String.java:368)
	at java.lang.String.<init>(String.java:457)
	at org.apache.cxf.io.CachedOutputStream.writeCacheTo(CachedOutputStream.java:272)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message