You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Mark Hindess <ma...@googlemail.com> on 2006/04/15 22:44:15 UTC

should strings in exceptions match the reference implementation?

Another thing that came up when looking at PatternSyntaxExceptionTest
(HARMONY-352) was that the test was testing for the strings in
exceptions.  Since these were testing for strings not in the exceptions
thrown by the new implementation (nor by the reference
implementation), I thought about removing the tests and just ignoring
the strings.  But then...

I remembered that two days ago I had solved a problem with tests
failing on our windows build machine [0], by doing a google search for
the exact string in the exception that was being thrown.  It would
have been much harder to solve if the string didn't match the string
thrown by the reference implementation.  So, I think we should try to
match strings in exceptions because it will help our users when trying
to debug problems.  Currently we don't in very many cases.

What do other people think?

Obviously we will have to match them if we are going to test for them
in our API tests or they wont pass when run against a reference
implementation.

My patch for the PatternSyntaxExceptionTest has the string tests with
the expected values set to the values from the exceptions trhown by
the RI.  But I've commented them out since harmony strings don't
currently match and since the strings probably should have different
line endings on different platforms.

Regards,
 Mark.

[0] SystemRoot not being set in the environment when called from my
    ant task.

--
Mark Hindess <ma...@googlemail.com>
IBM Java Technology Centre, UK.

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Paulex Yang <pa...@gmail.com>.
Mark Hindess wrote:
> Ok.  I think it's a little unfortunate for our users that we can't
> match error messages but you are probably correct about them being
> copyright.
>   
> So, the second issue, should we be checking for messages/descriptions
> in exception
> tests, even to match what Harmony throws?  If we do then our api tests
> wont pass on other implementations.
>   
I don't think so. The exception message is only read by human in most
cases(if not in all cases), while exception type can be evaluated by
program as well as human. So the compatibility of exception type with RI
is significant because throwing different exception class may break
applications, but I believe few application depends on exception
message, so it should be much safer to keep a little freedom on the
message writing. The freedom is only a little, because the message
itself should still be clear and make sense, but it's not necessary same
with RI, and it is not testable by JUnit(until one day AI is clever
enough to support assertMakeSense() ;-) ).

Besides, I agree that same message with RI may introduce legal issue.
> Regards,
>  Mark.
>
> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
>   
>> On 4/17/06, LvJimmy,Jing <fi...@gmail.com> wrote:
>>     
>>> Agreed. Try some other words may be better. The only possible un-compatible
>>> with RI is that some rookie may write codes like:
>>> try{
>>>    ...
>>> }catch(Except e){
>>>    if (e.getMessage().equals(RI_String)){
>>>        dosomething;
>>>    }
>>> }
>>> But this kind of code is properly unstable and unacceptable,right?
>>>       
>> Agree. I expect there is no or almost no client applications doing
>> that. I think we shouldn't be message-compatible. Otherwise we would
>> have to be compatible with localized messages as well in assumption
>> someone checks for e.getLocalizedMessage() :-).
>>
>> --
>> Anton Avtamonov,
>> 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
>>
>>
>>     
>
>
> --
> Mark Hindess <ma...@googlemail.com>
> IBM Java Technology Centre, UK.
>
> ---------------------------------------------------------------------
> 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
>
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
> Very sorry, there're some typing mistakes in last letter. Please ignore it.

Exctually, I haven't noticed any :-). May be because I also do lots of
them. I hope native-speakers will excuse us :-).

Wishes,
--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Andrew Zhang <zh...@gmail.com>.
Very sorry, there're some typing mistakes in last letter. Please ignore it.

Hello, Anton,

On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
>
>
>
>  On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> >
> > No, we don't need all those branches. Only the branch for Harmony.
> > Only for those cases when we DO know that we have a deviation.
> > IMHO, I prefer to have all tests passing on RI (which verify tests
> > itself) and on Harmony (which verifies Harmony).
>
>
>
>
>  But there ARE some different behaviours between Harmony and RI.
> How could our test case show  these differences if all are passed both on
> RI and Harmony?
> I think our test cases should indicate these differences rather hiding
> them.
>
> Failures should
> > indicate something wrong with tests or with Harmony code. There should
> > be no other failures, I think.
>
>
>  Yes. So I think all test cases should pass on Harmony, but *NOT* on RI
> :-)
> Failures on RI mean RI has different understanding or behaviours compared
> to Harmony criteria, or in other words, they're wrong behaviours according
> to Harmony criteria.
>
> That is a bit similar to 'exclude list' we introduced: we don't want
> to have failures when they are expected and predictable.
>
>
> --
> Anton Avtamonov,
> 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
>
>
>
>
>
> --
>
> Andrew Zhang
>
> China Software Development Lab, IBM
>



--
Andrew Zhang
China Software Development Lab, IBM

Re: should strings in exceptions match the reference implementation?

Posted by Sergey Soldatov <se...@gmail.com>.
Such functionality should be supported by the test harness and as far as I
know JUnit framework doesn't support it. Please correct me if I'm wrong.
It's much easier to isolate such tests to a separate class.

On 4/17/06, Paulex Yang <pa...@gmail.com> wrote:
>
> Anton Avtamonov wrote:
> > I also agree.
> > The only 'requirement' I would add is that it should be possible to do
> > such mark-up on per-check basis rather than per-test_method or even
> > per-test_class basic. Because each testMehtod() may have several
> > checks only few of them will be harmony-dependent.
> >
> Wow....you are much more ambitious than me! ;-)
>
> Quick searching Ant's reference, and I only found the exclude support on
> per-class basis. Any potential to use Ant without programming to support
> filter like this?
>
> If programming based on annotation, how about writing some APT processor
> to generate Harmony specific test suites/RI compatibility test
> suites/excluded tests list?
>
> > --
> > Anton Avtamonov,
> > Intel Middleware Products Division
> >
> >
> > On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
> >
> >> +1. Annotation is a good way to deliver such information.
> >>
> >>
> >>
> >> On 4/17/06, Paulex Yang <pa...@gmail.com> wrote:
> >>
> >>> I consider the isHarmony() should be metadata, I have concerns to hard
> >>> code in test cases. How about mark these test cases as
> "non-compatible"
> >>> by annotation, by naming convention or more directly by some list, and
> >>> use test script to handle them?
> >>>
> >>>> --
> >>>> Anton Avtamonov,
> >>>> 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
> >>>>
> >>>>
> >>>>
> >>>>
> >>> --
> >>> Paulex Yang
> >>> China Software Development Lab
> >>> IBM
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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
> >>>
> >>>
> >>>
> >> --
> >> Andrew Zhang
> >> China Software Development Lab, IBM
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
> >
>
>
> --
> Paulex Yang
> China Software Development Lab
> IBM
>
>
>


--
Sergey Soldatov
Intel Middleware Products Division

Re: should strings in exceptions match the reference implementation?

Posted by Paulex Yang <pa...@gmail.com>.
Anton Avtamonov wrote:
> I also agree.
> The only 'requirement' I would add is that it should be possible to do
> such mark-up on per-check basis rather than per-test_method or even
> per-test_class basic. Because each testMehtod() may have several
> checks only few of them will be harmony-dependent.
>   
Wow....you are much more ambitious than me! ;-) 

Quick searching Ant's reference, and I only found the exclude support on 
per-class basis. Any potential to use Ant without programming to support 
filter like this?

If programming based on annotation, how about writing some APT processor 
to generate Harmony specific test suites/RI compatibility test 
suites/excluded tests list?

> --
> Anton Avtamonov,
> Intel Middleware Products Division
>
>
> On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
>   
>> +1. Annotation is a good way to deliver such information.
>>
>>
>>
>> On 4/17/06, Paulex Yang <pa...@gmail.com> wrote:
>>     
>>> I consider the isHarmony() should be metadata, I have concerns to hard
>>> code in test cases. How about mark these test cases as "non-compatible"
>>> by annotation, by naming convention or more directly by some list, and
>>> use test script to handle them?
>>>       
>>>> --
>>>> Anton Avtamonov,
>>>> 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
>>>>
>>>>
>>>>
>>>>         
>>> --
>>> Paulex Yang
>>> China Software Development Lab
>>> IBM
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
>>>       
>> --
>> Andrew Zhang
>> China Software Development Lab, IBM
>>
>>
>>     
>
> ---------------------------------------------------------------------
> 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
>
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
I also agree.
The only 'requirement' I would add is that it should be possible to do
such mark-up on per-check basis rather than per-test_method or even
per-test_class basic. Because each testMehtod() may have several
checks only few of them will be harmony-dependent.

--
Anton Avtamonov,
Intel Middleware Products Division


On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
> +1. Annotation is a good way to deliver such information.
>
>
>
> On 4/17/06, Paulex Yang <pa...@gmail.com> wrote:
> >
> > I consider the isHarmony() should be metadata, I have concerns to hard
> > code in test cases. How about mark these test cases as "non-compatible"
> > by annotation, by naming convention or more directly by some list, and
> > use test script to handle them?
> > > --
> > > Anton Avtamonov,
> > > 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
> > >
> > >
> > >
> >
> >
> > --
> > Paulex Yang
> > China Software Development Lab
> > IBM
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
>
> --
> Andrew Zhang
> China Software Development Lab, IBM
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Andrew Zhang <zh...@gmail.com>.
+1. Annotation is a good way to deliver such information.



