RFR: 8291792: DefaultStyledDocument.setCharacterAttribute accepts negative length [v4]

Phil Race prr at openjdk.org
Wed Aug 24 17:11:26 UTC 2022


On Wed, 24 Aug 2022 05:49:20 GMT, Tejesh R <tr at openjdk.org> wrote:

> > Although I've reviewed the CSR I'd prefer it not be finalized yet. I think it needs more changes. The spec is SILENT about what then happens if length is negative and SILENT about an out of range offset too. I think we should address these issues as well.
> > Also everywhere - in the CSR and the bug description and summary the text said the method is called setCharacterAttribute whereas it is setCharacterAttributes.
> 
> For negative length, now it just returns the control without processing it whereas before it used to raise an exception in arrayCopy method. Upper bound for length should be the text length(which is to be modified/added) I feel, still even if it crosses overall text size that case is handled by limiting to text length. These are not mentioned in spec, so should we modify the spec by adding the range bounds for length......?

Yes I am saying we should mention all of this

-------------

PR: https://git.openjdk.org/jdk/pull/9830



More information about the client-libs-dev mailing list