From 3e9c3f32a1cddd69533815255e0b66f9325a4352 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 25 Apr 2017 08:40:39 +0200 Subject: [PATCH] SONAR-9004 Fix message --- .../org/sonar/server/authentication/JwtHttpHandler.java | 4 ++-- .../sonar/server/authentication/JwtHttpHandlerTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/authentication/JwtHttpHandler.java b/server/sonar-server/src/main/java/org/sonar/server/authentication/JwtHttpHandler.java index b2c0f837fbd..905cc015943 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/authentication/JwtHttpHandler.java +++ b/server/sonar-server/src/main/java/org/sonar/server/authentication/JwtHttpHandler.java @@ -180,11 +180,11 @@ public class JwtHttpHandler { int minutes; if (settings.hasKey(SESSION_TIMEOUT_IN_MINUTES_PROPERTY)) { minutes = settings.getInt(SESSION_TIMEOUT_IN_MINUTES_PROPERTY); - checkArgument(minutes > 0, "Property %s must be strictly positive. Got %s.", SESSION_TIMEOUT_IN_MINUTES_PROPERTY, minutes); + checkArgument(minutes > 0, "Property %s must be strictly positive. Got %s", SESSION_TIMEOUT_IN_MINUTES_PROPERTY, minutes); } else { minutes = SESSION_TIMEOUT_DEFAULT_VALUE_IN_MINUTES; } - checkArgument(minutes <= MAX_SESSION_TIMEOUT_IN_MINUTES, "Property %s must not be greater than %s. Got %s.", + checkArgument(minutes <= MAX_SESSION_TIMEOUT_IN_MINUTES, "Property %s must not be greater than 3 months (%s minutes). Got %s minutes", SESSION_TIMEOUT_IN_MINUTES_PROPERTY, MAX_SESSION_TIMEOUT_IN_MINUTES, minutes); return minutes * 60; } diff --git a/server/sonar-server/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java b/server/sonar-server/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java index 5a400fbb77e..842600bbf5c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java @@ -33,8 +33,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; -import org.sonar.api.config.Settings; import org.sonar.api.config.MapSettings; +import org.sonar.api.config.Settings; import org.sonar.api.utils.System2; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -153,7 +153,7 @@ public class JwtHttpHandlerTest { settings.setProperty("sonar.web.sessionTimeoutInMinutes", 0); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got 0."); + expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got 0"); new JwtHttpHandler(system2, dbClient, settings, jwtSerializer, jwtCsrfVerifier); } @@ -163,7 +163,7 @@ public class JwtHttpHandlerTest { settings.setProperty("sonar.web.sessionTimeoutInMinutes", -10); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got -10."); + expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got -10"); new JwtHttpHandler(system2, dbClient, settings, jwtSerializer, jwtCsrfVerifier); } @@ -173,7 +173,7 @@ public class JwtHttpHandlerTest { settings.setProperty("sonar.web.sessionTimeoutInMinutes", 4 * 30 * 24 * 60); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must not be greater than 129600. Got 172800."); + expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must not be greater than 3 months (129600 minutes). Got 172800 minutes"); new JwtHttpHandler(system2, dbClient, settings, jwtSerializer, jwtCsrfVerifier); } -- 2.39.5