[ 
https://issues.apache.org/jira/browse/TEXT-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131034#comment-18131034
 ] 

Aryan Ganjoo commented on TEXT-138:
-----------------------------------

There is still an empty-range case on 1.15.0 and current master:

{code:java}
Appendable out = new TextStringBuilder("name=");
out.append("", 0, 0);
{code}

This throws StringIndexOutOfBoundsException, while Appendable allows equal 
start/end indices and should leave the output unchanged. The test added with 
this fix explicitly expects equal indices to throw.

Would you be open to correcting that case? Happy to help with a fix and 
regression tests. I can open a new ticket if you prefer.

Prepared with AI assistance.

> TextStringBuilder append sub-sequence not consistent with Appendable
> --------------------------------------------------------------------
>
>                 Key: TEXT-138
>                 URL: https://issues.apache.org/jira/browse/TEXT-138
>             Project: Commons Text
>          Issue Type: Bug
>    Affects Versions: 1.4, 1.5, 1.6
>            Reporter: Neal Johnson
>            Priority: Minor
>              Labels: usability
>             Fix For: 1.7
>
>
> The method:
> {{append(final CharSequence seq, final int startIndex, final int length)}}
> Overrides the method defined by Appendable. However the behavior of the 
> TextStringBuilder implementation is not consistent with the definition in 
> Appendable. As the class defines "that some edge cases, with invalid indices 
> or null input, have been altered - see individual methods" this would not 
> normally be an issue. However as the implementation states that it overrides 
> Appendable the class cannot be used as an Appendable as the last argument is 
> expected to be an end index and not a length.
>  
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to