The code below has been flagged as a violation by Fortify ("unreleased resource" for the lock)
try {
if (lock.tryLock(1, TimeUnit.SECONDS)) {
try {
//do something
}
finally {
lock.unlock();
}
}
catch (InterruptedException e) {
// something
}
Could you please explain why? Should there be a finally statement for the InterruptedException try/catch? I thought that the inner try would handle this case as well.