[ https://issues.apache.org/jira/browse/ARTEMIS-1400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16158808#comment-16158808 ]
Timothy Bish commented on ARTEMIS-1400: --------------------------------------- PR submitted to cover these cases. > FindBugs warnings > ----------------- > > Key: ARTEMIS-1400 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1400 > Project: ActiveMQ Artemis > Issue Type: Bug > Affects Versions: 2.4.0 > Reporter: Jiri Danek > Priority: Minor > > Inspired by PROTON-1572, I am raising similar Jira for FindBugs issues in > Artemis. The best way to get at an up-to-date list is probably either just > run FindBugs (there are IDE plugins for ease of use) or look into Coverity > Scan results. As far as I know, anybody who requests access to Artemis > Coverity issues will promptly get it. > I noticed these two issues there, which prompted me to raise this Jira, but > there is more. Probably not serious, the dead code certainly, the other one > probably, but something that should be eventually fixed. > NetworkHealthCheck.java > https://scan7.coverity.com/reports.htm#v10043/p14213/fileInstanceId=33820734&defectInstanceId=7426786&mergedDefectId=1455416 > {noformat} > 375 private void readStream(InputStream stream, boolean error) throws > IOException { > CID 1418794: Dm: Dubious method used (FB.DM_DEFAULT_ENCODING) [select > issue] > 376 BufferedReader reader = new BufferedReader(new > InputStreamReader(stream)); > 377 > 378 String inputLine; > cond_notnull: Condition (inputLine = reader.readLine()) != null, taking > true branch. Now the value of inputLine is not null. > 379 while ((inputLine = reader.readLine()) != null) { > 380 if (error) { > notnull: At condition inputLine == null, the value of inputLine cannot > be null. > dead_error_condition: The condition inputLine == null cannot be true. > > CID 1455416: Logically dead code (DEADCODE) > dead_error_line: Execution cannot reach the expression " " inside this > statement: org.apache.activemq.artemis.... > 381 ActiveMQUtilLogger.LOGGER.failedToReadFromStream(inputLine == > null ? " " : inputLine); > 382 } else { > 383 logger.trace(inputLine); > 384 } > 385 } > 386 > 387 reader.close(); > 388 } > {noformat} > ActiveMQFilterPredicate.java > https://scan7.coverity.com/reports.htm#v10043/p14213/fileInstanceId=33820887&defectInstanceId=7427212&mergedDefectId=1455392 > {noformat} > 100 private boolean contains(Object field, Object value) { > 101 if (field == null) { > deref: Directly dereferencing value. > > CID 1455401: Dereference before null check (REVERSE_INULL) > check_after_deref: Null-checking value suggests that it may be null, but it > has already been dereferenced on all paths leading to the check. > 102 return (value.equals("") || value == null); > 103 } > 104 return field.toString().contains(value.toString()); > 105 } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)