On 4/17/06, Paulex Yang <pa...@gmail.com> wrote:
>
> I consider the isHarmony() should be metadata, I have concerns to hard
> code in test cases. How about mark these test cases as "non-compatible"
> by annotation, by naming convention or more directly by some list, and
> use test script to handle them?
> > --
> > Anton Avtamonov,
> > 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
> >
> >
> >
>
>
> --
> Paulex Yang
> China Software Development Lab
> IBM
>
>
>
> ---------------------------------------------------------------------
> 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
>
>


--
Andrew Zhang
China Software Development Lab, IBM

Re: should strings in exceptions match the reference implementation?

Posted by Paulex Yang <pa...@gmail.com>.
Anton Avtamonov wrote:
> On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
>   
>> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
>>     
>>> Well, not completely agree. I RI has BUG, I agree to have
>>> corresponding Harmony test failing. However do you think that
>>> different exception messges say is a good reason to have failures? I
>>> don't think so. Just a minor differemce which can be 'formally
>>> documented' by using isHarmony() is tests.
>>>       
>> I agree with you that different exception messages are not failures. So in
>> my opnion, we'd better avoid such test cases.
>> If some exception messages are really very important to developers ( I don't
>> have any idea about such Exception classes),
>> I think RI should contain similiar information so that we can write some
>> test cases, which both RI and Harmony could pass, by verifying keywords
>> instead.
>> If "isHarmony()" is used, then what's the expected message? I don't think
>> there's a "Harmony exception message spec" :-)
>> People may argue which message is best or more meanfuling :)
>>     
>
> As I said already I also not sure if we really need those test cases.
> And I also would like to avoid them when possible. What I vote for is
> that if we still have to test such things (not only messages, maybe
> something else) we should not have failing tests on this.
>
> Besides, we decided to document "desired" deviations via JIRA. My
> point here is that all such deviations also should not fail on RI.
> Just because failure should indicate something was broken. No need to
> indicate this on 'known' places. For 'known' deviations we may also
> use isHarmony() add reference (in comment) to the corresponding JIRA
> issue.
>
> I proposed isHarmony() just because I don't know the better way to
> avoid failures and 'formally' document deviations.
>   
I consider the isHarmony() should be metadata, I have concerns to hard 
code in test cases. How about mark these test cases as "non-compatible" 
by annotation, by naming convention or more directly by some list, and 
use test script to handle them?
> --
> Anton Avtamonov,
> 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
>
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> >
> > Well, not completely agree. I RI has BUG, I agree to have
> > corresponding Harmony test failing. However do you think that
> > different exception messges say is a good reason to have failures? I
> > don't think so. Just a minor differemce which can be 'formally
> > documented' by using isHarmony() is tests.
>
>
> I agree with you that different exception messages are not failures. So in
> my opnion, we'd better avoid such test cases.
> If some exception messages are really very important to developers ( I don't
> have any idea about such Exception classes),
> I think RI should contain similiar information so that we can write some
> test cases, which both RI and Harmony could pass, by verifying keywords
> instead.
> If "isHarmony()" is used, then what's the expected message? I don't think
> there's a "Harmony exception message spec" :-)
> People may argue which message is best or more meanfuling :)

As I said already I also not sure if we really need those test cases.
And I also would like to avoid them when possible. What I vote for is
that if we still have to test such things (not only messages, maybe
something else) we should not have failing tests on this.

Besides, we decided to document "desired" deviations via JIRA. My
point here is that all such deviations also should not fail on RI.
Just because failure should indicate something was broken. No need to
indicate this on 'known' places. For 'known' deviations we may also
use isHarmony() add reference (in comment) to the corresponding JIRA
issue.

I proposed isHarmony() just because I don't know the better way to
avoid failures and 'formally' document deviations.

--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
> Yes, and another problem is that it is hard to tell if the tests are currently running on Harmony or RI, even harder than to tell the platforms.

Well, actually it is quite simple :-). It is enough just to check
presence of some class which is specific for Harmony (something from
org.apache.harmony...)

> However I think Avtamonov's idea is professional, although a bit complex. :) After all, the tests, currently in Harmony, put all tests for one class in one testcase file and all tests for one method in one test method, that's why it seems write try{fail()}catch{//correct} is rather easy, right? :)


--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by "Jimmy, Jing Lv" <fi...@gmail.com>.
Andrew Zhang wrote:
> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
>   
>> Well, not completely agree. I RI has BUG, I agree to have
>> corresponding Harmony test failing. However do you think that
>> different exception messges say is a good reason to have failures? I
>> don't think so. Just a minor differemce which can be 'formally
>> documented' by using isHarmony() is tests.
>>     
>
>
> I agree with you that different exception messages are not failures. So in
> my opnion, we'd better avoid such test cases.
> If some exception messages are really very important to developers ( I don't
> have any idea about such Exception classes),
> I think RI should contain similiar information so that we can write some
> test cases, which both RI and Harmony could pass, by verifying keywords
> instead.
> If "isHarmony()" is used, then what's the expected message? I don't think
> there's a "Harmony exception message spec" :-)
>   
Yes, and another problem is that it is hard to tell if the tests are currently running on Harmony or RI, even harder than to tell the platforms.
However I think Avtamonov's idea is professional, although a bit complex. :) After all, the tests, currently in Harmony, put all tests for one class in one testcase file and all tests for one method in one test method, that's why it seems write try{fail()}catch{//correct} is rather easy, right? :)

> People may argue which message is best or more meanfuling :)
>
> Wishes,
>   
>> --
>> Anton Avtamonov,
>> 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
>>
>>
>>     
>
>
> --
> Andrew Zhang
> China Software Development Lab, IBM
>
>   


-- 

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM


Re: should strings in exceptions match the reference implementation?

Posted by Mikhail Loenko <ml...@gmail.com>.
Andrew,

2006/4/17, Andrew Zhang <zh...@gmail.com>:
> Hi, MIkhail,
>
> Thanks for the information.
>
> I took a quick look
> at  tests/api/java/util/regex/PatternSyntaxExceptionTest.
> Yes, the exception description is important to developers, however, I can't
> find the message defination in java spec.
> Am I missing something?

Being compatible to the spec is required but not sufficient for the success.
For example we follow common sense, not only the spec.

> If no,  don't you think test case such as
> "assertTrue(e.getDescription().equals("')'
> is expected."));" is a bit arbitrary?
> Is there anything wrong if the message is sth. like "Expected ")" is not
> found" ? Both are meaningful to developers.

Both messages are correct. Example of incorrect message for given password are
"Missing ;" or "Incorrect password" or etc

We have to have tests that catch improper change in the source code.
For example, if the message "Expected )" is designed then we have
to verify that exactly that message is thrown. And if someone tries
to make a change in the logic so that "Incorrect password" is thrown then
our unit test will catch it.

I know that test will not pass on RI but that is expected - it tests specifics
of Harmony implementation and should not pass on RI

Thanks,
Mikhail










>
> As Anton Avtamonov metioned(most of us agreeed) ,we should not regard such
> difference as a failure.
> Then, How to solve such problems? IMHO, we'd better avoid such cases, or at
> most, checking some key information instead of using "equals", e.g, in this
> case,
> checking whether the message is not null and contains ")" or sth like.
>
> I don't think change to code as following would solve the problem:
> if(Util.IsHarmony()){
> assertTrue(e.getDescription().equals("')' is expected."));
> }
> Then who's the rule maker? PatternSyntaxException class developers?
> Maybe if there are some spec or documents which define these messages, I'll
> support such testing way. :-)
>
> On 4/17/06, Mikhail Loenko <ml...@gmail.com> wrote:
> >
> >
> >
> > Hi Andrew
> >
> > Look at tests/api/java/util/regex/PatternSyntaxExceptionTest to get some
> > ideas. When you parse something and that something is incorrect the
> > message does matter.
> >
> > And you have a test to verify that you do not report ()s mismatch when
> > the problem is somewhere else.
> >
> > Thanks,
> > Mikhail
> >
> > > I think RI should contain similiar information so that we can write some
> > > test cases, which both RI and Harmony could pass, by verifying keywords
> > > instead.
> > > If "isHarmony()" is used, then what's the expected message? I don't
> > think
> > > there's a "Harmony exception message spec" :-)
> > > People may argue which message is best or more meanfuling :)
> > >
> > > Wishes,
> > > > --
> > > > Anton Avtamonov,
> > > > 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
> > > >
> > > >
> > >
> > >
> > > --
> > > Andrew Zhang
> > > China Software Development Lab, IBM
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
>
> --
> Andrew Zhang
> China Software Development Lab, IBM
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Andrew Zhang <zh...@gmail.com>.
Hi, MIkhail,

Thanks for the information.

I took a quick look
at  tests/api/java/util/regex/PatternSyntaxExceptionTest.
Yes, the exception description is important to developers, however, I can't
find the message defination in java spec.
Am I missing something?
If no,  don't you think test case such as
"assertTrue(e.getDescription().equals("')'
is expected."));" is a bit arbitrary?
Is there anything wrong if the message is sth. like "Expected ")" is not
found" ? Both are meaningful to developers.

As Anton Avtamonov metioned(most of us agreeed) ,we should not regard such
difference as a failure.
Then, How to solve such problems? IMHO, we'd better avoid such cases, or at
most, checking some key information instead of using "equals", e.g, in this
case,
checking whether the message is not null and contains ")" or sth like.

I don't think change to code as following would solve the problem:
if(Util.IsHarmony()){
assertTrue(e.getDescription().equals("')' is expected."));
}
Then who's the rule maker? PatternSyntaxException class developers?
Maybe if there are some spec or documents which define these messages, I'll
support such testing way. :-)

