Polishing
This commit is contained in:
parent
638d91f5f4
commit
a281d8c3fd
|
@ -695,7 +695,7 @@ public abstract class DataBufferUtils {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] delimiter() {
|
public byte[] delimiter() {
|
||||||
Assert.state(this.longestDelimiter != NO_DELIMITER, "Illegal state!");
|
Assert.state(this.longestDelimiter != NO_DELIMITER, "'delimiter' not set");
|
||||||
return this.longestDelimiter;
|
return this.longestDelimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.springframework.util.StringUtils;
|
||||||
* strongly typed accessors for specific headers, the ability to leave headers
|
* strongly typed accessors for specific headers, the ability to leave headers
|
||||||
* in a {@link Message} mutable, and the option to suppress automatic generation
|
* in a {@link Message} mutable, and the option to suppress automatic generation
|
||||||
* of {@link MessageHeaders#ID id} and {@link MessageHeaders#TIMESTAMP
|
* 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
|
* and others provide support for managing processing vs external source headers
|
||||||
* as well as protocol specific headers.
|
* as well as protocol specific headers.
|
||||||
*
|
*
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -273,7 +273,7 @@ class DefaultDatabaseClient implements DatabaseClient {
|
||||||
public DefaultGenericExecuteSpec bind(String name, Object value) {
|
public DefaultGenericExecuteSpec bind(String name, Object value) {
|
||||||
assertNotPreparedOperation();
|
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(
|
Assert.notNull(value, () -> String.format(
|
||||||
"Value for parameter %s must not be null. Use bindNull(…) instead.", name));
|
"Value for parameter %s must not be null. Use bindNull(…) instead.", name));
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ class DefaultDatabaseClient implements DatabaseClient {
|
||||||
@Override
|
@Override
|
||||||
public DefaultGenericExecuteSpec bindNull(String name, Class<?> type) {
|
public DefaultGenericExecuteSpec bindNull(String name, Class<?> type) {
|
||||||
assertNotPreparedOperation();
|
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);
|
Map<String, Parameter> byName = new LinkedHashMap<>(this.byName);
|
||||||
byName.put(name, Parameter.empty(type));
|
byName.put(name, Parameter.empty(type));
|
||||||
|
@ -449,7 +449,7 @@ class DefaultDatabaseClient implements DatabaseClient {
|
||||||
|
|
||||||
private String getRequiredSql(Supplier<String> sqlSupplier) {
|
private String getRequiredSql(Supplier<String> sqlSupplier) {
|
||||||
String sql = sqlSupplier.get();
|
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;
|
return sql;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -84,7 +84,7 @@ public class PassThroughFilterChain implements FilterChain {
|
||||||
this.filter.doFilter(request, response, this.nextFilterChain);
|
this.filter.doFilter(request, response, this.nextFilterChain);
|
||||||
}
|
}
|
||||||
else {
|
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);
|
this.servlet.service(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -84,7 +84,7 @@ public class PassThroughFilterChain implements FilterChain {
|
||||||
this.filter.doFilter(request, response, this.nextFilterChain);
|
this.filter.doFilter(request, response, this.nextFilterChain);
|
||||||
}
|
}
|
||||||
else {
|
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);
|
this.servlet.service(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -227,7 +227,7 @@ public class ScriptTemplateView extends AbstractUrlBasedView {
|
||||||
engineCount++;
|
engineCount++;
|
||||||
}
|
}
|
||||||
Assert.isTrue(engineCount == 1,
|
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)) {
|
if (Boolean.FALSE.equals(this.sharedEngine)) {
|
||||||
Assert.isTrue(this.engine == null,
|
Assert.isTrue(this.engine == null,
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class ScriptTemplateViewTests {
|
||||||
this.view.setRenderFunction("render");
|
this.view.setRenderFunction("render");
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||||
this.view.setApplicationContext(this.context))
|
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
|
@Test // gh-23258
|
||||||
|
@ -185,7 +185,7 @@ public class ScriptTemplateViewTests {
|
||||||
this.view.setRenderFunction("render");
|
this.view.setRenderFunction("render");
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||||
this.view.setApplicationContext(this.context))
|
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
|
@Test // gh-23258
|
||||||
|
@ -195,7 +195,7 @@ public class ScriptTemplateViewTests {
|
||||||
this.view.setRenderFunction("render");
|
this.view.setRenderFunction("render");
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||||
this.view.setApplicationContext(this.context))
|
this.view.setApplicationContext(this.context))
|
||||||
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
|
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -449,7 +449,7 @@ public class MvcUriComponentsBuilder {
|
||||||
*/
|
*/
|
||||||
public static MethodArgumentBuilder fromMappingName(@Nullable UriComponentsBuilder builder, String name) {
|
public static MethodArgumentBuilder fromMappingName(@Nullable UriComponentsBuilder builder, String name) {
|
||||||
WebApplicationContext wac = getWebApplicationContext();
|
WebApplicationContext wac = getWebApplicationContext();
|
||||||
Assert.notNull(wac, "No WebApplicationContext. ");
|
Assert.notNull(wac, "No WebApplicationContext");
|
||||||
Map<String, RequestMappingInfoHandlerMapping> map = wac.getBeansOfType(RequestMappingInfoHandlerMapping.class);
|
Map<String, RequestMappingInfoHandlerMapping> map = wac.getBeansOfType(RequestMappingInfoHandlerMapping.class);
|
||||||
List<HandlerMethod> handlerMethods = null;
|
List<HandlerMethod> handlerMethods = null;
|
||||||
for (RequestMappingInfoHandlerMapping mapping : map.values()) {
|
for (RequestMappingInfoHandlerMapping mapping : map.values()) {
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.web.servlet.mvc.method.annotation;
|
package org.springframework.web.servlet.mvc.method.annotation;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -258,7 +258,7 @@ public class ScriptTemplateView extends AbstractUrlBasedView {
|
||||||
engineCount++;
|
engineCount++;
|
||||||
}
|
}
|
||||||
Assert.isTrue(engineCount == 1,
|
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)) {
|
if (Boolean.FALSE.equals(this.sharedEngine)) {
|
||||||
Assert.isTrue(this.engine == null,
|
Assert.isTrue(this.engine == null,
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class ScriptTemplateViewTests {
|
||||||
this.view.setRenderFunction("render");
|
this.view.setRenderFunction("render");
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||||
this.view.setApplicationContext(this.wac))
|
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
|
@Test // gh-23258
|
||||||
|
@ -200,7 +200,7 @@ public class ScriptTemplateViewTests {
|
||||||
this.view.setRenderFunction("render");
|
this.view.setRenderFunction("render");
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||||
this.view.setApplicationContext(this.wac))
|
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
|
@Test // gh-23258
|
||||||
|
@ -210,7 +210,7 @@ public class ScriptTemplateViewTests {
|
||||||
this.view.setRenderFunction("render");
|
this.view.setRenderFunction("render");
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||||
this.view.setApplicationContext(this.wac))
|
this.view.setApplicationContext(this.wac))
|
||||||
.withMessageContaining("You should define either 'engine', 'engineSupplier' or 'engineName'.");
|
.withMessageContaining("You should define either 'engine', 'engineSupplier', or 'engineName'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue