Apply SingleSpaceSeparator Checkstyle module
This commit also fixes its violations. Closes gh-31469
This commit is contained in:
@@ -43,7 +43,7 @@ import javax.annotation.Nonnull;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public interface ConstructorInterceptor extends Interceptor {
|
||||
public interface ConstructorInterceptor extends Interceptor {
|
||||
|
||||
/**
|
||||
* Implement this method to perform extra treatments before and
|
||||
|
||||
@@ -307,7 +307,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
this.discoveredReturningType = ClassUtils.forName(name, getAspectClassLoader());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
throw new IllegalArgumentException("Returning name '" + name +
|
||||
throw new IllegalArgumentException("Returning name '" + name +
|
||||
"' is neither a valid argument name nor the fully-qualified " +
|
||||
"name of a Java type on the classpath. Root cause: " + ex);
|
||||
}
|
||||
@@ -342,7 +342,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
this.discoveredThrowingType = ClassUtils.forName(name, getAspectClassLoader());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
throw new IllegalArgumentException("Throwing name '" + name +
|
||||
throw new IllegalArgumentException("Throwing name '" + name +
|
||||
"' is neither a valid argument name nor the fully-qualified " +
|
||||
"name of a Java type on the classpath. Root cause: " + ex);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ class AopNamespaceHandlerEventTests {
|
||||
|
||||
private static final Class<?> CLASS = AopNamespaceHandlerEventTests.class;
|
||||
|
||||
private static final Resource CONTEXT = qualifiedResource(CLASS, "context.xml");
|
||||
private static final Resource POINTCUT_EVENTS_CONTEXT = qualifiedResource(CLASS, "pointcutEvents.xml");
|
||||
private static final Resource CONTEXT = qualifiedResource(CLASS, "context.xml");
|
||||
private static final Resource POINTCUT_EVENTS_CONTEXT = qualifiedResource(CLASS, "pointcutEvents.xml");
|
||||
private static final Resource POINTCUT_REF_CONTEXT = qualifiedResource(CLASS, "pointcutRefEvents.xml");
|
||||
private static final Resource DIRECT_POINTCUT_EVENTS_CONTEXT = qualifiedResource(CLASS, "directPointcutEvents.xml");
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(cacheNames = "secondary", key = "#a0"), @CacheEvict(cacheNames = "primary", key = "#p0 + 'A'") })
|
||||
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(cacheNames = "secondary", key = "#a0"), @CacheEvict(cacheNames = "primary", key = "#p0 + 'A'") })
|
||||
public Object multiEvict(Object arg1) {
|
||||
return this.counter.getAndIncrement();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AnnotationBeanConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void injection() {
|
||||
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class)) {
|
||||
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class)) {
|
||||
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
|
||||
assertThat(myObject.getName()).isEqualTo("Rod");
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, beanClass);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(
|
||||
beanName, beanClass, resolveConstructorArguments(args, 1, args.length));
|
||||
}
|
||||
|
||||
@@ -1161,7 +1161,7 @@ class DefaultListableBeanFactoryTests {
|
||||
assertThat(lbf.getBean("singletonObject")).isEqualTo(singletonObject);
|
||||
assertThat(test.getSpouse()).isEqualTo(singletonObject);
|
||||
|
||||
Map<?, ?> beansOfType = lbf.getBeansOfType(TestBean.class, false, true);
|
||||
Map<?, ?> beansOfType = lbf.getBeansOfType(TestBean.class, false, true);
|
||||
assertThat(beansOfType).hasSize(2);
|
||||
assertThat(beansOfType.containsValue(test)).isTrue();
|
||||
assertThat(beansOfType.containsValue(singletonObject)).isTrue();
|
||||
|
||||
@@ -218,7 +218,7 @@ class DefaultBeanRegistrationCodeFragmentsTests {
|
||||
}
|
||||
|
||||
private BeanRegistrationCodeFragments createCustomCodeFragments(RegisteredBean registeredBean, UnaryOperator<BeanRegistrationCodeFragments> customFragments) {
|
||||
BeanRegistrationAotContribution aotContribution = BeanRegistrationAotContribution.
|
||||
BeanRegistrationAotContribution aotContribution = BeanRegistrationAotContribution.
|
||||
withCustomCodeFragments(customFragments);
|
||||
BeanRegistrationCodeFragments defaultCodeFragments = createInstance(registeredBean);
|
||||
return aotContribution.customizeBeanRegistrationCodeFragments(
|
||||
|
||||
@@ -28,7 +28,7 @@ public class NullSourceExtractorTests {
|
||||
|
||||
@Test
|
||||
public void testPassThroughContract() throws Exception {
|
||||
Object source = new Object();
|
||||
Object source = new Object();
|
||||
Object extractedSource = new NullSourceExtractor().extractSource(source, null);
|
||||
assertThat(extractedSource).as("The contract of NullSourceExtractor states that the extraction *always* return null").isNull();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class PassThroughSourceExtractorTests {
|
||||
|
||||
@Test
|
||||
public void testPassThroughContract() throws Exception {
|
||||
Object source = new Object();
|
||||
Object source = new Object();
|
||||
Object extractedSource = new PassThroughSourceExtractor().extractSource(source, null);
|
||||
assertThat(extractedSource).as("The contract of PassThroughSourceExtractor states that the supplied " +
|
||||
"source object *must* be returned as-is").isSameAs(source);
|
||||
|
||||
@@ -490,7 +490,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
|
||||
* @see #getProtocol()
|
||||
*/
|
||||
protected Transport getTransport(Session session) throws NoSuchProviderException {
|
||||
String protocol = getProtocol();
|
||||
String protocol = getProtocol();
|
||||
if (protocol == null) {
|
||||
protocol = session.getProperty("mail.transport.protocol");
|
||||
if (protocol == null) {
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.cacheManager, "CacheManager is required");
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class CacheInterceptor extends CacheAspectSupport implements MethodInterc
|
||||
private static class KotlinDelegate {
|
||||
|
||||
public static Publisher<?> invokeSuspendingFunction(Method method, Object target, Object... args) {
|
||||
Continuation<?> continuation = (Continuation<?>) args[args.length - 1];
|
||||
Continuation<?> continuation = (Continuation<?>) args[args.length - 1];
|
||||
CoroutineContext coroutineContext = continuation.getContext().minusKey(Job.Key);
|
||||
return CoroutinesUtils.invokeSuspendingFunction(coroutineContext, method, target, args);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Sam Brannen
|
||||
* @since 3.2
|
||||
*/
|
||||
public class DateTimeFormatAnnotationFormatterFactory extends EmbeddedValueResolutionSupport
|
||||
public class DateTimeFormatAnnotationFormatterFactory extends EmbeddedValueResolutionSupport
|
||||
implements AnnotationFormatterFactory<DateTimeFormat> {
|
||||
|
||||
private static final Set<Class<?>> FIELD_TYPES = Set.of(Date.class, Calendar.class, Long.class);
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||
ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) {
|
||||
|
||||
BlockingQueue<Runnable> queue = createQueue(this.queueCapacity);
|
||||
ThreadPoolExecutor executor = createExecutor(this.corePoolSize, this.maxPoolSize,
|
||||
ThreadPoolExecutor executor = createExecutor(this.corePoolSize, this.maxPoolSize,
|
||||
this.keepAliveSeconds, queue, threadFactory, rejectedExecutionHandler);
|
||||
if (this.allowCoreThreadTimeOut) {
|
||||
executor.allowCoreThreadTimeOut(true);
|
||||
|
||||
@@ -247,7 +247,7 @@ final class BitsCronField extends CronField {
|
||||
}
|
||||
|
||||
private void clearBit(int index) {
|
||||
this.bits &= ~(1L << index);
|
||||
this.bits &= ~(1L << index);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -949,7 +949,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||
|
||||
if (value == null && !BeanUtils.isSimpleValueType(param.nestedIfOptional().getNestedParameterType())) {
|
||||
ResolvableType type = ResolvableType.forMethodParameter(param);
|
||||
args[i] = createObject(type, paramPath + ".", valueResolver);
|
||||
args[i] = createObject(type, paramPath + ".", valueResolver);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
|
||||
@@ -345,7 +345,7 @@ public class MethodValidationAdapter implements MethodValidator {
|
||||
}
|
||||
|
||||
private MethodParameter initMethodParameter(Method method, int index) {
|
||||
MethodParameter parameter = new MethodParameter(method, index);
|
||||
MethodParameter parameter = new MethodParameter(method, index);
|
||||
parameter.initParameterNameDiscovery(this.parameterNameDiscoverer);
|
||||
return parameter;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class SPR3064Tests {
|
||||
ClassPathXmlApplicationContext ctx =
|
||||
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
|
||||
|
||||
Service service = ctx.getBean(Service.class);
|
||||
Service service = ctx.getBean(Service.class);
|
||||
assertThatRuntimeException()
|
||||
.isThrownBy(service::serveMe)
|
||||
.withMessage("advice invoked");
|
||||
|
||||
@@ -166,7 +166,7 @@ class BeanNameAutoProxyCreatorTests {
|
||||
}
|
||||
|
||||
|
||||
private void jdkAssertions(ITestBean tb, int nopInterceptorCount) {
|
||||
private void jdkAssertions(ITestBean tb, int nopInterceptorCount) {
|
||||
NopInterceptor nop = (NopInterceptor) beanFactory.getBean("nopInterceptor");
|
||||
assertThat(nop.getCount()).isEqualTo(0);
|
||||
assertThat(AopUtils.isJdkDynamicProxy(tb)).isTrue();
|
||||
|
||||
@@ -418,7 +418,7 @@ abstract class OverrideOneMethod extends MethodReplaceCandidate implements Overr
|
||||
|
||||
@Override
|
||||
public String replaceMe(String someParam) {
|
||||
return "replaceMe:" + someParam;
|
||||
return "replaceMe:" + someParam;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class ExpressionEvaluatorTests {
|
||||
EvaluationContext context = createEvaluationContext(CacheOperationExpressionEvaluator.RESULT_UNAVAILABLE);
|
||||
assertThatExceptionOfType(VariableNotAvailableException.class).isThrownBy(() ->
|
||||
new SpelExpressionParser().parseExpression("#result").getValue(context))
|
||||
.satisfies(ex -> assertThat(ex.getName()).isEqualTo("result"));
|
||||
.satisfies(ex -> assertThat(ex.getName()).isEqualTo("result"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -122,7 +122,7 @@ public class Spr10744Tests {
|
||||
static class MyTestConfiguration extends MyConfiguration {
|
||||
|
||||
@Bean
|
||||
@Scope(value = "myTestScope", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
@Scope(value = "myTestScope", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
@Override
|
||||
public Foo foo() {
|
||||
return new Foo();
|
||||
|
||||
@@ -69,7 +69,7 @@ class Spr12334Tests {
|
||||
private static AtomicInteger scanned = new AtomicInteger();
|
||||
|
||||
@Override
|
||||
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
|
||||
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
|
||||
if (scanned.get() > 0) {
|
||||
throw new IllegalStateException("Already scanned");
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FactoryMethodComponent {
|
||||
|
||||
private int i;
|
||||
|
||||
public static TestBean nullInstance() {
|
||||
public static TestBean nullInstance() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -677,7 +677,7 @@ class DefaultLifecycleProcessorTests {
|
||||
return new TestLifecycleBean(null, stoppedBeans);
|
||||
}
|
||||
|
||||
private TestLifecycleBean(CopyOnWriteArrayList<Lifecycle> startedBeans, CopyOnWriteArrayList<Lifecycle> stoppedBeans) {
|
||||
private TestLifecycleBean(CopyOnWriteArrayList<Lifecycle> startedBeans, CopyOnWriteArrayList<Lifecycle> stoppedBeans) {
|
||||
this.startedBeans = startedBeans;
|
||||
this.stoppedBeans = stoppedBeans;
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ class GenericApplicationContextTests {
|
||||
}
|
||||
}
|
||||
|
||||
static class BeanB implements ApplicationContextAware {
|
||||
static class BeanB implements ApplicationContextAware {
|
||||
|
||||
ApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class JmxUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void isMBeanWithDynamicMBean() {
|
||||
void isMBeanWithDynamicMBean() {
|
||||
DynamicMBean mbean = new TestDynamicMBean();
|
||||
assertThat(JmxUtils.isMBean(mbean.getClass())).as("Dynamic MBean not detected correctly").isTrue();
|
||||
}
|
||||
@@ -76,24 +76,24 @@ class JmxUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void notAnMBean() {
|
||||
void notAnMBean() {
|
||||
assertThat(JmxUtils.isMBean(Object.class)).as("Object incorrectly identified as an MBean").isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void simpleMBean() {
|
||||
void simpleMBean() {
|
||||
Foo foo = new Foo();
|
||||
assertThat(JmxUtils.isMBean(foo.getClass())).as("Simple MBean not detected correctly").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void simpleMXBean() {
|
||||
void simpleMXBean() {
|
||||
FooX foo = new FooX();
|
||||
assertThat(JmxUtils.isMBean(foo.getClass())).as("Simple MXBean not detected correctly").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void simpleMBeanThroughInheritance() {
|
||||
void simpleMBeanThroughInheritance() {
|
||||
Bar bar = new Bar();
|
||||
Abc abc = new Abc();
|
||||
assertThat(JmxUtils.isMBean(bar.getClass())).as("Simple MBean (through inheritance) not detected correctly").isTrue();
|
||||
|
||||
@@ -1357,7 +1357,7 @@ class CronExpressionTests {
|
||||
@Test
|
||||
public void various() {
|
||||
CronExpression cronExpression = CronExpression.parse("3-57 13-28 17,18 1,15 3-12 6#1");
|
||||
LocalDateTime last = LocalDateTime.of(2022, 9, 15, 17, 44, 11);
|
||||
LocalDateTime last = LocalDateTime.of(2022, 9, 15, 17, 44, 11);
|
||||
LocalDateTime expected = LocalDateTime.of(2022, 10, 1, 17, 13, 3);
|
||||
LocalDateTime actual = cronExpression.next(last);
|
||||
assertThat(actual).isNotNull();
|
||||
|
||||
@@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public abstract class AbstractValueAdaptingCacheTests<T extends AbstractValueAdaptingCache>
|
||||
extends AbstractCacheTests<T> {
|
||||
extends AbstractCacheTests<T> {
|
||||
|
||||
protected static final String CACHE_NAME_NO_NULL = "testCacheNoNull";
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(cacheNames = "secondary", key = "#a0"), @CacheEvict(cacheNames = "primary", key = "#p0 + 'A'") })
|
||||
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(cacheNames = "secondary", key = "#a0"), @CacheEvict(cacheNames = "primary", key = "#p0 + 'A'") })
|
||||
public Object multiEvict(Object arg1) {
|
||||
return this.counter.getAndIncrement();
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ public abstract class InstrumentedBridgeMethods {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResourceBundle resourcebundlegetBundle( String baseName, Locale targetLocale, ResourceBundle.Control control) {
|
||||
public static ResourceBundle resourcebundlegetBundle(String baseName, Locale targetLocale, ResourceBundle.Control control) {
|
||||
RecordedInvocation.Builder builder = RecordedInvocation.of(InstrumentedMethod.RESOURCEBUNDLE_GETBUNDLE).withArguments(baseName, targetLocale, control);
|
||||
ResourceBundle result = null;
|
||||
try {
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.aot.hint.TypeReference;
|
||||
* @author Brian Clozel
|
||||
* @since 6.1
|
||||
*/
|
||||
class KotlinDetectorRuntimeHints implements RuntimeHintsRegistrar {
|
||||
class KotlinDetectorRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
|
||||
return OrderUtils.getPriority(clazz);
|
||||
}
|
||||
Integer priority = OrderUtils.getPriority(obj.getClass());
|
||||
if (priority == null && obj instanceof DecoratingProxy decoratingProxy) {
|
||||
if (priority == null && obj instanceof DecoratingProxy decoratingProxy) {
|
||||
return getPriority(decoratingProxy.getDecoratedClass());
|
||||
}
|
||||
return priority;
|
||||
|
||||
@@ -129,7 +129,7 @@ public class UrlResource extends AbstractFileResolvingResource {
|
||||
* @throws MalformedURLException if the given URL specification is not valid
|
||||
* @see java.net.URI#URI(String, String, String)
|
||||
*/
|
||||
public UrlResource(String protocol, String location) throws MalformedURLException {
|
||||
public UrlResource(String protocol, String location) throws MalformedURLException {
|
||||
this(protocol, location, null);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class UrlResource extends AbstractFileResolvingResource {
|
||||
* @throws MalformedURLException if the given URL specification is not valid
|
||||
* @see java.net.URI#URI(String, String, String)
|
||||
*/
|
||||
public UrlResource(String protocol, String location, @Nullable String fragment) throws MalformedURLException {
|
||||
public UrlResource(String protocol, String location, @Nullable String fragment) throws MalformedURLException {
|
||||
try {
|
||||
this.uri = new URI(protocol, location, fragment);
|
||||
this.url = this.uri.toURL();
|
||||
|
||||
@@ -1074,7 +1074,7 @@ public abstract class DataBufferUtils {
|
||||
DataBuffer.ByteBufferIterator iterator = dataBuffer.writableByteBuffers();
|
||||
Assert.state(iterator.hasNext(), "No ByteBuffer available");
|
||||
ByteBuffer byteBuffer = iterator.next();
|
||||
Attachment attachment = new Attachment(dataBuffer, iterator);
|
||||
Attachment attachment = new Attachment(dataBuffer, iterator);
|
||||
this.channel.read(byteBuffer, this.position.get(), attachment, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SerializingConverter implements Converter<Object, byte[]> {
|
||||
*/
|
||||
@Override
|
||||
public byte[] convert(Object source) {
|
||||
try {
|
||||
try {
|
||||
return this.serializer.serializeToByteArray(source);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
|
||||
}
|
||||
else {
|
||||
Set<String> prefixes = this.namespaceUriToPrefixes.get(namespaceUri);
|
||||
return (prefixes != null ? Collections.unmodifiableSet(prefixes) : Collections.emptySet());
|
||||
return (prefixes != null ? Collections.unmodifiableSet(prefixes) : Collections.emptySet());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ class BridgeMethodResolverTests {
|
||||
Method bridgedMethod = MegaMessageProducerImpl.class.getDeclaredMethod("receive", MegaMessageEvent.class);
|
||||
assertThat(bridgedMethod.isBridge()).isFalse();
|
||||
|
||||
Method bridgeMethod = MegaMessageProducerImpl.class.getDeclaredMethod("receive", MegaEvent.class);
|
||||
Method bridgeMethod = MegaMessageProducerImpl.class.getDeclaredMethod("receive", MegaEvent.class);
|
||||
assertThat(bridgeMethod.isBridge()).isTrue();
|
||||
|
||||
assertThat(BridgeMethodResolver.findBridgedMethod(bridgeMethod)).isEqualTo(bridgedMethod);
|
||||
|
||||
@@ -128,7 +128,7 @@ class CharBufferDecoderTests extends AbstractDecoderTests<CharBufferDecoder> {
|
||||
}
|
||||
|
||||
@Test
|
||||
void decodeNewlinesAcrossBuffers() {
|
||||
void decodeNewlinesAcrossBuffers() {
|
||||
Flux<DataBuffer> input = Flux.just(
|
||||
stringBuffer("\r"),
|
||||
stringBuffer("\n"),
|
||||
|
||||
@@ -139,7 +139,7 @@ class StringDecoderTests extends AbstractDecoderTests<StringDecoder> {
|
||||
}
|
||||
|
||||
@Test
|
||||
void decodeNewlinesAcrossBuffers() {
|
||||
void decodeNewlinesAcrossBuffers() {
|
||||
Flux<DataBuffer> input = Flux.just(
|
||||
stringBuffer("\r"),
|
||||
stringBuffer("\n"),
|
||||
|
||||
@@ -633,7 +633,7 @@ class GenericConversionServiceTests {
|
||||
}
|
||||
|
||||
|
||||
private static class MyStringToIntegerArrayConverter implements Converter<String, Integer[]> {
|
||||
private static class MyStringToIntegerArrayConverter implements Converter<String, Integer[]> {
|
||||
|
||||
@Override
|
||||
public Integer[] convert(String source) {
|
||||
|
||||
@@ -200,7 +200,7 @@ class PathMatchingResourcePatternResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void usingFileProtocolWithoutWildcardInPatternAndEndingInSlashStarStar() {
|
||||
void usingFileProtocolWithoutWildcardInPatternAndEndingInSlashStarStar() {
|
||||
Path testResourcesDir = Paths.get("src/test/resources").toAbsolutePath();
|
||||
String pattern = String.format("file:%s/scanned-resources/**", testResourcesDir);
|
||||
String pathPrefix = ".+?resources/";
|
||||
|
||||
@@ -129,7 +129,7 @@ public enum SpelMessage {
|
||||
PROBLEM_LOCATING_METHOD(Kind.ERROR, 1031,
|
||||
"Problem locating method {0} on type {1}"),
|
||||
|
||||
SETVALUE_NOT_SUPPORTED( Kind.ERROR, 1032,
|
||||
SETVALUE_NOT_SUPPORTED(Kind.ERROR, 1032,
|
||||
"setValue(ExpressionState, Object) not supported for ''{0}''"),
|
||||
|
||||
MULTIPLE_POSSIBLE_METHODS(Kind.ERROR, 1033,
|
||||
|
||||
@@ -134,7 +134,7 @@ public class InlineMap extends SpelNodeImpl {
|
||||
key = keyChild.getValue(expressionState);
|
||||
}
|
||||
Object value = getChild(c).getValue(expressionState);
|
||||
returnValue.put(key, value);
|
||||
returnValue.put(key, value);
|
||||
}
|
||||
return new TypedValue(returnValue);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public abstract class ReflectionHelper {
|
||||
match = null;
|
||||
}
|
||||
}
|
||||
else if (!expectedArg.equals(suppliedArg)) {
|
||||
else if (!expectedArg.equals(suppliedArg)) {
|
||||
if (suppliedArg.isAssignableTo(expectedArg)) {
|
||||
if (match != ArgumentsMatchKind.REQUIRES_CONVERSION) {
|
||||
match = ArgumentsMatchKind.CLOSE;
|
||||
|
||||
@@ -570,7 +570,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||
private static boolean isKotlinProperty(Method method, String methodSuffix) {
|
||||
Class<?> clazz = method.getDeclaringClass();
|
||||
return KotlinDetector.isKotlinReflectPresent() &&
|
||||
KotlinDetector.isKotlinType(clazz) &&
|
||||
KotlinDetector.isKotlinType(clazz) &&
|
||||
KotlinDelegate.isKotlinProperty(method, methodSuffix);
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ class EvaluationTests extends AbstractExpressionTests {
|
||||
// Add a new element to the list
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext(instance);
|
||||
ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
|
||||
Expression e = parser.parseExpression("listOfStrings[++index3]='def'");
|
||||
Expression e = parser.parseExpression("listOfStrings[++index3]='def'");
|
||||
e.getValue(ctx);
|
||||
assertThat(instance.listOfStrings).hasSize(2);
|
||||
assertThat(instance.listOfStrings.get(1)).isEqualTo("def");
|
||||
@@ -367,13 +367,13 @@ class EvaluationTests extends AbstractExpressionTests {
|
||||
// Check reference beyond end of collection
|
||||
ctx = new StandardEvaluationContext(instance);
|
||||
parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
|
||||
e = parser.parseExpression("listOfStrings[0]");
|
||||
e = parser.parseExpression("listOfStrings[0]");
|
||||
String value = e.getValue(ctx, String.class);
|
||||
assertThat(value).isEqualTo("abc");
|
||||
e = parser.parseExpression("listOfStrings[1]");
|
||||
e = parser.parseExpression("listOfStrings[1]");
|
||||
value = e.getValue(ctx, String.class);
|
||||
assertThat(value).isEqualTo("def");
|
||||
e = parser.parseExpression("listOfStrings[2]");
|
||||
e = parser.parseExpression("listOfStrings[2]");
|
||||
value = e.getValue(ctx, String.class);
|
||||
assertThat(value).isEmpty();
|
||||
|
||||
@@ -858,7 +858,7 @@ class EvaluationTests extends AbstractExpressionTests {
|
||||
Integer i = 42;
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext(i);
|
||||
ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
|
||||
Expression e = parser.parseExpression("#this++");
|
||||
Expression e = parser.parseExpression("#this++");
|
||||
assertThat(i).isEqualTo(42);
|
||||
assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() ->
|
||||
e.getValue(ctx, Integer.class))
|
||||
@@ -993,11 +993,11 @@ class EvaluationTests extends AbstractExpressionTests {
|
||||
Integer i = 42;
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext(i);
|
||||
ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
|
||||
Expression e1 = parser.parseExpression("++1");
|
||||
Expression e1 = parser.parseExpression("++1");
|
||||
assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() ->
|
||||
e1.getValue(ctx, Double.TYPE))
|
||||
.satisfies(ex -> assertThat(ex.getMessageCode()).isEqualTo(SpelMessage.NOT_ASSIGNABLE));
|
||||
Expression e2 = parser.parseExpression("1++");
|
||||
Expression e2 = parser.parseExpression("1++");
|
||||
assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() ->
|
||||
e2.getValue(ctx, Double.TYPE))
|
||||
.satisfies(ex -> assertThat(ex.getMessageCode()).isEqualTo(SpelMessage.NOT_ASSIGNABLE));
|
||||
@@ -1008,7 +1008,7 @@ class EvaluationTests extends AbstractExpressionTests {
|
||||
Integer i = 42;
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext(i);
|
||||
ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
|
||||
Expression e = parser.parseExpression("#this--");
|
||||
Expression e = parser.parseExpression("#this--");
|
||||
assertThat(i).isEqualTo(42);
|
||||
assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() ->
|
||||
e.getValue(ctx, Integer.class))
|
||||
@@ -1169,13 +1169,13 @@ class EvaluationTests extends AbstractExpressionTests {
|
||||
assertThat(helper.intArray[2]).isEqualTo(4);
|
||||
|
||||
// index1 is 3 intArray[3] is 4
|
||||
e = parser.parseExpression("intArray[#root.index1++]--");
|
||||
e = parser.parseExpression("intArray[#root.index1++]--");
|
||||
assertThat(e.getValue(ctx, Integer.class)).isEqualTo(4);
|
||||
assertThat(helper.index1).isEqualTo(4);
|
||||
assertThat(helper.intArray[3]).isEqualTo(3);
|
||||
|
||||
// index1 is 4, intArray[3] is 3
|
||||
e = parser.parseExpression("intArray[--#root.index1]++");
|
||||
e = parser.parseExpression("intArray[--#root.index1]++");
|
||||
assertThat(e.getValue(ctx, Integer.class)).isEqualTo(3);
|
||||
assertThat(helper.index1).isEqualTo(3);
|
||||
assertThat(helper.intArray[3]).isEqualTo(4);
|
||||
|
||||
@@ -6372,7 +6372,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
|
||||
private Float _valueF,_valueF2;
|
||||
|
||||
public Reg(int v) {
|
||||
this._value = v;
|
||||
this._value = v;
|
||||
this._valueL = (long) v;
|
||||
this._valueD = (double) v;
|
||||
this._valueF = (float) v;
|
||||
@@ -6411,14 +6411,14 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
|
||||
}
|
||||
|
||||
public void setValue(Integer value) {
|
||||
_value = value;
|
||||
_value = value;
|
||||
_valueL = value==null?null:Long.valueOf(value);
|
||||
_valueD = value==null?null:Double.valueOf(value);
|
||||
_valueF = value==null?null:Float.valueOf(value);
|
||||
}
|
||||
|
||||
public void setValue2(Integer value) {
|
||||
_value2 = value;
|
||||
_value2 = value;
|
||||
_valueL2 = value==null?null:Long.valueOf(value);
|
||||
_valueD2 = value==null?null:Double.valueOf(value);
|
||||
_valueF2 = value==null?null:Float.valueOf(value);
|
||||
|
||||
@@ -130,7 +130,7 @@ class SpelDocumentationTests extends AbstractExpressionTests {
|
||||
String helloWorld = (String) parser.parseExpression("'Hello World'").getValue(); // evals to "Hello World"
|
||||
assertThat(helloWorld).isEqualTo("Hello World");
|
||||
|
||||
double avogadrosNumber = (Double) parser.parseExpression("6.0221415E+23").getValue();
|
||||
double avogadrosNumber = (Double) parser.parseExpression("6.0221415E+23").getValue();
|
||||
assertThat(avogadrosNumber).isCloseTo(6.0221415E+23, within((double) 0));
|
||||
|
||||
int maxValue = (Integer) parser.parseExpression("0x7FFFFFFF").getValue(); // evals to 2147483647
|
||||
@@ -263,7 +263,7 @@ class SpelDocumentationTests extends AbstractExpressionTests {
|
||||
boolean falseValue = parser.parseExpression("true and false").getValue(Boolean.class);
|
||||
assertThat(falseValue).isFalse();
|
||||
// evaluates to true
|
||||
String expression = "isMember('Nikola Tesla') and isMember('Mihajlo Pupin')";
|
||||
String expression = "isMember('Nikola Tesla') and isMember('Mihajlo Pupin')";
|
||||
boolean trueValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class);
|
||||
|
||||
// -- OR --
|
||||
@@ -273,7 +273,7 @@ class SpelDocumentationTests extends AbstractExpressionTests {
|
||||
assertThat(trueValue).isTrue();
|
||||
|
||||
// evaluates to true
|
||||
expression = "isMember('Nikola Tesla') or isMember('Albert Einstien')";
|
||||
expression = "isMember('Nikola Tesla') or isMember('Albert Einstien')";
|
||||
trueValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class);
|
||||
assertThat(trueValue).isTrue();
|
||||
|
||||
@@ -285,7 +285,7 @@ class SpelDocumentationTests extends AbstractExpressionTests {
|
||||
|
||||
|
||||
// -- AND and NOT --
|
||||
expression = "isMember('Nikola Tesla') and !isMember('Mihajlo Pupin')";
|
||||
expression = "isMember('Nikola Tesla') and !isMember('Mihajlo Pupin')";
|
||||
falseValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class);
|
||||
assertThat(falseValue).isFalse();
|
||||
}
|
||||
@@ -302,28 +302,28 @@ class SpelDocumentationTests extends AbstractExpressionTests {
|
||||
assertThat(testString).isEqualTo("test string");
|
||||
|
||||
// Subtraction
|
||||
int four = parser.parseExpression("1 - -3").getValue(Integer.class); // 4
|
||||
int four = parser.parseExpression("1 - -3").getValue(Integer.class); // 4
|
||||
assertThat(four).isEqualTo(4);
|
||||
|
||||
double d = parser.parseExpression("1000.00 - 1e4").getValue(Double.class); // -9000
|
||||
assertThat(d).isCloseTo(-9000.0d, within((double) 0));
|
||||
|
||||
// Multiplication
|
||||
int six = parser.parseExpression("-2 * -3").getValue(Integer.class); // 6
|
||||
int six = parser.parseExpression("-2 * -3").getValue(Integer.class); // 6
|
||||
assertThat(six).isEqualTo(6);
|
||||
|
||||
double twentyFour = parser.parseExpression("2.0 * 3e0 * 4").getValue(Double.class); // 24.0
|
||||
assertThat(twentyFour).isCloseTo(24.0d, within((double) 0));
|
||||
|
||||
// Division
|
||||
int minusTwo = parser.parseExpression("6 / -3").getValue(Integer.class); // -2
|
||||
int minusTwo = parser.parseExpression("6 / -3").getValue(Integer.class); // -2
|
||||
assertThat(minusTwo).isEqualTo(-2);
|
||||
|
||||
double one = parser.parseExpression("8.0 / 4e0 / 2").getValue(Double.class); // 1.0
|
||||
assertThat(one).isCloseTo(1.0d, within((double) 0));
|
||||
|
||||
// Modulus
|
||||
int three = parser.parseExpression("7 % 4").getValue(Integer.class); // 3
|
||||
int three = parser.parseExpression("7 % 4").getValue(Integer.class); // 3
|
||||
assertThat(three).isEqualTo(3);
|
||||
|
||||
int oneInt = parser.parseExpression("8 / 5 % 2").getValue(Integer.class); // 1
|
||||
|
||||
@@ -370,7 +370,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> {
|
||||
* @throws SQLException if an SQLException is encountered
|
||||
* @since 5.3
|
||||
*/
|
||||
protected T constructMappedInstance(ResultSet rs, TypeConverter tc) throws SQLException {
|
||||
protected T constructMappedInstance(ResultSet rs, TypeConverter tc) throws SQLException {
|
||||
Assert.state(this.mappedClass != null, "Mapped class was not specified");
|
||||
return BeanUtils.instantiateClass(this.mappedClass);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class DataClassRowMapper<T> extends BeanPropertyRowMapper<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected T constructMappedInstance(ResultSet rs, TypeConverter tc) throws SQLException {
|
||||
protected T constructMappedInstance(ResultSet rs, TypeConverter tc) throws SQLException {
|
||||
Assert.state(this.mappedConstructor != null, "Mapped constructor was not initialized");
|
||||
|
||||
Object[] args;
|
||||
|
||||
@@ -1149,7 +1149,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
Assert.notNull(action, "Callback object must not be null");
|
||||
if (logger.isDebugEnabled()) {
|
||||
String sql = getSql(csc);
|
||||
logger.debug("Calling stored procedure" + (sql != null ? " [" + sql + "]" : ""));
|
||||
logger.debug("Calling stored procedure" + (sql != null ? " [" + sql + "]" : ""));
|
||||
}
|
||||
|
||||
Connection con = DataSourceUtils.getConnection(obtainDataSource());
|
||||
|
||||
@@ -554,7 +554,7 @@ public class CallMetaDataContext {
|
||||
Map<String, String> callParameterNames = CollectionUtils.newHashMap(this.callParameters.size());
|
||||
for (SqlParameter parameter : this.callParameters) {
|
||||
if (parameter.isInputValueProvided()) {
|
||||
String parameterName = parameter.getName();
|
||||
String parameterName = parameter.getName();
|
||||
String parameterNameToMatch = provider.parameterNameToUse(parameterName);
|
||||
if (parameterNameToMatch != null) {
|
||||
callParameterNames.put(parameterNameToMatch.toLowerCase(), parameterName);
|
||||
@@ -606,7 +606,7 @@ public class CallMetaDataContext {
|
||||
int i = 0;
|
||||
for (SqlParameter parameter : this.callParameters) {
|
||||
if (parameter.isInputValueProvided()) {
|
||||
String parameterName = parameter.getName();
|
||||
String parameterName = parameter.getName();
|
||||
matchedParameters.put(parameterName, parameterValues[i++]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
||||
@Nullable String schemaName, @Nullable String procedureName) throws SQLException {
|
||||
|
||||
this.procedureColumnMetaDataUsed = true;
|
||||
processProcedureColumns(databaseMetaData, catalogName, schemaName, procedureName);
|
||||
processProcedureColumns(databaseMetaData, catalogName, schemaName, procedureName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -404,7 +404,7 @@ public abstract class AbstractJdbcCall {
|
||||
logger.debug("The following parameters are used for call " + getCallString() + " with " + args);
|
||||
int i = 1;
|
||||
for (SqlParameter param : getCallParameters()) {
|
||||
logger.debug(i + ": " + param.getName() + ", SQL type "+ param.getSqlType() + ", type name " +
|
||||
logger.debug(i + ": " + param.getName() + ", SQL type " + param.getSqlType() + ", type name " +
|
||||
param.getTypeName() + ", parameter class [" + param.getClass().getName() + "]");
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ public abstract class AbstractJdbcInsert {
|
||||
if (getGeneratedKeyNames().length > 1) {
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
"Current database only supports retrieving the key for a single column. There are " +
|
||||
getGeneratedKeyNames().length + " columns specified: " + Arrays.toString(getGeneratedKeyNames()));
|
||||
getGeneratedKeyNames().length + " columns specified: " + Arrays.toString(getGeneratedKeyNames()));
|
||||
}
|
||||
|
||||
Assert.state(getTableName() != null, "No table name set");
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface SqlValue {
|
||||
* @param paramIndex the index of the parameter for which we need to set the value
|
||||
* @throws SQLException if an SQLException is encountered while setting parameter values
|
||||
*/
|
||||
void setValue(PreparedStatement ps, int paramIndex) throws SQLException;
|
||||
void setValue(PreparedStatement ps, int paramIndex) throws SQLException;
|
||||
|
||||
/**
|
||||
* Clean up resources held by this value object.
|
||||
|
||||
@@ -269,7 +269,7 @@ public interface SqlRowSet extends Serializable {
|
||||
* @see java.sql.ResultSet#getObject(int, Map)
|
||||
*/
|
||||
@Nullable
|
||||
Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
|
||||
Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
|
||||
|
||||
/**
|
||||
* Retrieve the value of the indicated column in the current row as an Object.
|
||||
@@ -279,7 +279,7 @@ public interface SqlRowSet extends Serializable {
|
||||
* @see java.sql.ResultSet#getObject(String, Map)
|
||||
*/
|
||||
@Nullable
|
||||
Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
|
||||
Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
|
||||
|
||||
/**
|
||||
* Retrieve the value of the indicated column in the current row as an Object.
|
||||
|
||||
@@ -60,7 +60,7 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||
class SqlLobValueTests {
|
||||
class SqlLobValueTests {
|
||||
|
||||
@Mock
|
||||
private PreparedStatement preparedStatement;
|
||||
|
||||
@@ -181,32 +181,32 @@ public class DataSourceTransactionManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitTrue() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitTrue() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(true, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitFalse() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitFalse() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(false, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnection() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnection() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(true, true, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnection() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnection() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(false, true, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(true, true, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(false, true, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ import static org.mockito.Mockito.verify;
|
||||
* @author Thomas Risberg
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class SqlQueryTests {
|
||||
public class SqlQueryTests {
|
||||
|
||||
//FIXME inline?
|
||||
private static final String SELECT_ID =
|
||||
|
||||
@@ -187,32 +187,32 @@ public class JdbcTransactionManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitTrue() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitTrue() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(true, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitFalse() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitFalse() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(false, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnection() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnection() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(true, true, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnection() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnection() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(false, true, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitTrueAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(true, true, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
public void testTransactionRollbackWithAutoCommitFalseAndLazyConnectionAndCreateStatement() throws Exception {
|
||||
doTestTransactionRollbackRestoringAutoCommit(false, true, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SQLExceptionCustomTranslatorTests {
|
||||
|
||||
@Test
|
||||
public void dataAccessResourceException() {
|
||||
SQLException dataAccessResourceEx = new SQLDataException("", "", 2);
|
||||
SQLException dataAccessResourceEx = new SQLDataException("", "", 2);
|
||||
DataAccessException dae = sext.translate("task", "SQL", dataAccessResourceEx);
|
||||
assertThat(dae.getCause()).isEqualTo(dataAccessResourceEx);
|
||||
assertThat(dae).isInstanceOf(TransientDataAccessResourceException.class);
|
||||
|
||||
@@ -243,7 +243,7 @@ public abstract class AbstractAdaptableMessageListener
|
||||
* as an argument
|
||||
* @throws MessageConversionException if the message could not be extracted
|
||||
*/
|
||||
protected Object extractMessage(Message message) {
|
||||
protected Object extractMessage(Message message) {
|
||||
try {
|
||||
MessageConverter converter = getMessageConverter();
|
||||
if (converter != null) {
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.Assert;
|
||||
* @see #setTransactionManager
|
||||
* @see JmsMessageEndpointManager
|
||||
*/
|
||||
public class JmsMessageEndpointFactory extends AbstractMessageEndpointFactory {
|
||||
public class JmsMessageEndpointFactory extends AbstractMessageEndpointFactory {
|
||||
|
||||
@Nullable
|
||||
private MessageListener messageListener;
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface MessageContentsDelegate {
|
||||
|
||||
void handleMessage(CharSequence message);
|
||||
|
||||
void handleMessage(Map<String, Object> message);
|
||||
void handleMessage(Map<String, Object> message);
|
||||
|
||||
void handleMessage(byte[] message);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DefaultSubscriptionRegistryBenchmark {
|
||||
|
||||
@Setup(Level.Trial)
|
||||
public void doSetup() {
|
||||
this.findMessage = MessageBuilder.createMessage("", SimpMessageHeaderAccessor.create().getMessageHeaders());
|
||||
this.findMessage = MessageBuilder.createMessage("", SimpMessageHeaderAccessor.create().getMessageHeaders());
|
||||
this.uniqueIdGenerator = new AtomicInteger();
|
||||
|
||||
this.registry = new DefaultSubscriptionRegistry();
|
||||
|
||||
@@ -143,7 +143,7 @@ public class RSocketFrameTypeMessageCondition extends AbstractMessageCondition<R
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class RSocketRequestValues {
|
||||
|
||||
|
||||
public RSocketRequestValues(
|
||||
@Nullable String route, @Nullable List<Object> routeVariables, @Nullable MetadataHelper metadataHelper,
|
||||
@Nullable String route, @Nullable List<Object> routeVariables, @Nullable MetadataHelper metadataHelper,
|
||||
@Nullable Object payloadValue, @Nullable Publisher<?> payload,
|
||||
@Nullable ParameterizedTypeReference<?> payloadElementType) {
|
||||
|
||||
|
||||
@@ -492,7 +492,7 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
|
||||
TcpConnection<byte[]> con = this.connection;
|
||||
Assert.state(con != null, "No TcpConnection available");
|
||||
if (connect[0] > 0 && connected[1] > 0) {
|
||||
long interval = Math.max(connect[0], connected[1]);
|
||||
long interval = Math.max(connect[0], connected[1]);
|
||||
con.onWriteInactivity(new WriteInactivityTask(), interval);
|
||||
}
|
||||
if (connect[1] > 0 && connected[0] > 0) {
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.Assert;
|
||||
* @since 4.0
|
||||
* @see StompDecoder
|
||||
*/
|
||||
public class StompEncoder {
|
||||
public class StompEncoder {
|
||||
|
||||
private static final Byte LINE_FEED_BYTE = '\n';
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "local=[" + this.localRegistry + "], remote=" + this.remoteRegistries;
|
||||
return "local=[" + this.localRegistry + "], remote=" + this.remoteRegistries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -600,7 +600,7 @@ public class MessageHeaderAccessor {
|
||||
|
||||
if (messageHeaders instanceof MutableMessageHeaders mutableHeaders) {
|
||||
MessageHeaderAccessor headerAccessor = mutableHeaders.getAccessor();
|
||||
if (requiredType == null || requiredType.isInstance(headerAccessor)) {
|
||||
if (requiredType == null || requiredType.isInstance(headerAccessor)) {
|
||||
return (T) headerAccessor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ public class ReactorNetty2TcpClient<P> implements TcpOperations<P> {
|
||||
}
|
||||
});
|
||||
Sinks.Empty<Void> completionSink = Sinks.empty();
|
||||
TcpConnection<P> connection = new ReactorNetty2TcpConnection<>(inbound, outbound, codec, completionSink);
|
||||
TcpConnection<P> connection = new ReactorNetty2TcpConnection<>(inbound, outbound, codec, completionSink);
|
||||
scheduler.schedule(() -> this.connectionHandler.afterConnected(connection));
|
||||
|
||||
inbound.withConnection(conn -> conn.addHandlerFirst(new StompMessageDecoder<>(codec)));
|
||||
|
||||
@@ -308,7 +308,7 @@ public class ReactorNettyTcpClient<P> implements TcpOperations<P> {
|
||||
}
|
||||
});
|
||||
Sinks.Empty<Void> completionSink = Sinks.empty();
|
||||
TcpConnection<P> connection = new ReactorNettyTcpConnection<>(inbound, outbound, codec, completionSink);
|
||||
TcpConnection<P> connection = new ReactorNettyTcpConnection<>(inbound, outbound, codec, completionSink);
|
||||
scheduler.schedule(() -> this.connectionHandler.afterConnected(connection));
|
||||
|
||||
inbound.withConnection(conn -> conn.addHandlerFirst(new StompMessageDecoder<>(codec)));
|
||||
|
||||
@@ -134,7 +134,7 @@ public class AnnotationExceptionHandlerMethodResolverTests {
|
||||
static class InheritedController extends ExceptionController {
|
||||
|
||||
@Override
|
||||
public void handleIOException() {
|
||||
public void handleIOException() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -480,7 +480,7 @@ public abstract class AbstractStompBrokerRelayIntegrationTests {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "command=" + this.command + ", session=\"" + this.sessionId + "\"";
|
||||
return "command=" + this.command + ", session=\"" + this.sessionId + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ public class DefaultStompSessionTests {
|
||||
Subscription subscription = this.session.subscribe(subscribeHeaders, frameHandler);
|
||||
|
||||
StompHeaders unsubscribeHeaders = new StompHeaders();
|
||||
unsubscribeHeaders.set(headerName, subscription.getSubscriptionHeaders().getFirst(headerName));
|
||||
unsubscribeHeaders.set(headerName, subscription.getSubscriptionHeaders().getFirst(headerName));
|
||||
subscription.unsubscribe(unsubscribeHeaders);
|
||||
|
||||
Message<byte[]> message = this.messageCaptor.getValue();
|
||||
|
||||
@@ -57,7 +57,7 @@ public class StompEncoderTests {
|
||||
@Test
|
||||
public void encodeFrameWithHeadersThatShouldBeEscaped() {
|
||||
StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.DISCONNECT);
|
||||
headers.addNativeHeader("a:\r\n\\b", "alpha:bravo\r\n\\");
|
||||
headers.addNativeHeader("a:\r\n\\b", "alpha:bravo\r\n\\");
|
||||
Message<byte[]> frame = MessageBuilder.createMessage(new byte[0], headers.getMessageHeaders());
|
||||
|
||||
assertThat(new String(encoder.encode(frame))).isEqualTo("DISCONNECT\na\\c\\r\\n\\\\b:alpha\\cbravo\\r\\n\\\\\n\n\0");
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ExecutorSubscribableChannelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subscribeTwice() {
|
||||
public void subscribeTwice() {
|
||||
assertThat(this.channel.subscribe(this.handler)).isTrue();
|
||||
assertThat(this.channel.subscribe(this.handler)).isFalse();
|
||||
this.channel.send(this.message);
|
||||
@@ -105,7 +105,7 @@ public class ExecutorSubscribableChannelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unsubscribeTwice() {
|
||||
public void unsubscribeTwice() {
|
||||
this.channel.subscribe(this.handler);
|
||||
assertThat(this.channel.unsubscribe(this.handler)).isTrue();
|
||||
assertThat(this.channel.unsubscribe(this.handler)).isFalse();
|
||||
@@ -114,7 +114,7 @@ public class ExecutorSubscribableChannelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void failurePropagates() {
|
||||
public void failurePropagates() {
|
||||
RuntimeException ex = new RuntimeException();
|
||||
willThrow(ex).given(this.handler).handleMessage(this.message);
|
||||
MessageHandler secondHandler = mock();
|
||||
@@ -130,7 +130,7 @@ public class ExecutorSubscribableChannelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void concurrentModification() {
|
||||
public void concurrentModification() {
|
||||
this.channel.subscribe(message1 -> channel.unsubscribe(handler));
|
||||
this.channel.subscribe(this.handler);
|
||||
this.channel.send(this.message);
|
||||
|
||||
@@ -202,7 +202,7 @@ public abstract class SessionFactoryUtils {
|
||||
return new PessimisticLockingFailureException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() + "]", ex);
|
||||
}
|
||||
if (ex instanceof ConstraintViolationException hibJdbcEx) {
|
||||
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() +
|
||||
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() +
|
||||
"]; constraint [" + hibJdbcEx.getConstraintName() + "]", ex);
|
||||
}
|
||||
if (ex instanceof DataException hibJdbcEx) {
|
||||
|
||||
@@ -286,7 +286,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
return new PessimisticLockingFailureException(ex.getMessage() + "; SQL [" + hibEx.getSQL() + "]", ex);
|
||||
}
|
||||
if (ex instanceof ConstraintViolationException hibEx) {
|
||||
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibEx.getSQL() +
|
||||
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibEx.getSQL() +
|
||||
"]; constraint [" + hibEx.getConstraintName() + "]", ex);
|
||||
}
|
||||
if (ex instanceof DataException hibEx) {
|
||||
|
||||
@@ -877,7 +877,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
|
||||
if (ex instanceof StreamException || ex instanceof CannotResolveClassException ||
|
||||
ex instanceof ForbiddenClassException || ex instanceof ConversionException) {
|
||||
if (marshalling) {
|
||||
return new MarshallingFailureException("XStream marshalling exception", ex);
|
||||
return new MarshallingFailureException("XStream marshalling exception", ex);
|
||||
}
|
||||
else {
|
||||
return new UnmarshallingFailureException("XStream unmarshalling exception", ex);
|
||||
|
||||
@@ -188,7 +188,7 @@ public class R2dbcTransactionManager extends AbstractReactiveTransactionManager
|
||||
ConnectionFactoryTransactionObject txObject = (ConnectionFactoryTransactionObject) transaction;
|
||||
|
||||
if (definition.getPropagationBehavior() == TransactionDefinition.PROPAGATION_NESTED &&
|
||||
txObject.isTransactionActive()) {
|
||||
txObject.isTransactionActive()) {
|
||||
return txObject.createSavepoint();
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ public abstract class ScriptUtils {
|
||||
|
||||
return executeSqlScript(connection, resource, dataBufferFactory, continueOnError,
|
||||
ignoreFailedDrops, new String[] { commentPrefix }, separator,
|
||||
blockCommentStartDelimiter, blockCommentEndDelimiter);
|
||||
blockCommentStartDelimiter, blockCommentEndDelimiter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
abstract class AbstractTransactionalDatabaseClientIntegrationTests {
|
||||
abstract class AbstractTransactionalDatabaseClientIntegrationTests {
|
||||
|
||||
private ConnectionFactory connectionFactory;
|
||||
|
||||
|
||||
@@ -726,7 +726,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
else if (this.inputStream != null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot call getReader() after getInputStream() has already been called for the current request") ;
|
||||
"Cannot call getReader() after getInputStream() has already been called for the current request");
|
||||
}
|
||||
|
||||
if (this.content != null) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Sam Brannen
|
||||
* @since 5.2.5
|
||||
*/
|
||||
class DynamicValuesPropertySource extends EnumerablePropertySource<Map<String, Supplier<Object>>> {
|
||||
class DynamicValuesPropertySource extends EnumerablePropertySource<Map<String, Supplier<Object>>> {
|
||||
|
||||
DynamicValuesPropertySource(String name, Map<String, Supplier<Object>> valueSuppliers) {
|
||||
super(name, valueSuppliers);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class XmlExpectationsHelper {
|
||||
assertThat("Body content", document, matcher);
|
||||
}
|
||||
|
||||
private Document parseXmlString(String xml) throws Exception {
|
||||
private Document parseXmlString(String xml) throws Exception {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
|
||||
|
||||
@@ -478,7 +478,7 @@ class DefaultWebTestClient implements WebTestClient {
|
||||
return new DefaultBodyContentSpec(entityResult);
|
||||
}
|
||||
|
||||
private <B> EntityExchangeResult<B> initEntityExchangeResult(@Nullable B body) {
|
||||
private <B> EntityExchangeResult<B> initEntityExchangeResult(@Nullable B body) {
|
||||
EntityExchangeResult<B> result = new EntityExchangeResult<>(this.exchangeResult, body);
|
||||
result.assertWithDiagnostics(() -> this.entityResultConsumer.accept(result));
|
||||
return result;
|
||||
|
||||
@@ -73,7 +73,7 @@ class WiretapConnector implements ClientHttpConnector {
|
||||
requestRef.set(wrapped);
|
||||
return requestCallback.apply(wrapped);
|
||||
})
|
||||
.map(response -> {
|
||||
.map(response -> {
|
||||
WiretapClientHttpRequest wrappedRequest = requestRef.get();
|
||||
String header = WebTestClient.WEBTESTCLIENT_REQUEST_ID;
|
||||
String requestId = wrappedRequest.getHeaders().getFirst(header);
|
||||
|
||||
@@ -54,7 +54,7 @@ class AotMergedContextConfigurationTests {
|
||||
|
||||
|
||||
@Test
|
||||
void testEquals() {
|
||||
void testEquals() {
|
||||
assertThat(aotMergedConfig1).isEqualTo(aotMergedConfig1);
|
||||
assertThat(aotMergedConfig1).isEqualTo(aotMergedConfig2);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class BeforeTestClassSqlScriptsTests extends AbstractTransactionalTests {
|
||||
}
|
||||
|
||||
@Nested
|
||||
class NestedBeforeTestClassSqlScriptsTests {
|
||||
class NestedBeforeTestClassSqlScriptsTests {
|
||||
|
||||
@Test
|
||||
void classLevelScriptsHaveBeenRun() {
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
@SpringJUnitConfig(EmptyDatabaseConfig.class)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
@Sql(
|
||||
scripts = "schema.sql",
|
||||
scripts = "schema.sql",
|
||||
statements = "INSERT INTO user VALUES('Dilbert')"
|
||||
)
|
||||
@DirtiesContext
|
||||
|
||||
@@ -80,7 +80,7 @@ class DefaultRequestExpectationTests {
|
||||
|
||||
|
||||
private ClientHttpRequest createRequest() {
|
||||
return new MockClientHttpRequest(HttpMethod.GET, URI.create("/foo"));
|
||||
return new MockClientHttpRequest(HttpMethod.GET, URI.create("/foo"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ class UnorderedRequestExpectationManagerTests {
|
||||
|
||||
|
||||
private ClientHttpRequest createRequest(HttpMethod method, String url) {
|
||||
return new MockClientHttpRequest(method, URI.create(url));
|
||||
return new MockClientHttpRequest(method, URI.create(url));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ class JsonPathResultMatchersTests {
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
response.addHeader("Content-Type", "application/json");
|
||||
response.getWriter().print(new String("test".getBytes(ISO_8859_1)));
|
||||
StubMvcResult result = new StubMvcResult(null, null, null, null, null, null, response);
|
||||
StubMvcResult result = new StubMvcResult(null, null, null, null, null, null, response);
|
||||
|
||||
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
|
||||
new JsonPathResultMatchers("$.str").prefix("prefix").value("foo").match(result));
|
||||
|
||||
@@ -96,7 +96,7 @@ class StandaloneMockMvcBuilderTests {
|
||||
void applicationContextAttribute() {
|
||||
TestStandaloneMockMvcBuilder builder = new TestStandaloneMockMvcBuilder(new PlaceholderController());
|
||||
builder.addPlaceholderValue("sys.login.ajax", "/foo");
|
||||
WebApplicationContext wac = builder.initWebAppContext();
|
||||
WebApplicationContext wac = builder.initWebAppContext();
|
||||
assertThat(WebApplicationContextUtils.getRequiredWebApplicationContext(wac.getServletContext())).isEqualTo(wac);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
* @author Christian Dupuis
|
||||
* @since 2.5
|
||||
*/
|
||||
public class JtaTransactionManagerBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
public class JtaTransactionManagerBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user