On 4/17/06, Mikhail Loenko <ml...@gmail.com> wrote:
>
>
>
> Hi Andrew
>
> Look at tests/api/java/util/regex/PatternSyntaxExceptionTest to get some
> ideas. When you parse something and that something is incorrect the
> message does matter.
>
> And you have a test to verify that you do not report ()s mismatch when
> the problem is somewhere else.
>
> Thanks,
> Mikhail
>
> > I think RI should contain similiar information so that we can write some
> > test cases, which both RI and Harmony could pass, by verifying keywords
> > instead.
> > If "isHarmony()" is used, then what's the expected message? I don't
> think
> > there's a "Harmony exception message spec" :-)
> > People may argue which message is best or more meanfuling :)
> >
> > Wishes,
> > > --
> > > Anton Avtamonov,
> > > 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
> > >
> > >
> >
> >
> > --
> > Andrew Zhang
> > China Software Development Lab, IBM
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>


--
Andrew Zhang
China Software Development Lab, IBM

Re: should strings in exceptions match the reference implementation?

Posted by Mikhail Loenko <ml...@gmail.com>.
2006/4/17, Andrew Zhang <zh...@gmail.com>:
> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> >
> > Well, not completely agree. I RI has BUG, I agree to have
> > corresponding Harmony test failing. However do you think that
> > different exception messges say is a good reason to have failures? I
> > don't think so. Just a minor differemce which can be 'formally
> > documented' by using isHarmony() is tests.
>
>
> I agree with you that different exception messages are not failures. So in
> my opnion, we'd better avoid such test cases.
> If some exception messages are really very important to developers ( I don't
> have any idea about such Exception classes),

Hi Andrew

Look at tests/api/java/util/regex/PatternSyntaxExceptionTest to get some
ideas. When you parse something and that something is incorrect the
message does matter.

And you have a test to verify that you do not report ()s mismatch when
the problem is somewhere else.

Thanks,
Mikhail

> I think RI should contain similiar information so that we can write some
> test cases, which both RI and Harmony could pass, by verifying keywords
> instead.
> If "isHarmony()" is used, then what's the expected message? I don't think
> there's a "Harmony exception message spec" :-)
> People may argue which message is best or more meanfuling :)
>
> Wishes,
> > --
> > Anton Avtamonov,
> > 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
> >
> >
>
>
> --
> Andrew Zhang
> China Software Development Lab, IBM
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Andrew Zhang <zh...@gmail.com>.
On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
>
> Well, not completely agree. I RI has BUG, I agree to have
> corresponding Harmony test failing. However do you think that
> different exception messges say is a good reason to have failures? I
> don't think so. Just a minor differemce which can be 'formally
> documented' by using isHarmony() is tests.


I agree with you that different exception messages are not failures. So in
my opnion, we'd better avoid such test cases.
If some exception messages are really very important to developers ( I don't
have any idea about such Exception classes),
I think RI should contain similiar information so that we can write some
test cases, which both RI and Harmony could pass, by verifying keywords
instead.
If "isHarmony()" is used, then what's the expected message? I don't think
there's a "Harmony exception message spec" :-)
People may argue which message is best or more meanfuling :)

Wishes,
> --
> Anton Avtamonov,
> 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
>
>


--
Andrew Zhang
China Software Development Lab, IBM

Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, Andrew Zhang <zh...@gmail.com> wrote:
> Hello, Anton,
>
> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> >
> > No, we don't need all those branches. Only the branch for Harmony.
> > Only for those cases when we DO know that we have a deviation.
> > IMHO, I prefer to have all tests passing on RI (which verify tests
> > itself) and on Harmony (which verifies Harmony).
>
>
>
>
>  But there ARE some different behaviours between Harmony and RI.
> How could our test case show or these differences if all are passed both on
> RI and Harmony?
> I think our test cases should show these differences instead of hiding them.
>
> Failures should
> > indicate something wrong with tests or with Harmony code. There should
> > be no other failures, I think.
>
>
> Yes. So I think all test cases could pass on Harmony, but on RI :-)
> Failures on RI mean RI has different understanding or behaviours compared to
> Harmony criteria, or in other words, they're wrong behaviour according to
> Harmony criteria.

Well, not completely agree. I RI has BUG, I agree to have
corresponding Harmony test failing. However do you think that
different exception messges say is a good reason to have failures? I
don't think so. Just a minor differemce which can be 'formally
documented' by using isHarmony() is tests.

Wishes,
--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Andrew Zhang <zh...@gmail.com>.
Hello, Anton,

On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
>
> No, we don't need all those branches. Only the branch for Harmony.
> Only for those cases when we DO know that we have a deviation.
> IMHO, I prefer to have all tests passing on RI (which verify tests
> itself) and on Harmony (which verifies Harmony).




 But there ARE some different behaviours between Harmony and RI.
How could our test case show or these differences if all are passed both on
RI and Harmony?
I think our test cases should show these differences instead of hiding them.

Failures should
> indicate something wrong with tests or with Harmony code. There should
> be no other failures, I think.


Yes. So I think all test cases could pass on Harmony, but on RI :-)
Failures on RI mean RI has different understanding or behaviours compared to
Harmony criteria, or in other words, they're wrong behaviour according to
Harmony criteria.

That is a bit similar to 'exclude list' we introduced: we don't want
to have failures when they are expected and predictable.


--
Anton Avtamonov,
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





--
Andrew Zhang
China Software Development Lab, IBM

Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, Mikhail Loenko <ml...@gmail.com> wrote:
> Sorry, Anton, I did not catch.
>
> Only one branch means "no branches, just one way" or does it mean
> "two different ways (one normal way and one branch)"?
>
> If we have just one way, why isHarmony() method necessary?

Mikhail,
Formally two branches :-). One to test Harmony and another to skip the check.
isHarmony() is needed to:
- perform check when it is required, i.e. on Harmony
- avoid test failure on other implementations.


--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Mikhail Loenko <ml...@gmail.com>.
Sorry, Anton, I did not catch.

Only one branch means "no branches, just one way" or does it mean
"two different ways (one normal way and one branch)"?

If we have just one way, why isHarmony() method necessary?

Thanks,
Mikhail

