From 79a78d0fa3ad96064bc2d0296461251555bee433 Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Thu, 13 Mar 2025 13:27:44 +0100 Subject: [PATCH] Revert "Merge remote-tracking branch 'origin/4.2.x'" This reverts commit b822670fdc8fe093beb7fb2c6e1e519e7f0b2f8d. --- .../cloud/openfeign/support/SpringMvcContract.java | 7 ++----- .../openfeign/support/SpringMvcContractTests.java | 13 ++++++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/support/SpringMvcContract.java b/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/support/SpringMvcContract.java index 5bf64653..9d9d7a8c 100644 --- a/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/support/SpringMvcContract.java +++ b/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/support/SpringMvcContract.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2025 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -369,10 +369,7 @@ public class SpringMvcContract extends Contract.BaseContract implements Resource data.template().query(resolve(nameValueResolver.getName()), resolve(nameValueResolver.getValue())); } else { - if (LOG.isDebugEnabled()) { - LOG.debug("Negated params are not supported by Feign and ignored during parameter processing: " - + param); - } + throw new IllegalArgumentException("Negated params are not supported: " + param); } } } diff --git a/spring-cloud-openfeign-core/src/test/java/org/springframework/cloud/openfeign/support/SpringMvcContractTests.java b/spring-cloud-openfeign-core/src/test/java/org/springframework/cloud/openfeign/support/SpringMvcContractTests.java index 0266a5ec..02219e2c 100644 --- a/spring-cloud-openfeign-core/src/test/java/org/springframework/cloud/openfeign/support/SpringMvcContractTests.java +++ b/spring-cloud-openfeign-core/src/test/java/org/springframework/cloud/openfeign/support/SpringMvcContractTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2025 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,6 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static feign.CollectionFormat.CSV; import static feign.CollectionFormat.SSV; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -510,11 +509,11 @@ class SpringMvcContractTests { } @Test - void testProcessAnnotations_ParseParams_NegatedParams() { - assertThatCode(() -> { - Method method = TestTemplate_ParseParams.class.getDeclaredMethod("negatedParams"); + void testProcessAnnotations_ParseParams_NotEqualParams() throws Exception { + assertThatIllegalArgumentException().isThrownBy(() -> { + Method method = TestTemplate_ParseParams.class.getDeclaredMethod("notEqualParams"); contract.parseAndValidateMetadata(method.getDeclaringClass(), method); - }).doesNotThrowAnyException(); + }); } @Test @@ -832,7 +831,7 @@ class SpringMvcContractTests { ResponseEntity mixParams(); @GetMapping(value = "test", params = { "p1!=1" }) - ResponseEntity negatedParams(); + ResponseEntity notEqualParams(); @GetMapping(value = "test", params = { "p1=1" }) ResponseEntity paramsAndRequestParam(@RequestParam("p2") String p2);