You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
This is another case where it may never actually be null. The times map gets populated when the compiler pass starts, so there should always be an entry for the pass there. I'm not sure the best way to deal with this since we don't have a Map type for Object to int. 🤔
Our SAST shows possible NullPointerException in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/ir/passes/BasicCompilerPassListener.java#L45
If
startTime
may be null, then it will cause NPE atstartTime > 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
Actual Behavior
The text was updated successfully, but these errors were encountered: