I'm trying to implement the safe locking idiom described here: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Lock.htmlBut for a conditional lockThe following code triggers squid:S2583boolean hasLock = false;try {hasLock = lock.tryLock(LOCK_WAIT, TimeUnit.MILLISECONDS);if (hasLock) {/* Do stuff */}} catch (InterruptedException ex) {throw new LockingException(LOCK_RESET_MSG + this.statID, ex);} finally {if (hasLock) {consumerLock.unlock();}}
--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/e8eC9BkJQDc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/5d97a21d-cfee-4b15-ad4d-502448839b67%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/CADpExxt%2BATeXcOxvPtW8Q%2BMQyzKmgdP7R6HA0tfKe0Wnp-hnHA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/d6658e8d-5637-4254-9002-28c492f50e11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Julien,This second example is not a FP imo : we consider method parameters should not be null, and this is the only way where this condition could be reach with a null value.
I'm looking at the first issue, but next time please don't hijack threads and open a new one. This is way easier to monitor.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/d2e5a2a9-ef0b-44c0-baea-494478aed9ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.