<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>findbugs detects a problem in the following code:</div><div><br></div><div><div>&nbsp;&nbsp; public void clear() {</div><div>&nbsp;&nbsp; &nbsp; &nbsp;// This is expensive...</div><div>&nbsp;&nbsp; &nbsp; &nbsp;// lock all segments</div><div>&nbsp;&nbsp; &nbsp; &nbsp;for (Segment s : segments) s.lock();</div><div>&nbsp;&nbsp; &nbsp; &nbsp;try {</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for (Segment s : segments) s.locklessClear();</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; initLinks();</div><div>&nbsp;&nbsp; &nbsp; &nbsp;} finally {</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for (Segment s : segments) s.unlock();</div><div>&nbsp;&nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; }</div><div><br></div><div><br></div><div>the general description of the issue is:</div><div><h1>&nbsp;&nbsp; &nbsp; &nbsp; Method does not release lock on all paths
    </h1><p>
      This method acquires a JSR-166 (<code>java.util.concurrent</code>) lock, 
      but does not release it on all paths out of the method. In general, the 
      correct idiom for using a JSR-166 lock is:
    </p>
    <pre>    Lock l = ...;
    l.lock();
    try {
        // do something
    } finally {
        l.unlock();
    }</pre><pre><br></pre><pre>In my eyes the code is okay, am I missing something?</pre><pre><br></pre><pre>Cheers,</pre><pre>Mircea</pre>
  
</div></div></body></html>