2006/4/17, Anton Avtamonov <an...@gmail.com>:
> On 4/17/06, Mikhail Loenko <ml...@gmail.com> wrote:
> > Why we should test something other than Harmony?
> >
> > We might run our tests on different implemetations to
> > see whether/how they differ from Harmony, but we do not need
> > special branches in our tests like
> >
> > if( isHarmony() ) {
> >  assert(harmony behavior)
> > } else if( is BEA ) {
> >  assert(BEA behav) {
> > } else if( Classpath ) {
>
> Hi Mikhail.
>
> No, we don't need all those branches. Only the branch for Harmony.
> Only for those cases when we DO know that we have a deviation.
> IMHO, I prefer to have all tests passing on RI (which verify tests
> itself) and on Harmony (which verifies Harmony). Failures should
> indicate something wrong with tests or with Harmony code. There should
> be no other failures, I think.
>
> That is a bit similar to 'exclude list' we introduced: we don't want
> to have failures when they are expected and predictable.
>
> --
> Anton Avtamonov,
> 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
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, Mikhail Loenko <ml...@gmail.com> wrote:
> Why we should test something other than Harmony?
>
> We might run our tests on different implemetations to
> see whether/how they differ from Harmony, but we do not need
> special branches in our tests like
>
> if( isHarmony() ) {
>  assert(harmony behavior)
> } else if( is BEA ) {
>  assert(BEA behav) {
> } else if( Classpath ) {

Hi Mikhail.

No, we don't need all those branches. Only the branch for Harmony.
Only for those cases when we DO know that we have a deviation.
IMHO, I prefer to have all tests passing on RI (which verify tests
itself) and on Harmony (which verifies Harmony). Failures should
indicate something wrong with tests or with Harmony code. There should
be no other failures, I think.

That is a bit similar to 'exclude list' we introduced: we don't want
to have failures when they are expected and predictable.

--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Mikhail Loenko <ml...@gmail.com>.
Why we should test something other than Harmony?

We might run our tests on different implemetations to
see whether/how they differ from Harmony, but we do not need
special branches in our tests like

if( isHarmony() ) {
  assert(harmony behavior)
} else if( is BEA ) {
  assert(BEA behav) {
} else if( Classpath ) {
...


Thanks,
Mikhail

2006/4/17, Anton Avtamonov <an...@gmail.com>:
> On 4/17/06, Mark Hindess <ma...@googlemail.com> wrote:
> > So, the second issue, should we be checking for messages/descriptions
> > in exception
> > tests, even to match what Harmony throws?  If we do then our api tests
> > wont pass on other implementations.
>
> Hi Mark,
> As I said already I don't see any huge reasons to check the messages
> (probably for not being empty only). However I suppose sometimes it
> could be necessary. I'm pretty sure we will face many cases when we
> need to deviate from RI (it was discussed already in other threads).
>
> What I propose is to use for tests some utility method like
> isHarmony(). It will act as a 'formal' indicator of all our
> deviations.
>
> For this particular situation is should be something like:
> if (TestUtilities.isHarmony()) {
>    assertEquals("some message", e.getMessage())
> }
>
>  What do you think?
>
> --
> Anton Avtamonov,
> 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
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, Mikhail Loenko <ml...@gmail.com> wrote:
<SNIP>

> Why it is that complicated?
>
> Why one have jump over utility methods in different classes or even folders to
> understand what a 5-line test does?
>
> testSomething() throw OtherException {
>        try {
>            ec.do_something_exceptional();
>            fail("NullPointerException was not thrown!");
>        } catch (NullPointerException e) {
>            //expected
>        }
> }
>
> Let's keep simple things simple

Actually, it is not complicated. Because in the 'client' code you will
have only small and intention-revealing checkes like:

        testExceptionalCase(new NullPointerCase() {
            public void exceptionalAction() throws Exception {
            }
        });

As I told that is well fits into OO conept and garantee you from not
loosing any checks. Besides, it avoid duplication since you write only
absolutely necessary code, not repeating
try {
  ...
  fail(blah-blah-blah)
}
each time...
If you need to check a message you have just to mention it is the constructor...

It doesn't pretend to be the best choice. As I mantioned it was just
how I do that. If you don't find this approach convenient and
duplication-free don't use it :-).

Wishes,
--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Mikhail Loenko <ml...@gmail.com>.
2006/4/17, Anton Avtamonov <an...@gmail.com>:
> In addition, I want to share what I do when testing exceptions.
>
> I created the following basic abstract class:
>
>    protected abstract class ExceptionalCase {
>        private Class clazz;
>        private String msg;
>
>        public abstract void exceptionalAction() throws Exception;
>
>        public ExceptionalCase() {
>        }
>
>        public ExceptionalCase(String msg, Class clazz) {
>            this.msg = msg;
>            this.clazz = clazz;
>        }
>
>        public Class expectedExceptionClass() {
>            return clazz;
>        }
>
>        public String expectedExceptionMessage() {
>            return msg;
>        }
>    }
>
>
> and the following utility test method:
>
>    protected void testExceptionalCase(final ExceptionalCase ec) {
>        try {
>            ec.exceptionalAction();
>            fail("Exceptional case was not detected!");
>        } catch (final Exception e) {
>            if (ec.expectedExceptionClass() != null) {
>                if
> (!ec.expectedExceptionClass().isAssignableFrom(e.getClass())) {
>                    fail("Exception of wrong type " + e.getClass() + "
> is produced!");
>                }
>            }


Why it is that complicated?

Why one have jump over utility methods in different classes or even folders to
understand what a 5-line test does?

testSomething() throw OtherException {
        try {
            ec.do_something_exceptional();
            fail("NullPointerException was not thrown!");
        } catch (NullPointerException e) {
            //expected
        }
}

Let's keep simple things simple

Thanks,
Mikhail

>            if (ec.expectedExceptionMessage() != null) {
>                assertEquals("Wrong exception message",
> ec.expectedExceptionMessage(),
>                             e.getMessage());
>            }
>        }
>    }
>
>
> Besides, I created several 'concrete' ExceptionalCases like:
>
>    protected abstract class NullPointerCase extends ExceptionalCase {
>        public Class expectedExceptionClass() {
>            return NullPointerException.class;
>        }
>    }
>
> So, every time when I want to test that "NPE and only NPE" is produced
> I do the following:
>
>        testExceptionalCase(new NullPointerCase() {
>            public void exceptionalAction() throws Exception {
>                //some action which should produce NPE
>            }
>        });
>
> It doesn't care about the message.
>
> If I need to test some particular message as well as type of exception
> I should either override expectedExceptionMessage() or use an
> appropriate constructor to create ExceptionalCase like:
>
>        testExceptionalCase(new ExceptionalCase("expected message",
> NullPointerException.class) {
>            public void exceptionalAction() throws Exception {
>                //some action which should produce NPE
>            }
>        });
>
> I believe that is convenient and Object-Oriented approach.
>
> Wishes,
> --
> Anton Avtamonov,
> Intel Middleware Products Division
>
>
> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> > On 4/17/06, Mark Hindess <ma...@googlemail.com> wrote:
> > > So, the second issue, should we be checking for messages/descriptions
> > > in exception
> > > tests, even to match what Harmony throws?  If we do then our api tests
> > > wont pass on other implementations.
> >
> > Hi Mark,
> > As I said already I don't see any huge reasons to check the messages
> > (probably for not being empty only). However I suppose sometimes it
> > could be necessary. I'm pretty sure we will face many cases when we
> > need to deviate from RI (it was discussed already in other threads).
> >
> > What I propose is to use for tests some utility method like
> > isHarmony(). It will act as a 'formal' indicator of all our
> > deviations.
> >
> > For this particular situation is should be something like:
> > if (TestUtilities.isHarmony()) {
> >    assertEquals("some message", e.getMessage())
> > }
> >
> >  What do you think?
> >
> > --
> > Anton Avtamonov,
> > 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
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
In addition, I want to share what I do when testing exceptions.

I created the following basic abstract class:

    protected abstract class ExceptionalCase {
        private Class clazz;
        private String msg;

        public abstract void exceptionalAction() throws Exception;

        public ExceptionalCase() {
        }

        public ExceptionalCase(String msg, Class clazz) {
            this.msg = msg;
            this.clazz = clazz;
        }

        public Class expectedExceptionClass() {
            return clazz;
        }

        public String expectedExceptionMessage() {
            return msg;
        }
    }


and the following utility test method:

    protected void testExceptionalCase(final ExceptionalCase ec) {
        try {
            ec.exceptionalAction();
            fail("Exceptional case was not detected!");
        } catch (final Exception e) {
            if (ec.expectedExceptionClass() != null) {
                if
(!ec.expectedExceptionClass().isAssignableFrom(e.getClass())) {
                    fail("Exception of wrong type " + e.getClass() + "
is produced!");
                }
            }
            if (ec.expectedExceptionMessage() != null) {
                assertEquals("Wrong exception message",
ec.expectedExceptionMessage(),
                             e.getMessage());
            }
        }
    }


Besides, I created several 'concrete' ExceptionalCases like:

    protected abstract class NullPointerCase extends ExceptionalCase {
        public Class expectedExceptionClass() {
            return NullPointerException.class;
        }
    }

So, every time when I want to test that "NPE and only NPE" is produced
I do the following:

        testExceptionalCase(new NullPointerCase() {
            public void exceptionalAction() throws Exception {
                //some action which should produce NPE
            }
        });

It doesn't care about the message.

If I need to test some particular message as well as type of exception
I should either override expectedExceptionMessage() or use an
appropriate constructor to create ExceptionalCase like:

        testExceptionalCase(new ExceptionalCase("expected message",
NullPointerException.class) {
            public void exceptionalAction() throws Exception {
                //some action which should produce NPE
            }
        });

I believe that is convenient and Object-Oriented approach.

Wishes,
--
Anton Avtamonov,
Intel Middleware Products Division


On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> On 4/17/06, Mark Hindess <ma...@googlemail.com> wrote:
> > So, the second issue, should we be checking for messages/descriptions
> > in exception
> > tests, even to match what Harmony throws?  If we do then our api tests
> > wont pass on other implementations.
>
> Hi Mark,
> As I said already I don't see any huge reasons to check the messages
> (probably for not being empty only). However I suppose sometimes it
> could be necessary. I'm pretty sure we will face many cases when we
> need to deviate from RI (it was discussed already in other threads).
>
> What I propose is to use for tests some utility method like
> isHarmony(). It will act as a 'formal' indicator of all our
> deviations.
>
> For this particular situation is should be something like:
> if (TestUtilities.isHarmony()) {
>    assertEquals("some message", e.getMessage())
> }
>
>  What do you think?
>
> --
> Anton Avtamonov,
> 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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, Mark Hindess <ma...@googlemail.com> wrote:
> So, the second issue, should we be checking for messages/descriptions
> in exception
> tests, even to match what Harmony throws?  If we do then our api tests
> wont pass on other implementations.

Hi Mark,
As I said already I don't see any huge reasons to check the messages
(probably for not being empty only). However I suppose sometimes it
could be necessary. I'm pretty sure we will face many cases when we
need to deviate from RI (it was discussed already in other threads).

What I propose is to use for tests some utility method like
isHarmony(). It will act as a 'formal' indicator of all our
deviations.

For this particular situation is should be something like:
if (TestUtilities.isHarmony()) {
    assertEquals("some message", e.getMessage())
}

 What do you think?

--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Mikhail Loenko <ml...@gmail.com>.
I think we may have this kind of tests.

It is not a problem if we do not pass on other implementations -
we will have a number of test types and some of them will stick
to our implementation. it is OK. So if the message in exception is
important (e.g. IMHO text for an NPE message in a one-argument
function is doubtfully important) then it is better to have a test for it.

Thanks,
Mikhail

2006/4/17, Mark Hindess <ma...@googlemail.com>:
> Ok.  I think it's a little unfortunate for our users that we can't
> match error messages but you are probably correct about them being
> copyright.
>
> So, the second issue, should we be checking for messages/descriptions
> in exception
> tests, even to match what Harmony throws?  If we do then our api tests
> wont pass on other implementations.
>
> Regards,
>  Mark.
>
> On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> > On 4/17/06, LvJimmy,Jing <fi...@gmail.com> wrote:
> > > Agreed. Try some other words may be better. The only possible un-compatible
> > > with RI is that some rookie may write codes like:
> > > try{
> > >    ...
> > > }catch(Except e){
> > >    if (e.getMessage().equals(RI_String)){
> > >        dosomething;
> > >    }
> > > }
> > > But this kind of code is properly unstable and unacceptable,right?
> >
> > Agree. I expect there is no or almost no client applications doing
> > that. I think we shouldn't be message-compatible. Otherwise we would
> > have to be compatible with localized messages as well in assumption
> > someone checks for e.getLocalizedMessage() :-).
> >
> > --
> > Anton Avtamonov,
> > 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
> >
> >
>
>
> --
> Mark Hindess <ma...@googlemail.com>
> IBM Java Technology Centre, UK.
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Mark Hindess <ma...@googlemail.com>.
Ok.  I think it's a little unfortunate for our users that we can't
match error messages but you are probably correct about them being
copyright.

So, the second issue, should we be checking for messages/descriptions
in exception
tests, even to match what Harmony throws?  If we do then our api tests
wont pass on other implementations.

Regards,
 Mark.

On 4/17/06, Anton Avtamonov <an...@gmail.com> wrote:
> On 4/17/06, LvJimmy,Jing <fi...@gmail.com> wrote:
> > Agreed. Try some other words may be better. The only possible un-compatible
> > with RI is that some rookie may write codes like:
> > try{
> >    ...
> > }catch(Except e){
> >    if (e.getMessage().equals(RI_String)){
> >        dosomething;
> >    }
> > }
> > But this kind of code is properly unstable and unacceptable,right?
>
> Agree. I expect there is no or almost no client applications doing
> that. I think we shouldn't be message-compatible. Otherwise we would
> have to be compatible with localized messages as well in assumption
> someone checks for e.getLocalizedMessage() :-).
>
> --
> Anton Avtamonov,
> 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
>
>


--
Mark Hindess <ma...@googlemail.com>
IBM Java Technology Centre, UK.

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/17/06, LvJimmy,Jing <fi...@gmail.com> wrote:
> Agreed. Try some other words may be better. The only possible un-compatible
> with RI is that some rookie may write codes like:
> try{
>    ...
> }catch(Except e){
>    if (e.getMessage().equals(RI_String)){
>        dosomething;
>    }
> }
> But this kind of code is properly unstable and unacceptable,right?

Agree. I expect there is no or almost no client applications doing
that. I think we shouldn't be message-compatible. Otherwise we would
have to be compatible with localized messages as well in assumption
someone checks for e.getLocalizedMessage() :-).

--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by LvJimmy,Jing <fi...@gmail.com>.
2006/4/16, Mikhail Loenko <ml...@gmail.com>:
>
> Are those strings copyrighted? I mean we obviously cannot copy-paste
> spec to the javadoc comments of our code, and we probably cannot
> copy-paste RI's messages as well.


Agreed. Try some other words may be better. The only possible un-compatible
with RI is that some rookie may write codes like:
try{
    ...
}catch(Except e){
    if (e.getMessage().equals(RI_String)){
        dosomething;
    }
}
But this kind of code is properly unstable and unacceptable,right?

Thanks,
> Mikhail
>
> 2006/4/16, Nathan Beyer <nb...@kc.rr.com>:
> > This seems overly excessive and I'm fairly sure that other JREs don't
> match
> > every message of every exception in the RI.
> >
> > I'm not opposed to matching messages to help consistency and debugging,
> but
> > I just don't want it to be a dictate for development and testing. The
> only
> > exception, no pun intended, to this would be if the specification
> defines a
> > format for the message and thus making it an explicit part of the API.
> >
> > > -----Original Message-----
> > > From: Mark Hindess [mailto:mark.hindess@googlemail.com]
> > > Sent: Saturday, April 15, 2006 2:44 PM
> > > To: Harmony Dev
> > > Subject: should strings in exceptions match the reference
> implementation?
> > >
> > > Another thing that came up when looking at PatternSyntaxExceptionTest
> > > (HARMONY-352) was that the test was testing for the strings in
> > > exceptions.  Since these were testing for strings not in the
> exceptions
> > > thrown by the new implementation (nor by the reference
> > > implementation), I thought about removing the tests and just ignoring
> > > the strings.  But then...
> > >
> > > I remembered that two days ago I had solved a problem with tests
> > > failing on our windows build machine [0], by doing a google search for
> > > the exact string in the exception that was being thrown.  It would
> > > have been much harder to solve if the string didn't match the string
> > > thrown by the reference implementation.  So, I think we should try to
> > > match strings in exceptions because it will help our users when trying
> > > to debug problems.  Currently we don't in very many cases.
> > >
> > > What do other people think?
> > >
> > > Obviously we will have to match them if we are going to test for them
> > > in our API tests or they wont pass when run against a reference
> > > implementation.
> > >
> > > My patch for the PatternSyntaxExceptionTest has the string tests with
> > > the expected values set to the values from the exceptions trhown by
> > > the RI.  But I've commented them out since harmony strings don't
> > > currently match and since the strings probably should have different
> > > line endings on different platforms.
> > >
> > > Regards,
> > >  Mark.
> > >
> > > [0] SystemRoot not being set in the environment when called from my
> > >     ant task.
> > >
> > > --
> > > Mark Hindess <ma...@googlemail.com>
> > > IBM Java Technology Centre, UK.
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>


--

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

Re: should strings in exceptions match the reference implementation?

Posted by Mikhail Loenko <ml...@gmail.com>.
Are those strings copyrighted? I mean we obviously cannot copy-paste
spec to the javadoc comments of our code, and we probably cannot
copy-paste RI's messages as well.

Thanks,
Mikhail

2006/4/16, Nathan Beyer <nb...@kc.rr.com>:
> This seems overly excessive and I'm fairly sure that other JREs don't match
> every message of every exception in the RI.
>
> I'm not opposed to matching messages to help consistency and debugging, but
> I just don't want it to be a dictate for development and testing. The only
> exception, no pun intended, to this would be if the specification defines a
> format for the message and thus making it an explicit part of the API.
>
> > -----Original Message-----
> > From: Mark Hindess [mailto:mark.hindess@googlemail.com]
> > Sent: Saturday, April 15, 2006 2:44 PM
> > To: Harmony Dev
> > Subject: should strings in exceptions match the reference implementation?
> >
> > Another thing that came up when looking at PatternSyntaxExceptionTest
> > (HARMONY-352) was that the test was testing for the strings in
> > exceptions.  Since these were testing for strings not in the exceptions
> > thrown by the new implementation (nor by the reference
> > implementation), I thought about removing the tests and just ignoring
> > the strings.  But then...
> >
> > I remembered that two days ago I had solved a problem with tests
> > failing on our windows build machine [0], by doing a google search for
> > the exact string in the exception that was being thrown.  It would
> > have been much harder to solve if the string didn't match the string
> > thrown by the reference implementation.  So, I think we should try to
> > match strings in exceptions because it will help our users when trying
> > to debug problems.  Currently we don't in very many cases.
> >
> > What do other people think?
> >
> > Obviously we will have to match them if we are going to test for them
> > in our API tests or they wont pass when run against a reference
> > implementation.
> >
> > My patch for the PatternSyntaxExceptionTest has the string tests with
> > the expected values set to the values from the exceptions trhown by
> > the RI.  But I've commented them out since harmony strings don't
> > currently match and since the strings probably should have different
> > line endings on different platforms.
> >
> > Regards,
> >  Mark.
> >
> > [0] SystemRoot not being set in the environment when called from my
> >     ant task.
> >
> > --
> > Mark Hindess <ma...@googlemail.com>
> > IBM Java Technology Centre, UK.
> >
> > ---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Geir Magnusson Jr <ge...@pobox.com>.

Chris Gray wrote:
> On Tuesday 18 April 2006 01:34, Geir Magnusson Jr wrote:
> 
>> Really?  Every other JRE uses the classlibrary from sun.
> 
> Of the many open-source runtimes, none uses Sun's class library; 

I'm aware of that - that's why we're here.  But as I understand it, 
there are no complete open source runtimes (SE anyway...)

> almost all 
> use Classpath. Among non-open source products, J9 has its own libraries,  and
> I believe this is also true of many other embedded runtimes, e.g. Aonix's 
> PERC (other companies which used to have their own class libraries are now 
> Sun licencees, but are probably still using a lot of their own code for 
> luni). Aicas sell a closed-source runtime which uses Classpath for its Java 
> libraries.

That's interesting...

geir

> 

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Chris Gray <ch...@kiffer.be>.
On Tuesday 18 April 2006 01:34, Geir Magnusson Jr wrote:

> Really?  Every other JRE uses the classlibrary from sun.

Of the many open-source runtimes, none uses Sun's class library; almost all 
use Classpath. Among non-open source products, J9 has its own libraries, and 
I believe this is also true of many other embedded runtimes, e.g. Aonix's 
PERC (other companies which used to have their own class libraries are now 
Sun licencees, but are probably still using a lot of their own code for 
luni). Aicas sell a closed-source runtime which uses Classpath for its Java 
libraries.

-- 
Chris Gray        /k/ Embedded Java Solutions      BE0503765045
Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
chris.gray@kiffer.be                             +32 3 216 0369


---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Geir Magnusson Jr <ge...@pobox.com>.
This aspect is easy.  I'll just ask Sun.

geir


Anton Avtamonov wrote:
> On 4/18/06, Mark Hindess <ma...@googlemail.com> wrote:
>> I thought my first message in this thread made this clear but obviously not.
>>
>> I'm not suggesting that code would care if the exception messages are
>> identical.  I was suggesting that it is probably now quite common for
>> users to type error messages straight in to google.  Therefore having
>> messages match those of existing implementations would help our users
>> find the cause of an exception.
> 
> Yes, right. I saw several times like people did that and even did by
> myself for javac.
> 
> If I remember we decided not to copy the mesages because it is
> *possibly* a legal isssue and maybe copyrightable. Is it possible to
> ask apache legal? Probably the answer will solve our problems :-).
> 
> Wishes,
> --
> Anton Avtamonov,
> 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
> 
> 

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by "Jimmy, Jing Lv" <fi...@gmail.com>.
 >Anton Avtamonov wrote:
> On 4/18/06, Mark Hindess <ma...@googlemail.com> wrote:
>> I thought my first message in this thread made this clear but obviously not.
>>
>> I'm not suggesting that code would care if the exception messages are
>> identical.  I was suggesting that it is probably now quite common for
>> users to type error messages straight in to google.  Therefore having
>> messages match those of existing implementations would help our users
>> find the cause of an exception.
> 

Er... that really matters. So shall we start write a list of such 
messages and give a little more information, and then put it on webpages 
or wiki, and then as a result, every user of Harmony get a result if he 
google? There can be more solutions.

However it can not be the reason that we should match the string with 
RI, as many user also copy exception track trace to google, so there'll 
be com.ibm... or com.sun... or something else if they use RI, Harmony 
shall never match them, right? :)

> Yes, right. I saw several times like people did that and even did by
> myself for javac.
> 
> If I remember we decided not to copy the mesages because it is
> *possibly* a legal isssue and maybe copyrightable. Is it possible to
> ask apache legal? Probably the answer will solve our problems :-).

That's the point. Agree.

> 
> Wishes,
> --
> Anton Avtamonov,
> 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
> 
> 


-- 

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Anton Avtamonov <an...@gmail.com>.
On 4/18/06, Mark Hindess <ma...@googlemail.com> wrote:
> I thought my first message in this thread made this clear but obviously not.
>
> I'm not suggesting that code would care if the exception messages are
> identical.  I was suggesting that it is probably now quite common for
> users to type error messages straight in to google.  Therefore having
> messages match those of existing implementations would help our users
> find the cause of an exception.

Yes, right. I saw several times like people did that and even did by
myself for javac.

If I remember we decided not to copy the mesages because it is
*possibly* a legal isssue and maybe copyrightable. Is it possible to
ask apache legal? Probably the answer will solve our problems :-).

Wishes,
--
Anton Avtamonov,
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


Re: should strings in exceptions match the reference implementation?

Posted by Paulex Yang <pa...@gmail.com>.
Mark Hindess wrote:
> I thought my first message in this thread made this clear but obviously not.
>
> I'm not suggesting that code would care if the exception messages are
> identical.  I was suggesting that it is probably now quite common for
> users to type error messages straight in to google.  Therefore having
> messages match those of existing implementations would help our users
> find the cause of an exception.
>   
Well, I did miss this information I think, sorry for that.

Please correct me if my experience is wrong, in C/C++ world, error 
message is very important, it is often the only information to judge 
what's going on about the mistake, because the habits of c/c++ program 
is to define list of error codes and error messages, print the message 
and exit when some error codes returned. But Java application is another 
story, error message is still important but not so significant, because 
Java has exception hierarchy, and exception type itself is 
self-descriptive in many cases(I know, I know, naughty boys like 
SQLException are not unusual, but that's mostly because it wraps error 
message from DB server). Further we have JavaDoc to describe the 
exceptional case and relative exception, even for runtime exception if 
they are not so typical and self-descriptive. So I myself have lots of 
experience to search error messages for system call/compiler/db2 even 
JVM, but IMHO I have little experience to search error message for Java 
class library.

However, I have no objection that there are exceptional case, where the 
message is very important and should at least has similar keywords with 
RI's, SQLException is a good example, but it is enough to be clear and 
concise for the majority of exception messages.

Comments?
> Regards,
>  Mark.
>
> On 4/18/06, Chris Gray <ch...@kiffer.be> wrote:
>   
>> On Tuesday 18 April 2006 09:37, Mark Hindess wrote:
>>     
>>> Are you saying that Classpath does match strings in exceptions?
>>>       
>> No. Ah, I see: the "do" in Geir's question stood for "what is Classpath's
>> policy wrt to exception messages matching those of the RI?". Then I don't
>> speak authoritatively, but I've never noticed Classpath going out of its way
>> to be compatible at this level. But then I would never write code which
>> depended on the precise contents of an exception message ...
>>
>> Sorry for the confusion,
>>
>> Chris
>>
>> --
>> Chris Gray        /k/ Embedded Java Solutions      BE0503765045
>> Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
>> chris.gray@kiffer.be                             +32 3 216 0369
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>>     
>
>
> --
> Mark Hindess <ma...@googlemail.com>
> IBM Java Technology Centre, UK.
>
> ---------------------------------------------------------------------
> 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
>
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Geir Magnusson Jr <ge...@pobox.com>.
Yes - great example.  The point is for mechanical means, but familiarity 
for users - we don't want them to be "uncomfortable" when using the 
Harmony class library - we want it to feel the same as when they use it 
from Sun...

geir


Mark Hindess wrote:
> I thought my first message in this thread made this clear but obviously not.
> 
> I'm not suggesting that code would care if the exception messages are
> identical.  I was suggesting that it is probably now quite common for
> users to type error messages straight in to google.  Therefore having
> messages match those of existing implementations would help our users
> find the cause of an exception.
> 
> Regards,
>  Mark.
> 
> On 4/18/06, Chris Gray <ch...@kiffer.be> wrote:
>> On Tuesday 18 April 2006 09:37, Mark Hindess wrote:
>>> Are you saying that Classpath does match strings in exceptions?
>> No. Ah, I see: the "do" in Geir's question stood for "what is Classpath's
>> policy wrt to exception messages matching those of the RI?". Then I don't
>> speak authoritatively, but I've never noticed Classpath going out of its way
>> to be compatible at this level. But then I would never write code which
>> depended on the precise contents of an exception message ...
>>
>> Sorry for the confusion,
>>
>> Chris
>>
>> --
>> Chris Gray        /k/ Embedded Java Solutions      BE0503765045
>> Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
>> chris.gray@kiffer.be                             +32 3 216 0369
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 
> 
> --
> Mark Hindess <ma...@googlemail.com>
> IBM Java Technology Centre, UK.
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Mark Hindess <ma...@googlemail.com>.
I thought my first message in this thread made this clear but obviously not.

I'm not suggesting that code would care if the exception messages are
identical.  I was suggesting that it is probably now quite common for
users to type error messages straight in to google.  Therefore having
messages match those of existing implementations would help our users
find the cause of an exception.

Regards,
 Mark.

On 4/18/06, Chris Gray <ch...@kiffer.be> wrote:
> On Tuesday 18 April 2006 09:37, Mark Hindess wrote:
> > Are you saying that Classpath does match strings in exceptions?
>
> No. Ah, I see: the "do" in Geir's question stood for "what is Classpath's
> policy wrt to exception messages matching those of the RI?". Then I don't
> speak authoritatively, but I've never noticed Classpath going out of its way
> to be compatible at this level. But then I would never write code which
> depended on the precise contents of an exception message ...
>
> Sorry for the confusion,
>
> Chris
>
> --
> Chris Gray        /k/ Embedded Java Solutions      BE0503765045
> Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
> chris.gray@kiffer.be                             +32 3 216 0369
>
>
> ---------------------------------------------------------------------
> 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
>
>


--
Mark Hindess <ma...@googlemail.com>
IBM Java Technology Centre, UK.

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Chris Gray <ch...@kiffer.be>.
On Tuesday 18 April 2006 09:37, Mark Hindess wrote:
> Are you saying that Classpath does match strings in exceptions?

No. Ah, I see: the "do" in Geir's question stood for "what is Classpath's 
policy wrt to exception messages matching those of the RI?". Then I don't 
speak authoritatively, but I've never noticed Classpath going out of its way 
to be compatible at this level. But then I would never write code which 
depended on the precise contents of an exception message ...

Sorry for the confusion,

Chris

-- 
Chris Gray        /k/ Embedded Java Solutions      BE0503765045
Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
chris.gray@kiffer.be                             +32 3 216 0369


---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Mark Hindess <ma...@googlemail.com>.
Are you saying that Classpath does match strings in exceptions?

-Mark.


On 4/18/06, Chris Gray <ch...@kiffer.be> wrote:
> On Tuesday 18 April 2006 04:20, Geir Magnusson Jr wrote:
>
> > Good question though - what does GNU Classpath do?
>
> What GNU Classpath "does" is the same as what the Sun class libraries do, so
> the former no more needs the latter than Apache needs IIS ...
>
> (Sorry to be playing the pedant but I do sometimes get the idea that Harmony
> is tearing ahead without ever stopping to ask about context, history, prior
> art ...)
>
> Chris
>
> --
> Chris Gray        /k/ Embedded Java Solutions      BE0503765045
> Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
> chris.gray@kiffer.be                             +32 3 216 0369
>
>
> ---------------------------------------------------------------------
> 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
>
>


--
Mark Hindess <ma...@googlemail.com>
IBM Java Technology Centre, UK.

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Geir Magnusson Jr <ge...@pobox.com>.

Chris Gray wrote:
> On Tuesday 18 April 2006 04:20, Geir Magnusson Jr wrote:
> 
>> Good question though - what does GNU Classpath do?
> 
> What GNU Classpath "does" is the same as what the Sun class libraries do, so 
> the former no more needs the latter than Apache needs IIS ...
> 
> (Sorry to be playing the pedant but I do sometimes get the idea that Harmony 
> is tearing ahead without ever stopping to ask about context, history, prior 
> art ...)

That's ridiculous.  We're very concerned about all three, and I'd argue 
this is a question of context and prior art - the question was "What 
does GNU CLasspath do wrt message strings in exceptions in terms of 
similarity to the RI?"

geir


---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Chris Gray <ch...@kiffer.be>.
On Tuesday 18 April 2006 04:20, Geir Magnusson Jr wrote:

> Good question though - what does GNU Classpath do?

What GNU Classpath "does" is the same as what the Sun class libraries do, so 
the former no more needs the latter than Apache needs IIS ...

(Sorry to be playing the pedant but I do sometimes get the idea that Harmony 
is tearing ahead without ever stopping to ask about context, history, prior 
art ...)

Chris

-- 
Chris Gray        /k/ Embedded Java Solutions      BE0503765045
Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
chris.gray@kiffer.be                             +32 3 216 0369


---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Dalibor Topic <ro...@kaffe.org>.
Geir Magnusson Jr <geir <at> pobox.com> writes:

> Good question though - what does GNU Classpath do?

Throw better exception messages, of course ;)

