Closed as not planned
Description
Our SAST shows possible NullPointerException in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/ir/passes/BasicCompilerPassListener.java#L45
public void endExecute(CompilerPass pass, FullInterpreterContext fic, Object data, boolean childScope) {
Long startTime = times.get(pass);
long timeTaken = startTime != null ? System.currentTimeMillis() - startTime.longValue() : -1;
...
if (startTime > 0) {
LOG.info("Finished " + pass.getLabel() + " on scope in " + timeTaken + "ms.");
} else { // Not really sure we should allow same pass to be run twice in same pass order run...too defensive?
LOG.info("Finished " + pass.getLabel() + " on scope " + fic.getScope());
}
}
If startTime
may be null, then it will cause NPE at startTime > 0
.
Maybe it is mistype and conditional should be timeTaken > 0
?
Environment Information
We are analyzing versions 9.4.x (8-12), but this problem is still in master
Expected Behavior
- No NPE at all. But it seems nobody catch it through the years, so i don't know if this Long may hold null at all
Actual Behavior
- have no tests to show this NPE, can't figure out how to make one. This is simply code analysis, that showed possible NPE
Metadata
Metadata
Assignees
Labels
No labels