Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Nov 4, 2022
1 parent 638d91f commit a281d8c
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public int match(DataBuffer dataBuffer) {

@Override
public byte[] delimiter() {
Assert.state(this.longestDelimiter != NO_DELIMITER, "Illegal state!");
Assert.state(this.longestDelimiter != NO_DELIMITER, "'delimiter' not set");
return this.longestDelimiter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* strongly typed accessors for specific headers, the ability to leave headers
* in a {@link Message} mutable, and the option to suppress automatic generation
* of {@link MessageHeaders#ID id} and {@link MessageHeaders#TIMESTAMP
* timesteamp} headers. Subclasses such as {@link NativeMessageHeaderAccessor}
* timestamp} headers. Subclasses such as {@link NativeMessageHeaderAccessor}
* and others provide support for managing processing vs external source headers
* as well as protocol specific headers.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
Expand Down Expand Up @@ -273,7 +273,7 @@ public DefaultGenericExecuteSpec bindNull(int index, Class<?> type) {
public DefaultGenericExecuteSpec bind(String name, Object value) {
assertNotPreparedOperation();

Assert.hasText(name, "Parameter name must not be null or empty!");
Assert.hasText(name, "Parameter name must not be null or empty");
Assert.notNull(value, () -> String.format(
"Value for parameter %s must not be null. Use bindNull(…) instead.", name));

Expand All @@ -291,7 +291,7 @@ public DefaultGenericExecuteSpec bind(String name, Object value) {
@Override
public DefaultGenericExecuteSpec bindNull(String name, Class<?> type) {
assertNotPreparedOperation();
Assert.hasText(name, "Parameter name must not be null or empty!");
Assert.hasText(name, "Parameter name must not be null or empty");

Map<String, Parameter> byName = new LinkedHashMap<>(this.byName);
byName.put(name, Parameter.empty(type));
Expand All @@ -301,7 +301,7 @@ public DefaultGenericExecuteSpec bindNull(String name, Class<?> type) {

@Override
public DefaultGenericExecuteSpec filter(StatementFilterFunction filter) {
Assert.notNull(filter, "Statement FilterFunction must not be null");
Assert.notNull(filter, "StatementFilterFunction must not be null");
return new DefaultGenericExecuteSpec(
this.byIndex, this.byName, this.sqlSupplier, this.filterFunction.andThen(filter));
}
Expand Down Expand Up @@ -449,7 +449,7 @@ private void bindByIndex(Statement statement, Map<Integer, Parameter> byIndex) {

private String getRequiredSql(Supplier<String> sqlSupplier) {
String sql = sqlSupplier.get();
Assert.state(StringUtils.hasText(sql), "SQL returned by SQL supplier must not be empty!");
Assert.state(StringUtils.hasText(sql), "SQL returned by supplier must not be empty");
return sql;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2022 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.
Expand Down Expand Up @@ -84,7 +84,7 @@ public void doFilter(ServletRequest request, ServletResponse response) throws Se
this.filter.doFilter(request, response, this.nextFilterChain);
}
else {
Assert.state(this.servlet != null, "Neither a Filter not a Servlet set");
Assert.state(this.servlet != null, "Neither a Filter nor a Servlet has been set");
this.servlet.service(request, response);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
Expand Down Expand Up @@ -196,7 +196,7 @@ public DeferredResultProcessingInterceptor getDeferredResultInterceptor(Object k
*/
public void registerCallableInterceptor(Object key, CallableProcessingInterceptor interceptor) {
Assert.notNull(key, "Key is required");
Assert.notNull(interceptor, "CallableProcessingInterceptor is required");
Assert.notNull(interceptor, "CallableProcessingInterceptor is required");
this.callableInterceptors.put(key, interceptor);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2022 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.
Expand Down Expand Up @@ -84,7 +84,7 @@ public void doFilter(ServletRequest request, ServletResponse response) throws Se
this.filter.doFilter(request, response, this.nextFilterChain);
}
else {
Assert.state(this.servlet != null, "Neither a Filter not a Servlet set");
Assert.state(this.servlet != null, "Neither a Filter nor a Servlet has been set");
this.servlet.service(request, response);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
Expand Down Expand Up @@ -227,12 +227,12 @@ public void setApplicationContext(@Nullable ApplicationContext context) {
engineCount++;
}
Assert.isTrue(engineCount == 1,
"You should define either 'engine', 'engineSupplier' or 'engineName'.");
"You should define either 'engine', 'engineSupplier', or 'engineName'.");

if (Boolean.FALSE.equals(this.sharedEngine)) {
Assert.isTrue(this.engine == null,
"When 'sharedEngine' is set to false, you should specify the " +
"script engine using 'engineName' or 'engineSupplier' , not 'engine'.");
"script engine using 'engineName' or 'engineSupplier', not 'engine'.");
}
else if (this.engine != null) {
loadScripts(this.engine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void engineAndEngineNameBothDefined() {
this.view.setRenderFunction("render");
assertThatIllegalArgumentException().isThrownBy(() ->
this.view.setApplicationContext(this.context))
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
}

@Test // gh-23258
Expand All @@ -185,7 +185,7 @@ public void engineAndEngineSupplierBothDefined() {
this.view.setRenderFunction("render");
assertThatIllegalArgumentException().isThrownBy(() ->
this.view.setApplicationContext(this.context))
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
}

@Test // gh-23258
Expand All @@ -195,7 +195,7 @@ public void engineNameAndEngineSupplierBothDefined() {
this.view.setRenderFunction("render");
assertThatIllegalArgumentException().isThrownBy(() ->
this.view.setApplicationContext(this.context))
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
Expand Down Expand Up @@ -449,7 +449,7 @@ public static MethodArgumentBuilder fromMappingName(String mappingName) {
*/
public static MethodArgumentBuilder fromMappingName(@Nullable UriComponentsBuilder builder, String name) {
WebApplicationContext wac = getWebApplicationContext();
Assert.notNull(wac, "No WebApplicationContext. ");
Assert.notNull(wac, "No WebApplicationContext");
Map<String, RequestMappingInfoHandlerMapping> map = wac.getBeansOfType(RequestMappingInfoHandlerMapping.class);
List<HandlerMethod> handlerMethods = null;
for (RequestMappingInfoHandlerMapping mapping : map.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.springframework.web.servlet.mvc.method.annotation;


import java.io.IOException;
import java.io.OutputStream;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
Expand Down Expand Up @@ -258,12 +258,12 @@ protected void initApplicationContext(ApplicationContext context) {
engineCount++;
}
Assert.isTrue(engineCount == 1,
"You should define either 'engine', 'engineSupplier' or 'engineName'.");
"You should define either 'engine', 'engineSupplier', or 'engineName'.");

if (Boolean.FALSE.equals(this.sharedEngine)) {
Assert.isTrue(this.engine == null,
"When 'sharedEngine' is set to false, you should specify the " +
"script engine using 'engineName' or 'engineSupplier' , not 'engine'.");
"script engine using 'engineName' or 'engineSupplier', not 'engine'.");
}
else if (this.engine != null) {
loadScripts(this.engine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void engineAndEngineNameBothDefined() {
this.view.setRenderFunction("render");
assertThatIllegalArgumentException().isThrownBy(() ->
this.view.setApplicationContext(this.wac))
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
}

@Test // gh-23258
Expand All @@ -200,7 +200,7 @@ public void engineAndEngineSupplierBothDefined() {
this.view.setRenderFunction("render");
assertThatIllegalArgumentException().isThrownBy(() ->
this.view.setApplicationContext(this.wac))
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
}

@Test // gh-23258
Expand All @@ -210,7 +210,7 @@ public void engineNameAndEngineSupplierBothDefined() {
this.view.setRenderFunction("render");
assertThatIllegalArgumentException().isThrownBy(() ->
this.view.setApplicationContext(this.wac))
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
}

@Test
Expand Down

0 comments on commit a281d8c

Please sign in to comment.