From f4bb8f102f55bac618503d8d611728b63942e33d Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Wed, 8 Apr 2020 21:44:49 -0400 Subject: [PATCH] Adds assertions to RewritePathGatewayFilterFactory.Config fixes gh-1436 --- .../filter/factory/RewritePathGatewayFilterFactory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/RewritePathGatewayFilterFactory.java b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/RewritePathGatewayFilterFactory.java index 1c337bef..5cc4da62 100644 --- a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/RewritePathGatewayFilterFactory.java +++ b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/RewritePathGatewayFilterFactory.java @@ -24,6 +24,7 @@ import reactor.core.publisher.Mono; import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.util.Assert; import org.springframework.web.server.ServerWebExchange; import static org.springframework.cloud.gateway.support.GatewayToStringStyler.filterToStringCreator; @@ -93,6 +94,7 @@ public class RewritePathGatewayFilterFactory } public Config setRegexp(String regexp) { + Assert.hasText(regexp, "regexp must have a value"); this.regexp = regexp; return this; } @@ -102,6 +104,7 @@ public class RewritePathGatewayFilterFactory } public Config setReplacement(String replacement) { + Assert.notNull(replacement, "replacement must not be null"); this.replacement = replacement; return this; }