You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Axel Dehning (JIRA)" <ji...@apache.org> on 2008/05/06 11:47:55 UTC

[jira] Created: (CXF-1571) CachedOutputStream#writeCacheTo(StringBuilder, int) fails with StringIndexOutOfBoundsException

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.


[jira] Assigned: (CXF-1571) CachedOutputStream#writeCacheTo(StringBuilder, int) fails with StringIndexOutOfBoundsException

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies reassigned CXF-1571:
-------------------------------------

    Assignee: Benson Margulies

> 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
>            Assignee: Benson Margulies
>             Fix For: 2.1.1
>
>
>     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.


[jira] Resolved: (CXF-1571) CachedOutputStream#writeCacheTo(StringBuilder, int) fails with StringIndexOutOfBoundsException

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies resolved CXF-1571.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.1

Committed to trunk.

> 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
>            Assignee: Benson Margulies
>             Fix For: 2.1.1
>
>
>     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.