diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestConditionHolder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestConditionHolder.java index 3de3a9abb54..b28fef5f175 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestConditionHolder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestConditionHolder.java @@ -25,12 +25,12 @@ import javax.servlet.http.HttpServletRequest; /** * A holder for a {@link RequestCondition} useful when the type of the held * request condition is not known ahead of time - e.g. custom condition. - * - *

An implementation of {@code RequestCondition} itself, a - * {@code RequestConditionHolder} decorates the held request condition allowing - * it to be combined and compared with other custom request conditions while + * + *

An implementation of {@code RequestCondition} itself, a + * {@code RequestConditionHolder} decorates the held request condition allowing + * it to be combined and compared with other custom request conditions while * ensuring type and null safety. - * + * * @author Rossen Stoyanchev * @since 3.1 */ @@ -38,9 +38,9 @@ public final class RequestConditionHolder extends AbstractRequestCondition requestCondition) { @@ -65,7 +65,7 @@ public final class RequestConditionHolder extends AbstractRequestCondition match = (RequestCondition) condition.getMatchingCondition(request); - return new RequestConditionHolder(match); + return (match != null) ? new RequestConditionHolder(match) : null; } /** - * Compare the request conditions held by the two RequestConditionHolder + * Compare the request conditions held by the two RequestConditionHolder * instances after making sure the conditions are of the same type. * Or if one holder is empty, the other holder is preferred. */ @@ -132,5 +132,5 @@ public final class RequestConditionHolder extends AbstractRequestCondition