You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Ivanov, Alexey A" <al...@intel.com> on 2006/11/02 10:09:28 UTC

[classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Hi all,

I've started fixing HARMONY-1809. To remove throws clause from the
declaration of replace method, as it was proposed by Oleg in
HARMONY-1975, I placed removeItems() and insertItems() calls into
try-catch block. This would work OK for any valid arguments.

I was going to handle invalid arguments by making adjustments so that
the following removeItems() and insertItems() will not throw the
exception. After I wrote several tests, I faced strange behaviour of RI
with regards to invalid arguments to replace.

(The Javadoc say nothing about which valid ranges for replace()
parameters as well as any exceptions.)

RI accepts invalid arguments but the result differs from what I'd
expect.
For example, if the content has "text" in it, I'd expect that
content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
the invalid start position is adjusted to 0, and the length of remove is
adjusted to be 2 accordingly. But this is not the case. As the result of
this call, all characters are removed leaving "" in the content.

Moreover the content object becomes unusable after that:
content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.

Similarly if number of characters to be removed is greater than the
length of the content (content.replace(2, 4, null, 0) with "text" in
it), the object will throw ArrayIndexOutOfBoundsException when doing
insertString.


Considering the fact that GapContent is pretty low-level class in text
representation model and that it is protected, I think that Harmony
implementation can silently ignore BadLocationException possible thrown
from insertItems() and removeItems(). Taking into account erroneous
behaviour of RI's replace, we can do that until an application is
broken.

As another option, we can throw an Error from catch block to make
application which depends on implementation of replace() fast-fail.


Any objections, comments, opinions?

Thanks,
Alexey.


P.S. The related JIRA issues:
https://issues.apache.org/jira/browse/HARMONY-1809
https://issues.apache.org/jira/browse/HARMONY-1975

GapContent Javadoc:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
Description of GapContent.replace:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
#replace(int,%20int,%20java.lang.Object,%20int)


--
Alexey A. Ivanov
Intel Middleware Product Division

Re: [classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Posted by Oleg Khaschansky <ol...@gmail.com>.
Could you, please, look at the unit test in #1809 also?

On 11/2/06, Oleg Khaschansky <ol...@gmail.com> wrote:
> Yes, but the GapContent changes were not applied.
>
> On 11/2/06, Alexey Petrenko <al...@gmail.com> wrote:
> > HARMONY-1975is already applied and closed ;)
> >
> > 2006/11/2, Alexey Petrenko <al...@gmail.com>:
> > > I'll take care of 1975.
> > >
> > > SY, Alexey
> > >
> > > 2006/11/2, Oleg Khaschansky <ol...@gmail.com>:
> > > > +1. Silently doing nothing if invalid parameters are passed seems to
> > > > me a right behavior in this case.
> > > >
> > > > Will someone apply changes to GapContent from the harmony-1975.patch
> > > > or we need to make a separate patch for this?
> > > >
> > > > On 11/2/06, Alexey Petrenko <al...@gmail.com> wrote:
> > > > > 2006/11/2, Ivanov, Alexey A <al...@intel.com>:
> > > > > > Hi all,
> > > > > >
> > > > > > I've started fixing HARMONY-1809. To remove throws clause from the
> > > > > > declaration of replace method, as it was proposed by Oleg in
> > > > > > HARMONY-1975, I placed removeItems() and insertItems() calls into
> > > > > > try-catch block. This would work OK for any valid arguments.
> > > > > >
> > > > > > I was going to handle invalid arguments by making adjustments so that
> > > > > > the following removeItems() and insertItems() will not throw the
> > > > > > exception. After I wrote several tests, I faced strange behaviour of RI
> > > > > > with regards to invalid arguments to replace.
> > > > > >
> > > > > > (The Javadoc say nothing about which valid ranges for replace()
> > > > > > parameters as well as any exceptions.)
> > > > > >
> > > > > > RI accepts invalid arguments but the result differs from what I'd
> > > > > > expect.
> > > > > > For example, if the content has "text" in it, I'd expect that
> > > > > > content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
> > > > > > the invalid start position is adjusted to 0, and the length of remove is
> > > > > > adjusted to be 2 accordingly. But this is not the case. As the result of
> > > > > > this call, all characters are removed leaving "" in the content.
> > > > > >
> > > > > > Moreover the content object becomes unusable after that:
> > > > > > content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.
> > > > > >
> > > > > > Similarly if number of characters to be removed is greater than the
> > > > > > length of the content (content.replace(2, 4, null, 0) with "text" in
> > > > > > it), the object will throw ArrayIndexOutOfBoundsException when doing
> > > > > > insertString.
> > > > > >
> > > > > >
> > > > > > Considering the fact that GapContent is pretty low-level class in text
> > > > > > representation model and that it is protected, I think that Harmony
> > > > > > implementation can silently ignore BadLocationException possible thrown
> > > > > > from insertItems() and removeItems(). Taking into account erroneous
> > > > > > behaviour of RI's replace, we can do that until an application is
> > > > > > broken.
> > > > > +1 for this solution.
> > > > >
> > > > > SY, Alexey
> > > > >
> > > > > > As another option, we can throw an Error from catch block to make
> > > > > > application which depends on implementation of replace() fast-fail.
> > > > > >
> > > > > >
> > > > > > Any objections, comments, opinions?
> > > > > >
> > > > > > Thanks,
> > > > > > Alexey.
> > > > > >
> > > > > >
> > > > > > P.S. The related JIRA issues:
> > > > > > https://issues.apache.org/jira/browse/HARMONY-1809
> > > > > > https://issues.apache.org/jira/browse/HARMONY-1975
> > > > > >
> > > > > > GapContent Javadoc:
> > > > > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > > > > Description of GapContent.replace:
> > > > > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > > > > #replace(int,%20int,%20java.lang.Object,%20int)
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Alexey A. Ivanov
> > > > > > Intel Middleware Product Division
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: [classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Posted by Oleg Khaschansky <ol...@gmail.com>.
Yes, but the GapContent changes were not applied.

On 11/2/06, Alexey Petrenko <al...@gmail.com> wrote:
> HARMONY-1975is already applied and closed ;)
>
> 2006/11/2, Alexey Petrenko <al...@gmail.com>:
> > I'll take care of 1975.
> >
> > SY, Alexey
> >
> > 2006/11/2, Oleg Khaschansky <ol...@gmail.com>:
> > > +1. Silently doing nothing if invalid parameters are passed seems to
> > > me a right behavior in this case.
> > >
> > > Will someone apply changes to GapContent from the harmony-1975.patch
> > > or we need to make a separate patch for this?
> > >
> > > On 11/2/06, Alexey Petrenko <al...@gmail.com> wrote:
> > > > 2006/11/2, Ivanov, Alexey A <al...@intel.com>:
> > > > > Hi all,
> > > > >
> > > > > I've started fixing HARMONY-1809. To remove throws clause from the
> > > > > declaration of replace method, as it was proposed by Oleg in
> > > > > HARMONY-1975, I placed removeItems() and insertItems() calls into
> > > > > try-catch block. This would work OK for any valid arguments.
> > > > >
> > > > > I was going to handle invalid arguments by making adjustments so that
> > > > > the following removeItems() and insertItems() will not throw the
> > > > > exception. After I wrote several tests, I faced strange behaviour of RI
> > > > > with regards to invalid arguments to replace.
> > > > >
> > > > > (The Javadoc say nothing about which valid ranges for replace()
> > > > > parameters as well as any exceptions.)
> > > > >
> > > > > RI accepts invalid arguments but the result differs from what I'd
> > > > > expect.
> > > > > For example, if the content has "text" in it, I'd expect that
> > > > > content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
> > > > > the invalid start position is adjusted to 0, and the length of remove is
> > > > > adjusted to be 2 accordingly. But this is not the case. As the result of
> > > > > this call, all characters are removed leaving "" in the content.
> > > > >
> > > > > Moreover the content object becomes unusable after that:
> > > > > content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.
> > > > >
> > > > > Similarly if number of characters to be removed is greater than the
> > > > > length of the content (content.replace(2, 4, null, 0) with "text" in
> > > > > it), the object will throw ArrayIndexOutOfBoundsException when doing
> > > > > insertString.
> > > > >
> > > > >
> > > > > Considering the fact that GapContent is pretty low-level class in text
> > > > > representation model and that it is protected, I think that Harmony
> > > > > implementation can silently ignore BadLocationException possible thrown
> > > > > from insertItems() and removeItems(). Taking into account erroneous
> > > > > behaviour of RI's replace, we can do that until an application is
> > > > > broken.
> > > > +1 for this solution.
> > > >
> > > > SY, Alexey
> > > >
> > > > > As another option, we can throw an Error from catch block to make
> > > > > application which depends on implementation of replace() fast-fail.
> > > > >
> > > > >
> > > > > Any objections, comments, opinions?
> > > > >
> > > > > Thanks,
> > > > > Alexey.
> > > > >
> > > > >
> > > > > P.S. The related JIRA issues:
> > > > > https://issues.apache.org/jira/browse/HARMONY-1809
> > > > > https://issues.apache.org/jira/browse/HARMONY-1975
> > > > >
> > > > > GapContent Javadoc:
> > > > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > > > Description of GapContent.replace:
> > > > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > > > #replace(int,%20int,%20java.lang.Object,%20int)
> > > > >
> > > > >
> > > > > --
> > > > > Alexey A. Ivanov
> > > > > Intel Middleware Product Division
> > > > >
> > > >
> > >
> >
>

Re: [classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Posted by Alexey Petrenko <al...@gmail.com>.
HARMONY-1975is already applied and closed ;)

2006/11/2, Alexey Petrenko <al...@gmail.com>:
> I'll take care of 1975.
>
> SY, Alexey
>
> 2006/11/2, Oleg Khaschansky <ol...@gmail.com>:
> > +1. Silently doing nothing if invalid parameters are passed seems to
> > me a right behavior in this case.
> >
> > Will someone apply changes to GapContent from the harmony-1975.patch
> > or we need to make a separate patch for this?
> >
> > On 11/2/06, Alexey Petrenko <al...@gmail.com> wrote:
> > > 2006/11/2, Ivanov, Alexey A <al...@intel.com>:
> > > > Hi all,
> > > >
> > > > I've started fixing HARMONY-1809. To remove throws clause from the
> > > > declaration of replace method, as it was proposed by Oleg in
> > > > HARMONY-1975, I placed removeItems() and insertItems() calls into
> > > > try-catch block. This would work OK for any valid arguments.
> > > >
> > > > I was going to handle invalid arguments by making adjustments so that
> > > > the following removeItems() and insertItems() will not throw the
> > > > exception. After I wrote several tests, I faced strange behaviour of RI
> > > > with regards to invalid arguments to replace.
> > > >
> > > > (The Javadoc say nothing about which valid ranges for replace()
> > > > parameters as well as any exceptions.)
> > > >
> > > > RI accepts invalid arguments but the result differs from what I'd
> > > > expect.
> > > > For example, if the content has "text" in it, I'd expect that
> > > > content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
> > > > the invalid start position is adjusted to 0, and the length of remove is
> > > > adjusted to be 2 accordingly. But this is not the case. As the result of
> > > > this call, all characters are removed leaving "" in the content.
> > > >
> > > > Moreover the content object becomes unusable after that:
> > > > content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.
> > > >
> > > > Similarly if number of characters to be removed is greater than the
> > > > length of the content (content.replace(2, 4, null, 0) with "text" in
> > > > it), the object will throw ArrayIndexOutOfBoundsException when doing
> > > > insertString.
> > > >
> > > >
> > > > Considering the fact that GapContent is pretty low-level class in text
> > > > representation model and that it is protected, I think that Harmony
> > > > implementation can silently ignore BadLocationException possible thrown
> > > > from insertItems() and removeItems(). Taking into account erroneous
> > > > behaviour of RI's replace, we can do that until an application is
> > > > broken.
> > > +1 for this solution.
> > >
> > > SY, Alexey
> > >
> > > > As another option, we can throw an Error from catch block to make
> > > > application which depends on implementation of replace() fast-fail.
> > > >
> > > >
> > > > Any objections, comments, opinions?
> > > >
> > > > Thanks,
> > > > Alexey.
> > > >
> > > >
> > > > P.S. The related JIRA issues:
> > > > https://issues.apache.org/jira/browse/HARMONY-1809
> > > > https://issues.apache.org/jira/browse/HARMONY-1975
> > > >
> > > > GapContent Javadoc:
> > > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > > Description of GapContent.replace:
> > > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > > #replace(int,%20int,%20java.lang.Object,%20int)
> > > >
> > > >
> > > > --
> > > > Alexey A. Ivanov
> > > > Intel Middleware Product Division
> > > >
> > >
> >
>

Re: [classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Posted by Alexey Petrenko <al...@gmail.com>.
I'll take care of 1975.

SY, Alexey

2006/11/2, Oleg Khaschansky <ol...@gmail.com>:
> +1. Silently doing nothing if invalid parameters are passed seems to
> me a right behavior in this case.
>
> Will someone apply changes to GapContent from the harmony-1975.patch
> or we need to make a separate patch for this?
>
> On 11/2/06, Alexey Petrenko <al...@gmail.com> wrote:
> > 2006/11/2, Ivanov, Alexey A <al...@intel.com>:
> > > Hi all,
> > >
> > > I've started fixing HARMONY-1809. To remove throws clause from the
> > > declaration of replace method, as it was proposed by Oleg in
> > > HARMONY-1975, I placed removeItems() and insertItems() calls into
> > > try-catch block. This would work OK for any valid arguments.
> > >
> > > I was going to handle invalid arguments by making adjustments so that
> > > the following removeItems() and insertItems() will not throw the
> > > exception. After I wrote several tests, I faced strange behaviour of RI
> > > with regards to invalid arguments to replace.
> > >
> > > (The Javadoc say nothing about which valid ranges for replace()
> > > parameters as well as any exceptions.)
> > >
> > > RI accepts invalid arguments but the result differs from what I'd
> > > expect.
> > > For example, if the content has "text" in it, I'd expect that
> > > content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
> > > the invalid start position is adjusted to 0, and the length of remove is
> > > adjusted to be 2 accordingly. But this is not the case. As the result of
> > > this call, all characters are removed leaving "" in the content.
> > >
> > > Moreover the content object becomes unusable after that:
> > > content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.
> > >
> > > Similarly if number of characters to be removed is greater than the
> > > length of the content (content.replace(2, 4, null, 0) with "text" in
> > > it), the object will throw ArrayIndexOutOfBoundsException when doing
> > > insertString.
> > >
> > >
> > > Considering the fact that GapContent is pretty low-level class in text
> > > representation model and that it is protected, I think that Harmony
> > > implementation can silently ignore BadLocationException possible thrown
> > > from insertItems() and removeItems(). Taking into account erroneous
> > > behaviour of RI's replace, we can do that until an application is
> > > broken.
> > +1 for this solution.
> >
> > SY, Alexey
> >
> > > As another option, we can throw an Error from catch block to make
> > > application which depends on implementation of replace() fast-fail.
> > >
> > >
> > > Any objections, comments, opinions?
> > >
> > > Thanks,
> > > Alexey.
> > >
> > >
> > > P.S. The related JIRA issues:
> > > https://issues.apache.org/jira/browse/HARMONY-1809
> > > https://issues.apache.org/jira/browse/HARMONY-1975
> > >
> > > GapContent Javadoc:
> > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > Description of GapContent.replace:
> > > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > > #replace(int,%20int,%20java.lang.Object,%20int)
> > >
> > >
> > > --
> > > Alexey A. Ivanov
> > > Intel Middleware Product Division
> > >
> >
>

Re: [classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Posted by Oleg Khaschansky <ol...@gmail.com>.
+1. Silently doing nothing if invalid parameters are passed seems to
me a right behavior in this case.

Will someone apply changes to GapContent from the harmony-1975.patch
or we need to make a separate patch for this?

On 11/2/06, Alexey Petrenko <al...@gmail.com> wrote:
> 2006/11/2, Ivanov, Alexey A <al...@intel.com>:
> > Hi all,
> >
> > I've started fixing HARMONY-1809. To remove throws clause from the
> > declaration of replace method, as it was proposed by Oleg in
> > HARMONY-1975, I placed removeItems() and insertItems() calls into
> > try-catch block. This would work OK for any valid arguments.
> >
> > I was going to handle invalid arguments by making adjustments so that
> > the following removeItems() and insertItems() will not throw the
> > exception. After I wrote several tests, I faced strange behaviour of RI
> > with regards to invalid arguments to replace.
> >
> > (The Javadoc say nothing about which valid ranges for replace()
> > parameters as well as any exceptions.)
> >
> > RI accepts invalid arguments but the result differs from what I'd
> > expect.
> > For example, if the content has "text" in it, I'd expect that
> > content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
> > the invalid start position is adjusted to 0, and the length of remove is
> > adjusted to be 2 accordingly. But this is not the case. As the result of
> > this call, all characters are removed leaving "" in the content.
> >
> > Moreover the content object becomes unusable after that:
> > content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.
> >
> > Similarly if number of characters to be removed is greater than the
> > length of the content (content.replace(2, 4, null, 0) with "text" in
> > it), the object will throw ArrayIndexOutOfBoundsException when doing
> > insertString.
> >
> >
> > Considering the fact that GapContent is pretty low-level class in text
> > representation model and that it is protected, I think that Harmony
> > implementation can silently ignore BadLocationException possible thrown
> > from insertItems() and removeItems(). Taking into account erroneous
> > behaviour of RI's replace, we can do that until an application is
> > broken.
> +1 for this solution.
>
> SY, Alexey
>
> > As another option, we can throw an Error from catch block to make
> > application which depends on implementation of replace() fast-fail.
> >
> >
> > Any objections, comments, opinions?
> >
> > Thanks,
> > Alexey.
> >
> >
> > P.S. The related JIRA issues:
> > https://issues.apache.org/jira/browse/HARMONY-1809
> > https://issues.apache.org/jira/browse/HARMONY-1975
> >
> > GapContent Javadoc:
> > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > Description of GapContent.replace:
> > http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> > #replace(int,%20int,%20java.lang.Object,%20int)
> >
> >
> > --
> > Alexey A. Ivanov
> > Intel Middleware Product Division
> >
>

Re: [classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Posted by Alexey Petrenko <al...@gmail.com>.
2006/11/2, Ivanov, Alexey A <al...@intel.com>:
> Hi all,
>
> I've started fixing HARMONY-1809. To remove throws clause from the
> declaration of replace method, as it was proposed by Oleg in
> HARMONY-1975, I placed removeItems() and insertItems() calls into
> try-catch block. This would work OK for any valid arguments.
>
> I was going to handle invalid arguments by making adjustments so that
> the following removeItems() and insertItems() will not throw the
> exception. After I wrote several tests, I faced strange behaviour of RI
> with regards to invalid arguments to replace.
>
> (The Javadoc say nothing about which valid ranges for replace()
> parameters as well as any exceptions.)
>
> RI accepts invalid arguments but the result differs from what I'd
> expect.
> For example, if the content has "text" in it, I'd expect that
> content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
> the invalid start position is adjusted to 0, and the length of remove is
> adjusted to be 2 accordingly. But this is not the case. As the result of
> this call, all characters are removed leaving "" in the content.
>
> Moreover the content object becomes unusable after that:
> content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.
>
> Similarly if number of characters to be removed is greater than the
> length of the content (content.replace(2, 4, null, 0) with "text" in
> it), the object will throw ArrayIndexOutOfBoundsException when doing
> insertString.
>
>
> Considering the fact that GapContent is pretty low-level class in text
> representation model and that it is protected, I think that Harmony
> implementation can silently ignore BadLocationException possible thrown
> from insertItems() and removeItems(). Taking into account erroneous
> behaviour of RI's replace, we can do that until an application is
> broken.
+1 for this solution.

SY, Alexey

> As another option, we can throw an Error from catch block to make
> application which depends on implementation of replace() fast-fail.
>
>
> Any objections, comments, opinions?
>
> Thanks,
> Alexey.
>
>
> P.S. The related JIRA issues:
> https://issues.apache.org/jira/browse/HARMONY-1809
> https://issues.apache.org/jira/browse/HARMONY-1975
>
> GapContent Javadoc:
> http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> Description of GapContent.replace:
> http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> #replace(int,%20int,%20java.lang.Object,%20int)
>
>
> --
> Alexey A. Ivanov
> Intel Middleware Product Division
>

Re: [classlib][swing] compatibility: j.s.text.GapContent.replace() behaviour

Posted by Stepan Mishura <st...@gmail.com>.
On 11/2/06, Ivanov, Alexey A wrote:
>
> Hi all,
>
> I've started fixing HARMONY-1809. To remove throws clause from the
> declaration of replace method, as it was proposed by Oleg in
> HARMONY-1975, I placed removeItems() and insertItems() calls into
> try-catch block. This would work OK for any valid arguments.
>
> I was going to handle invalid arguments by making adjustments so that
> the following removeItems() and insertItems() will not throw the
> exception. After I wrote several tests, I faced strange behaviour of RI
> with regards to invalid arguments to replace.
>
> (The Javadoc say nothing about which valid ranges for replace()
> parameters as well as any exceptions.)
>
> RI accepts invalid arguments but the result differs from what I'd
> expect.
> For example, if the content has "text" in it, I'd expect that
> content.replace(-2, 4, null, 0) would give "xt" as the result. I mean
> the invalid start position is adjusted to 0, and the length of remove is
> adjusted to be 2 accordingly. But this is not the case. As the result of
> this call, all characters are removed leaving "" in the content.
>
> Moreover the content object becomes unusable after that:
> content.insertString(0, "1") throws ArrayIndexOutOfBoundsException.
>
> Similarly if number of characters to be removed is greater than the
> length of the content (content.replace(2, 4, null, 0) with "text" in
> it), the object will throw ArrayIndexOutOfBoundsException when doing
> insertString.
>
>
> Considering the fact that GapContent is pretty low-level class in text
> representation model and that it is protected, I think that Harmony
> implementation can silently ignore BadLocationException possible thrown
> from insertItems() and removeItems(). Taking into account erroneous
> behaviour of RI's replace, we can do that until an application is
> broken.
>
> As another option, we can throw an Error from catch block to make
> application which depends on implementation of replace() fast-fail.
>
>
> Any objections, comments, opinions?



Hi Alexey,

I'm not quite convinced by your evaluation (I'm not an expert in Swing API
so I may be wrong). My experiments with GapContent showed that Harmony
initially created different object then RI, for example, if you create an
object with GapContent() constructor, Harmony will return start==0 and
end==9 while RI will return start==1 and end==10. The next point that
confuses me that the spec. says about position as "logical position in the
storage"...and... "This is not the location in the underlying storage
array". So negative value for position may be considered as valid.

Thanks,
Stepan.

Thanks,
> Alexey.
>
>
> P.S. The related JIRA issues:
> https://issues.apache.org/jira/browse/HARMONY-1809
> https://issues.apache.org/jira/browse/HARMONY-1975
>
> GapContent Javadoc:
> http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> Description of GapContent.replace:
> http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/GapContent.html
> #replace(int,%20int,%20java.lang.Object,%20int)
>
>
> --
> Alexey A. Ivanov
> Intel Middleware Product Division
>



-- 
Stepan Mishura
Intel Middleware Products Division

------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org