Add null checks for org.springframework.boot.autoconfigure.web.ServerProperties.Servlet#getContextPath()#3262
Add null checks for org.springframework.boot.autoconfigure.web.ServerProperties.Servlet#getContextPath()#3262candrews wants to merge 1 commit intospring-cloud:mainfrom
Conversation
…Properties.Servlet#getContextPath() Fixes spring-cloudgh-3259
Codecov Report
@@ Coverage Diff @@
## master #3262 +/- ##
============================================
+ Coverage 65.46% 65.95% +0.49%
- Complexity 1475 1478 +3
============================================
Files 188 188
Lines 6943 6949 +6
Branches 846 849 +3
============================================
+ Hits 4545 4583 +38
+ Misses 2085 2052 -33
- Partials 313 314 +1
Continue to review full report at Codecov.
|
|
How about a test? |
|
Ping @candrews, could you add a test? |
| public DiscoveryClientRouteLocator discoveryRouteLocator() { | ||
| return new DiscoveryClientRouteLocator(this.server.getServlet().getContextPath(), this.discovery, this.zuulProperties, | ||
| String contextPath = this.server.getServlet().getContextPath(); | ||
| if(contextPath == null) contextPath = ""; |
There was a problem hiding this comment.
This is not needed and out of scope for this PR.
| public SimpleRouteLocator simpleRouteLocator() { | ||
| return new SimpleRouteLocator(this.server.getServlet().getContextPath(), | ||
| String contextPath = this.server.getServlet().getContextPath(); | ||
| if(contextPath == null) contextPath = ""; |
There was a problem hiding this comment.
This is not needed and out of scope for this PR.
| return new PreDecorationFilter(routeLocator, this.server.getServlet().getContextPath(), this.zuulProperties, | ||
| String contextPath = this.server.getServlet().getContextPath(); | ||
| if(contextPath == null) contextPath = ""; | ||
| return new PreDecorationFilter(routeLocator, contextPath, this.zuulProperties, |
There was a problem hiding this comment.
This should be removed and a StringUtils.hasText() added here https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-zuul/src/main/java/org/springframework/cloud/netflix/zuul/filters/pre/PreDecorationFilter.java#L181
|
Ping @candrews care to continue working on this PR? |
Fixes gh-3259