continuum-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Venisse" <emmanuel.veni...@gmail.com>
Subject Re: svn commit: r670751 - in /continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/execution/ continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/main/java/org/apache/maven/continuum/executio
Date Tue, 24 Jun 2008 14:33:08 GMT
On Tue, Jun 24, 2008 at 3:51 PM, Brett Porter <brett@apache.org> wrote:

>
> On 24/06/2008, at 5:25 PM, Emmanuel Venisse wrote:
>
>
>>
>>
>>>
>>>  +        int i = 0;
>>>> +        while ( i <= files.size() - 1 )
>>>> +        {
>>>> +            ChangeFile file = files.get( i );
>>>> +            boolean found = false;
>>>> +            for ( String module : modules )
>>>> +            {
>>>> +                if ( file.getName().indexOf( module ) > 0 )
>>>> +                {
>>>> +                    files.remove( file );
>>>> +                    found = true;
>>>> +                    break;
>>>> +                }
>>>> +            }
>>>> +            if ( !found )
>>>> +            {
>>>> +                i++;
>>>> +            }
>>>> +            else
>>>> +            {
>>>> +                break;
>>>> +            }
>>>> +        }
>>>>
>>>>
>>> can't the i stuff be a standard for loop?
>>>
>>
>>
>> What do you mean?
>> I can't use a 'for' loop for the i stuff because in this loop I remove
>> some
>> file in the list.
>>
>
> I think that's a bug then? It will break from both loops (found = true).
>
> You probably want to use an iterator, and then use i.remove()?


I didn't see a bug in all tests I done, I know I don't have writtten junit
test and it's bad.
I'll look to refactor it with iterator


>
>
> Cheers,
> Brett
>
> --
> Brett Porter
> brett@apache.org
> http://blogs.exist.com/bporter/
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message