cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: svn commit: r123799 - /cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/co coon/components/repository/SourceRepositoryImpl.java
Date Fri, 31 Dec 2004 21:45:05 GMT
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.

Joerg

Mime
View raw message