cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <agalla...@agssa.net>
Subject Please review this code (was: svn commit: r123799 - /cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/co coon/components/repository/SourceRepositoryImpl.java)
Date Sat, 01 Jan 2005 11:59:20 GMT
On Vie, 31 de Diciembre de 2004, 15:45, Joerg Heinicke dijo:
> On 31.12.2004 18:46, Antonio Gallardo wrote:
>
>>>>                 while (iter.hasNext()) {
>>>>-                    Source child = null;
>>>>-                    try {
>>>>-                        status = remove((Source) iter.next());
>>>>-                        if (status != STATUS_OK) {
>>>>-                            return status;
>>>>-                        }
>>>>-                    }
>>>>-                    finally {
>>>>-                        if (child != null) {
>>>>-                            m_resolver.release(child);
>>>
>>>------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>>
>>>>-                        }
>>>>+                    status = remove((Source) iter.next());
>>>>+                    if (status != STATUS_OK) {
>>>>+                        return status;
>>>>                     }
>>>>                 }
>>>>             }
>>>
>>>What about releasing the Source's??
>>
>>
>> 'child' is always = null. The condition never happen to be true. Then it
>> is unnecesary code.
>
> Ah, yes, from the code it does not behave differently than before. But I
> guess it has been buggy before too. It should probably read:
>
> while (iter.hasNext()) {
>      Source child = null;
>      try {
>          child = (Source) iter.next();
>          status = remove(child);
>          if (status != STATUS_OK) {
>              return status;
>          }
>      } finally {
>          if (child != null) {
>              m_resolver.release(child);
>          }
>      }
> }
>
> This was what I had in mind when claiming about the missing release of
> the sources. Maybe somebody else (the original author?) can review it.

Yep. I hope the original author or someone with more knowledge of this
class can give us his opinion. I was just cleaning the code ;-)

Best Regards,

Antonio Gallardo
>
> Joerg
>


Mime
View raw message