You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2011/08/06 18:43:28 UTC

Do we want to break BWC in AntClassLoader$ResourceEnumeration? (was Re: DO NOT REPLY [Bug 51579] ...)

On 2011-07-29, <bu...@apache.org> wrote:

> https://issues.apache.org/bugzilla/show_bug.cgi?id=51579

The Enumeration returned by AntClassloader#getResources violates the
Enumeration contract in that getNextElement() returns null rather than
throwing a NoSuchElementException when the enumeration is exhausted.  It
has done so for ten years now.

Do we want to make it adhere to the contract or does anybody feel this
is too dangerous?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Do we want to break BWC in AntClassLoader$ResourceEnumeration? (was Re: DO NOT REPLY [Bug 51579] ...)

Posted by Jeffrey E Care <ca...@us.ibm.com>.
Stefan Bodewig <bo...@apache.org> wrote on 08/06/2011 12:43:28 PM:

> On 2011-07-29, <bu...@apache.org> wrote:
> 
> > https://issues.apache.org/bugzilla/show_bug.cgi?id=51579
> 
> The Enumeration returned by AntClassloader#getResources violates the
> Enumeration contract in that getNextElement() returns null rather than
> throwing a NoSuchElementException when the enumeration is exhausted.  It
> has done so for ten years now.
> 
> Do we want to make it adhere to the contract or does anybody feel this
> is too dangerous?

Obviously since I reported the problem I think it should be fixed. If 
Enumeration is used as intended (i.e. looping against hasMoreElements) 
then the fix is invisible; the fix only comes into play when code is 
written to the API contract for nextElement to throw an exception.

JEC

Re: Do we want to break BWC in AntClassLoader$ResourceEnumeration?

Posted by Stefan Bodewig <bo...@apache.org>.
On 2011-08-06, Conor MacNeill wrote:

> On Sun, Aug 7, 2011 at 02:43, Stefan Bodewig <bo...@apache.org> wrote:
>> On 2011-07-29, <bu...@apache.org> wrote:

>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=51579

>> The Enumeration returned by AntClassloader#getResources violates the
>> Enumeration contract in that getNextElement() returns null rather than
>> throwing a NoSuchElementException when the enumeration is exhausted.  It
>> has done so for ten years now.

>> Do we want to make it adhere to the contract or does anybody feel this
>> is too dangerous?

> I think it should probably be fixed.

Done.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Do we want to break BWC in AntClassLoader$ResourceEnumeration? (was Re: DO NOT REPLY [Bug 51579] ...)

Posted by Conor MacNeill <co...@apache.org>.
On Sun, Aug 7, 2011 at 02:43, Stefan Bodewig <bo...@apache.org> wrote:
> On 2011-07-29, <bu...@apache.org> wrote:
>
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=51579
>
> The Enumeration returned by AntClassloader#getResources violates the
> Enumeration contract in that getNextElement() returns null rather than
> throwing a NoSuchElementException when the enumeration is exhausted.  It
> has done so for ten years now.
>
> Do we want to make it adhere to the contract or does anybody feel this
> is too dangerous?
>

I think it should probably be fixed. In typical usage, the
hasMoreElements call would protect callers from encountering the
problem so it's not that dangerous to make it comply with the API. The
BWC break is relatively minor, IMHO.

Conor

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org