aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build.gradle2
-rw-r--r--server/sonar-webserver-webapi-v2/build.gradle2
-rw-r--r--server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java11
-rw-r--r--server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java9
-rw-r--r--sonar-application/build.gradle2
5 files changed, 18 insertions, 8 deletions
diff --git a/build.gradle b/build.gradle
index 4f393ff40e9..511a6c3d91a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -528,8 +528,6 @@ subprojects {
}
dependency 'org.yaml:snakeyaml:2.3'
dependency 'org.hibernate.validator:hibernate-validator:8.0.1.Final'
- dependency 'jakarta.el:jakarta.el-api:5.0.1'
- dependency 'org.glassfish.expressly:expressly:5.0.0'
dependency 'org.kohsuke:github-api:1.326'
dependency 'org.wiremock:wiremock-standalone:3.10.0'
dependency 'org.skyscreamer:jsonassert:1.5.3'
diff --git a/server/sonar-webserver-webapi-v2/build.gradle b/server/sonar-webserver-webapi-v2/build.gradle
index 7e75b599c05..fb7b4af92e1 100644
--- a/server/sonar-webserver-webapi-v2/build.gradle
+++ b/server/sonar-webserver-webapi-v2/build.gradle
@@ -9,8 +9,6 @@ dependencies {
api 'org.springdoc:springdoc-openapi-starter-webmvc-api'
api 'org.springframework:spring-webmvc'
api 'org.hibernate.validator:hibernate-validator'
- api 'jakarta.el:jakarta.el-api'
- api 'org.glassfish.expressly:expressly'
api project(':server:sonar-db-dao')
api project(':server:sonar-webserver-common')
diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java
index 273d665e93f..84891c8f97d 100644
--- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java
+++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java
@@ -21,6 +21,9 @@ package org.sonar.server.v2.config;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
+import jakarta.validation.Validation;
+import jakarta.validation.ValidatorFactory;
+import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator;
import org.sonar.server.v2.common.RestResponseEntityExceptionHandler;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
@@ -29,7 +32,6 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.http.MediaType;
-import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -49,8 +51,11 @@ public class CommonWebConfig implements WebMvcConfigurer {
}
@Bean
- public LocalValidatorFactoryBean validator() {
- return new LocalValidatorFactoryBean();
+ public ValidatorFactory validator() {
+ return Validation.byDefaultProvider()
+ .configure()
+ .messageInterpolator(new ParameterMessageInterpolator())
+ .buildValidatorFactory();
}
@Bean
diff --git a/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java b/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java
index 8a63eaaedc7..edd3bae6e16 100644
--- a/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java
+++ b/server/sonar-webserver-webapi-v2/src/testFixtures/java/org/sonar/server/v2/api/ControllerTester.java
@@ -19,10 +19,14 @@
*/
package org.sonar.server.v2.api;
+import jakarta.validation.Validation;
+import jakarta.validation.ValidatorFactory;
import java.util.List;
+import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator;
import org.sonar.server.v2.common.RestResponseEntityExceptionHandler;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.validation.beanvalidation.SpringValidatorAdapter;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
@@ -32,8 +36,13 @@ public class ControllerTester {
}
public static MockMvc getMockMvcWithHandlerInterceptors(List<HandlerInterceptor> handlerInterceptors, Object... controllers) {
+ ValidatorFactory validatorFactory = Validation.byDefaultProvider()
+ .configure()
+ .messageInterpolator(new ParameterMessageInterpolator())
+ .buildValidatorFactory();
return MockMvcBuilders
.standaloneSetup(controllers)
+ .setValidator(new SpringValidatorAdapter(validatorFactory.getValidator()))
.setCustomHandlerMapping(() -> resolveRequestMappingHandlerMapping(handlerInterceptors))
.setControllerAdvice(new RestResponseEntityExceptionHandler())
.setUseTrailingSlashPatternMatch(true)
diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle
index 9d6902f7337..f183c409cf7 100644
--- a/sonar-application/build.gradle
+++ b/sonar-application/build.gradle
@@ -348,7 +348,7 @@ zip {
//tolerance will allow for some growth in the archive size.
def expectedSize = 830_000_000
//We set a tolerance of 15MB to avoid failing the build for small differences in the archive size.
- def tolerance = 15000000
+ def tolerance = 15_000_000
def minArchiveSize = expectedSize - tolerance
def maxArchiveSize = expectedSize + tolerance