I don't see a specific rule regarding this in the GNU Classpath 
hackers guide [1], but as long as a specific exception message 
(format) is not mandated by the spec, we (should here, and do in 
GNU Classpath in general) take the liberty to provide (more) 
useful error messages. 

>From my experience with the RI, the exception messages tend to 
be of less then desirable utility to fix the problems that 
cause the exceptions [2], so copying them verbatim does not 
apper to be desireable to me.

Moreover, the 'search engine optimization' effect of copying 
the same error messages would seem to be easily fixeable by 
providing better error messages in ant, if I understood 
Mark's example correctly ...

So, to cut my post short, I'm with Elena on this: provide a 
useful exception message that helps the user figure out what 
the problem is.

cheers,
dalibor topic

[1] http://www.gnu.org/software/classpath/docs/hacking.html
[2] http://forums.oracle.com/forums/thread.jspa?threadID=377599&tstart=0
 for a classic example:

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

Obviously, it would be a bit more helpful to know where the system went looking
for that class, for example. So Kaffe would give you:

java.lang.ClassNotFoundException: NoSuchClass not found in
java.lang.ClassLoader$1{urls=[file:/home/topic/projects/kaffe/./], parent=null}

which is a bit more helpful.


---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Paulex Yang <pa...@gmail.com>.
Geir Magnusson Jr wrote:
>
>
> Paulex Yang wrote:
>> Geir Magnusson Jr wrote:
>>>
>>>
>>> Nathan Beyer wrote:
>>>> This seems overly excessive and I'm fairly sure that other JREs 
>>>> don't match
>>>> every message of every exception in the RI.
>>>
>>> Really?  Every other JRE uses the classlibrary from sun.  They would 
>>> have the same messages, wouldn't they?
>> I'm sure not *every*, at least GNU classpath has no chance to use 
>> classlib from Sun ;-) .
>
> It's not a JRE :)
>
> But BEA, IBM and Sun use the library from Sun. I'd bet Apple does too. 
> As far as I know, that's about it for maintream JRE/JDKs...
OK, AFAIK as a user, IBM JDK includes much class lib implementation from 
Sun, but not all, because you can see com.ibm.*** randomly from the 
stack trace:).

