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

Reply via email to