ServletUriComponentsBuilder#initFromRequest can cause NPE [SPR-12723] #17320
When using ServletUriComponentsBuilder.fromCurrentServletMapping() in a test environment (and probably some others), a NullPointerException can occur in method initFromRequest(HttpServletRequest request) on line 147.
Specifically, if the HTTP servlet request returns a null scheme value, a NullPointerException can occur on the following line...
The variable names is being compared for equality to the constant string which leads to an NPE. This should either be reversed ("http".equals(scheme) / "https".equals(scheme)) or preconditions should check for this scenario earlier in the code branching.
The partial stack trace as follows:
Affects: 3.2.13, 4.1.4
Backported to: 3.2.14