Anyway, it's not the key point, the key point is the what is our 
baseline considering "compatibility", I assume the baseline is to pass 
TCK and not to break existing applications. While I have no any idea 
about TCK, I believe few application depends on message, so I see no 
reason so far why we must pay great effort (even greater than exception 
type compatibility I think) to have same message with RI.

And legal issue stand out here yet another time....
>
> Good question though - what does GNU Classpath do?
>
> geir
>
>>>
>>> geir
>>>
>>>>
>>>> I'm not opposed to matching messages to help consistency and 
>>>> debugging, but
>>>> I just don't want it to be a dictate for development and testing. 
>>>> The only
>>>> exception, no pun intended, to this would be if the specification 
>>>> defines a
>>>> format for the message and thus making it an explicit part of the API.
>>>>
>>>>> -----Original Message-----
>>>>> From: Mark Hindess [mailto:mark.hindess@googlemail.com]
>>>>> Sent: Saturday, April 15, 2006 2:44 PM
>>>>> To: Harmony Dev
>>>>> Subject: should strings in exceptions match the reference 
>>>>> implementation?
>>>>>
>>>>> Another thing that came up when looking at PatternSyntaxExceptionTest
>>>>> (HARMONY-352) was that the test was testing for the strings in
>>>>> exceptions.  Since these were testing for strings not in the 
>>>>> exceptions
>>>>> thrown by the new implementation (nor by the reference
>>>>> implementation), I thought about removing the tests and just ignoring
>>>>> the strings.  But then...
>>>>>
>>>>> I remembered that two days ago I had solved a problem with tests
>>>>> failing on our windows build machine [0], by doing a google search 
>>>>> for
>>>>> the exact string in the exception that was being thrown.  It would
>>>>> have been much harder to solve if the string didn't match the string
>>>>> thrown by the reference implementation.  So, I think we should try to
>>>>> match strings in exceptions because it will help our users when 
>>>>> trying
>>>>> to debug problems.  Currently we don't in very many cases.
>>>>>
>>>>> What do other people think?
>>>>>
>>>>> Obviously we will have to match them if we are going to test for them
>>>>> in our API tests or they wont pass when run against a reference
>>>>> implementation.
>>>>>
>>>>> My patch for the PatternSyntaxExceptionTest has the string tests with
>>>>> the expected values set to the values from the exceptions trhown by
>>>>> the RI.  But I've commented them out since harmony strings don't
>>>>> currently match and since the strings probably should have different
>>>>> line endings on different platforms.
>>>>>
>>>>> Regards,
>>>>>  Mark.
>>>>>
>>>>> [0] SystemRoot not being set in the environment when called from my
>>>>>     ant task.
>>>>>
>>>>> -- 
>>>>> Mark Hindess <ma...@googlemail.com>
>>>>> IBM Java Technology Centre, UK.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
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


