Make assertion messages in CookieCsrfTokenRepository clearer

Changes assertion message format from 'X is not null' to
'X cannot be null' since this is more meaningful when the error
occurs and the message is printed in the logs.

Closes gh-9195
This commit is contained in:
Serdar Kuzucu 2020-11-14 12:40:12 +03:00 committed by Rob Winch
parent 76e117a67a
commit 48ef27b80a
1 changed files with 4 additions and 4 deletions

View File

@ -100,7 +100,7 @@ public final class CookieCsrfTokenRepository implements CsrfTokenRepository {
* provide a token
*/
public void setParameterName(String parameterName) {
Assert.notNull(parameterName, "parameterName is not null");
Assert.notNull(parameterName, "parameterName cannot be null");
this.parameterName = parameterName;
}
@ -110,7 +110,7 @@ public final class CookieCsrfTokenRepository implements CsrfTokenRepository {
* token
*/
public void setHeaderName(String headerName) {
Assert.notNull(headerName, "headerName is not null");
Assert.notNull(headerName, "headerName cannot be null");
this.headerName = headerName;
}
@ -120,7 +120,7 @@ public final class CookieCsrfTokenRepository implements CsrfTokenRepository {
* and read from
*/
public void setCookieName(String cookieName) {
Assert.notNull(cookieName, "cookieName is not null");
Assert.notNull(cookieName, "cookieName cannot be null");
this.cookieName = cookieName;
}
@ -216,7 +216,7 @@ public final class CookieCsrfTokenRepository implements CsrfTokenRepository {
* @since 5.5
*/
public void setCookieMaxAge(int cookieMaxAge) {
Assert.isTrue(cookieMaxAge != 0, "cookieMaxAge is not zero");
Assert.isTrue(cookieMaxAge != 0, "cookieMaxAge cannot be zero");
this.cookieMaxAge = cookieMaxAge;
}