Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
common: prevent NPE by explict cast of (Double)double in ternary cond…
…ition Motivation: 0a3685f https://rb.dcache.org/r/13868 Introduced a null check on the value given to Double.isNaN, but neglected the fact that the second and third values of the condition did not have the same type; more precisely, the second value is a primitive and the third an object. According to https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.25.2, Java infers the type of the expression in this case to be the primitive, which a null value (third argument) cannot be unboxed to. Modification: Explicitly cast the second argument to (Double), so the type is inferred as to be Double. Result: Another NPE is eliminated: Target: master Request: 8.2 (update pull request) Request: 8.1 (update pull request) Request: 8.0 (update pull request) Request: 7.2 (update pull request) Pull-request: #6980 Pull-request: #6981 Pull-request: #6982 Pull-request: #6983 Requires-notes: no Patch: https://rb.dcache.org/r/13868/ Acked-by: Dmitry (this change)
- Loading branch information