RE: should strings in exceptions match the reference implementation?

Posted by Nathan Beyer <nb...@kc.rr.com>.
> -----Original Message-----
> From: Geir Magnusson Jr [mailto:geir@pobox.com]
> Paulex Yang wrote:
> > Geir Magnusson Jr wrote:
> >>
> >>
> >> Nathan Beyer wrote:
> >>> This seems overly excessive and I'm fairly sure that other JREs don't
> >>> match
> >>> every message of every exception in the RI.
> >>
> >> Really?  Every other JRE uses the classlibrary from sun.  They would
> >> have the same messages, wouldn't they?
> > I'm sure not *every*, at least GNU classpath has no chance to use
> > classlib from Sun ;-) .
> 
> It's not a JRE :)
> 
> But BEA, IBM and Sun use the library from Sun. I'd bet Apple does too.
> As far as I know, that's about it for maintream JRE/JDKs...

>From my experiences with using IBM's JRE as a consumer the messages are
often similar, but they do vary noticeable. My understanding is that IBM and
BEA do get Sun's class library code, but that it's likely they branch in
significant ways and seem to, especially as the library has grown from 1.2
to 1.3 to 1.4.

Can any of the IBM Java folks comment on this topic?

>From anecdotal evidence, I've personally seen this vary as the class library
has grown, especially from 1.3 to 1.4. For example, I've witnessed
noticeable differences in exception messages with the default JAXP
implementations from IBM and Sun in the 1.4 JREs.

Other major JREs would be HP-UX JDK, OpenVMS JDK, Excelsior JET, Novell JDK
and all of the Java ME JREs as well.

> 
> Good question though - what does GNU Classpath do?
> 
> geir
> 
> >>
> >> geir
> >>
> >>>
> >>> I'm not opposed to matching messages to help consistency and
> >>> debugging, but
> >>> I just don't want it to be a dictate for development and testing. The
> >>> only
> >>> exception, no pun intended, to this would be if the specification
> >>> defines a
> >>> format for the message and thus making it an explicit part of the API.
> >>>
> >>>> -----Original Message-----
> >>>> From: Mark Hindess [mailto:mark.hindess@googlemail.com]
> >>>> Sent: Saturday, April 15, 2006 2:44 PM
> >>>> To: Harmony Dev
> >>>> Subject: should strings in exceptions match the reference
> >>>> implementation?
> >>>>
> >>>> Another thing that came up when looking at PatternSyntaxExceptionTest
> >>>> (HARMONY-352) was that the test was testing for the strings in
> >>>> exceptions.  Since these were testing for strings not in the
> exceptions
> >>>> thrown by the new implementation (nor by the reference
> >>>> implementation), I thought about removing the tests and just ignoring
> >>>> the strings.  But then...
> >>>>
> >>>> I remembered that two days ago I had solved a problem with tests
> >>>> failing on our windows build machine [0], by doing a google search
> for
> >>>> the exact string in the exception that was being thrown.  It would
> >>>> have been much harder to solve if the string didn't match the string
> >>>> thrown by the reference implementation.  So, I think we should try to
> >>>> match strings in exceptions because it will help our users when
> trying
> >>>> to debug problems.  Currently we don't in very many cases.
> >>>>
> >>>> What do other people think?
> >>>>
> >>>> Obviously we will have to match them if we are going to test for them
> >>>> in our API tests or they wont pass when run against a reference
> >>>> implementation.
> >>>>
> >>>> My patch for the PatternSyntaxExceptionTest has the string tests with
> >>>> the expected values set to the values from the exceptions trhown by
> >>>> the RI.  But I've commented them out since harmony strings don't
> >>>> currently match and since the strings probably should have different
> >>>> line endings on different platforms.
> >>>>
> >>>> Regards,
> >>>>  Mark.
> >>>>
> >>>> [0] SystemRoot not being set in the environment when called from my
> >>>>     ant task.
> >>>>
> >>>> --
> >>>> Mark Hindess <ma...@googlemail.com>
> >>>> IBM Java Technology Centre, UK.
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >>
> >>
> >
> >
> 
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Geir Magnusson Jr <ge...@pobox.com>.

Paulex Yang wrote:
> Geir Magnusson Jr wrote:
>>
>>
>> Nathan Beyer wrote:
>>> This seems overly excessive and I'm fairly sure that other JREs don't 
>>> match
>>> every message of every exception in the RI.
>>
>> Really?  Every other JRE uses the classlibrary from sun.  They would 
>> have the same messages, wouldn't they?
> I'm sure not *every*, at least GNU classpath has no chance to use 
> classlib from Sun ;-) .

It's not a JRE :)

But BEA, IBM and Sun use the library from Sun. I'd bet Apple does too. 
As far as I know, that's about it for maintream JRE/JDKs...

Good question though - what does GNU Classpath do?

geir

>>
>> geir
>>
>>>
>>> I'm not opposed to matching messages to help consistency and 
>>> debugging, but
>>> I just don't want it to be a dictate for development and testing. The 
>>> only
>>> exception, no pun intended, to this would be if the specification 
>>> defines a
>>> format for the message and thus making it an explicit part of the API.
>>>
>>>> -----Original Message-----
>>>> From: Mark Hindess [mailto:mark.hindess@googlemail.com]
>>>> Sent: Saturday, April 15, 2006 2:44 PM
>>>> To: Harmony Dev
>>>> Subject: should strings in exceptions match the reference 
>>>> implementation?
>>>>
>>>> Another thing that came up when looking at PatternSyntaxExceptionTest
>>>> (HARMONY-352) was that the test was testing for the strings in
>>>> exceptions.  Since these were testing for strings not in the exceptions
>>>> thrown by the new implementation (nor by the reference
>>>> implementation), I thought about removing the tests and just ignoring
>>>> the strings.  But then...
>>>>
>>>> I remembered that two days ago I had solved a problem with tests
>>>> failing on our windows build machine [0], by doing a google search for
>>>> the exact string in the exception that was being thrown.  It would
>>>> have been much harder to solve if the string didn't match the string
>>>> thrown by the reference implementation.  So, I think we should try to
>>>> match strings in exceptions because it will help our users when trying
>>>> to debug problems.  Currently we don't in very many cases.
>>>>
>>>> What do other people think?
>>>>
>>>> Obviously we will have to match them if we are going to test for them
>>>> in our API tests or they wont pass when run against a reference
>>>> implementation.
>>>>
>>>> My patch for the PatternSyntaxExceptionTest has the string tests with
>>>> the expected values set to the values from the exceptions trhown by
>>>> the RI.  But I've commented them out since harmony strings don't
>>>> currently match and since the strings probably should have different
>>>> line endings on different platforms.
>>>>
>>>> Regards,
>>>>  Mark.
>>>>
>>>> [0] SystemRoot not being set in the environment when called from my
>>>>     ant task.
>>>>
>>>> -- 
>>>> Mark Hindess <ma...@googlemail.com>
>>>> IBM Java Technology Centre, UK.
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 
> 

---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Paulex Yang <pa...@gmail.com>.
Geir Magnusson Jr wrote:
>
>
> Nathan Beyer wrote:
>> This seems overly excessive and I'm fairly sure that other JREs don't 
>> match
>> every message of every exception in the RI.
>
> Really?  Every other JRE uses the classlibrary from sun.  They would 
> have the same messages, wouldn't they?
I'm sure not *every*, at least GNU classpath has no chance to use 
classlib from Sun ;-) .
>
> geir
>
>>
>> I'm not opposed to matching messages to help consistency and 
>> debugging, but
>> I just don't want it to be a dictate for development and testing. The 
>> only
>> exception, no pun intended, to this would be if the specification 
>> defines a
>> format for the message and thus making it an explicit part of the API.
>>
>>> -----Original Message-----
>>> From: Mark Hindess [mailto:mark.hindess@googlemail.com]
>>> Sent: Saturday, April 15, 2006 2:44 PM
>>> To: Harmony Dev
>>> Subject: should strings in exceptions match the reference 
>>> implementation?
>>>
>>> Another thing that came up when looking at PatternSyntaxExceptionTest
>>> (HARMONY-352) was that the test was testing for the strings in
>>> exceptions.  Since these were testing for strings not in the exceptions
>>> thrown by the new implementation (nor by the reference
>>> implementation), I thought about removing the tests and just ignoring
>>> the strings.  But then...
>>>
>>> I remembered that two days ago I had solved a problem with tests
>>> failing on our windows build machine [0], by doing a google search for
>>> the exact string in the exception that was being thrown.  It would
>>> have been much harder to solve if the string didn't match the string
>>> thrown by the reference implementation.  So, I think we should try to
>>> match strings in exceptions because it will help our users when trying
>>> to debug problems.  Currently we don't in very many cases.
>>>
>>> What do other people think?
>>>
>>> Obviously we will have to match them if we are going to test for them
>>> in our API tests or they wont pass when run against a reference
>>> implementation.
>>>
>>> My patch for the PatternSyntaxExceptionTest has the string tests with
>>> the expected values set to the values from the exceptions trhown by
>>> the RI.  But I've commented them out since harmony strings don't
>>> currently match and since the strings probably should have different
>>> line endings on different platforms.
>>>
>>> Regards,
>>>  Mark.
>>>
>>> [0] SystemRoot not being set in the environment when called from my
>>>     ant task.
>>>
>>> -- 
>>> Mark Hindess <ma...@googlemail.com>
>>> IBM Java Technology Centre, UK.
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
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


Re: should strings in exceptions match the reference implementation?

Posted by Geir Magnusson Jr <ge...@pobox.com>.

Nathan Beyer wrote:
> This seems overly excessive and I'm fairly sure that other JREs don't match
> every message of every exception in the RI.

Really?  Every other JRE uses the classlibrary from sun.  They would 
have the same messages, wouldn't they?

geir

> 
> I'm not opposed to matching messages to help consistency and debugging, but
> I just don't want it to be a dictate for development and testing. The only
> exception, no pun intended, to this would be if the specification defines a
> format for the message and thus making it an explicit part of the API.
> 
>> -----Original Message-----
>> From: Mark Hindess [mailto:mark.hindess@googlemail.com]
>> Sent: Saturday, April 15, 2006 2:44 PM
>> To: Harmony Dev
>> Subject: should strings in exceptions match the reference implementation?
>>
>> Another thing that came up when looking at PatternSyntaxExceptionTest
>> (HARMONY-352) was that the test was testing for the strings in
>> exceptions.  Since these were testing for strings not in the exceptions
>> thrown by the new implementation (nor by the reference
>> implementation), I thought about removing the tests and just ignoring
>> the strings.  But then...
>>
>> I remembered that two days ago I had solved a problem with tests
>> failing on our windows build machine [0], by doing a google search for
>> the exact string in the exception that was being thrown.  It would
>> have been much harder to solve if the string didn't match the string
>> thrown by the reference implementation.  So, I think we should try to
>> match strings in exceptions because it will help our users when trying
>> to debug problems.  Currently we don't in very many cases.
>>
>> What do other people think?
>>
>> Obviously we will have to match them if we are going to test for them
>> in our API tests or they wont pass when run against a reference
>> implementation.
>>
>> My patch for the PatternSyntaxExceptionTest has the string tests with
>> the expected values set to the values from the exceptions trhown by
>> the RI.  But I've commented them out since harmony strings don't
>> currently match and since the strings probably should have different
>> line endings on different platforms.
>>
>> Regards,
>>  Mark.
>>
>> [0] SystemRoot not being set in the environment when called from my
>>     ant task.
>>
>> --
>> Mark Hindess <ma...@googlemail.com>
>> IBM Java Technology Centre, UK.
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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


RE: should strings in exceptions match the reference implementation?

Posted by Nathan Beyer <nb...@kc.rr.com>.
This seems overly excessive and I'm fairly sure that other JREs don't match
every message of every exception in the RI.

I'm not opposed to matching messages to help consistency and debugging, but
I just don't want it to be a dictate for development and testing. The only
exception, no pun intended, to this would be if the specification defines a
format for the message and thus making it an explicit part of the API.

> -----Original Message-----
> From: Mark Hindess [mailto:mark.hindess@googlemail.com]
> Sent: Saturday, April 15, 2006 2:44 PM
> To: Harmony Dev
> Subject: should strings in exceptions match the reference implementation?
> 
> Another thing that came up when looking at PatternSyntaxExceptionTest
> (HARMONY-352) was that the test was testing for the strings in
> exceptions.  Since these were testing for strings not in the exceptions
> thrown by the new implementation (nor by the reference
> implementation), I thought about removing the tests and just ignoring
> the strings.  But then...
> 
> I remembered that two days ago I had solved a problem with tests
> failing on our windows build machine [0], by doing a google search for
> the exact string in the exception that was being thrown.  It would
> have been much harder to solve if the string didn't match the string
> thrown by the reference implementation.  So, I think we should try to
> match strings in exceptions because it will help our users when trying
> to debug problems.  Currently we don't in very many cases.
> 
> What do other people think?
> 
> Obviously we will have to match them if we are going to test for them
> in our API tests or they wont pass when run against a reference
> implementation.
> 
> My patch for the PatternSyntaxExceptionTest has the string tests with
> the expected values set to the values from the exceptions trhown by
> the RI.  But I've commented them out since harmony strings don't
> currently match and since the strings probably should have different
> line endings on different platforms.
> 
> Regards,
>  Mark.
> 
> [0] SystemRoot not being set in the environment when called from my
>     ant task.
> 
> --
> Mark Hindess <ma...@googlemail.com>
> IBM Java Technology Centre, UK.
> 
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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