From cdc234d7db97189e7255323921bdf84897795f17 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 22 Jul 2020 14:05:00 +0200 Subject: [PATCH] Polish contribution See gh-25446 --- .../index/processor/CandidateComponentsIndexer.java | 2 +- .../jcache/interceptor/KeyGeneratorAdapter.java | 2 +- .../jms/core/JmsMessagingTemplateTests.java | 2 +- .../orm/hibernate5/SessionHolder.java | 3 ++- .../web/servlet/result/HandlerResultMatchers.java | 12 +++++------- .../springframework/dao/support/DataAccessUtils.java | 2 +- .../http/client/SimpleClientHttpRequestFactory.java | 2 +- .../http/server/ServletServerHttpRequest.java | 2 +- .../HttpComponentsClientHttpRequestFactoryTests.java | 6 +++--- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java index c7c26faa2f3a..fcd0d63e12f4 100644 --- a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java +++ b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/KeyGeneratorAdapter.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/KeyGeneratorAdapter.java index 702ea367fea8..55a00d2c518f 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/KeyGeneratorAdapter.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/KeyGeneratorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsMessagingTemplateTests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsMessagingTemplateTests.java index f3e4f0314b99..96148ab15f45 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsMessagingTemplateTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsMessagingTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate5/SessionHolder.java b/spring-orm/src/main/java/org/springframework/orm/hibernate5/SessionHolder.java index a97aff8dfb90..6353ed33a0ba 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate5/SessionHolder.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate5/SessionHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. @@ -49,6 +49,7 @@ public class SessionHolder extends EntityManagerHolder { private FlushMode previousFlushMode; + @SuppressWarnings("cast") public SessionHolder(Session session) { // Check below is always true against Hibernate >= 5.2 but not against 5.0/5.1 at runtime super(session instanceof EntityManager ? session : null); diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/result/HandlerResultMatchers.java b/spring-test/src/main/java/org/springframework/test/web/servlet/result/HandlerResultMatchers.java index 90db97425dcc..d35d48f259fd 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/result/HandlerResultMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/result/HandlerResultMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -67,13 +67,11 @@ public ResultMatcher handlerType(Class type) { return result -> { Object handler = result.getHandler(); assertNotNull("No handler", handler); - if (handler != null) { - Class actual = handler.getClass(); - if (handler instanceof HandlerMethod) { - actual = ((HandlerMethod) handler).getBeanType(); - } - assertEquals("Handler type", type, ClassUtils.getUserClass(actual)); + Class actual = handler.getClass(); + if (handler instanceof HandlerMethod) { + actual = ((HandlerMethod) handler).getBeanType(); } + assertEquals("Handler type", type, ClassUtils.getUserClass(actual)); }; } diff --git a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java index c4409329a5bf..adb80a3afb7a 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. diff --git a/spring-web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java b/spring-web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java index 900b925481e1..141072008b5e 100644 --- a/spring-web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java +++ b/spring-web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2020 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. diff --git a/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java b/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java index 352d11c8b37e..e60de76d1dff 100644 --- a/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. diff --git a/spring-web/src/test/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactoryTests.java b/spring-web/src/test/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactoryTests.java index ba0c48921667..c0298d4ec43f 100644 --- a/spring-web/src/test/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -66,7 +66,7 @@ public void assertCustomConfig() throws Exception { Object config = request.getHttpContext().getAttribute(HttpClientContext.REQUEST_CONFIG); assertThat(config).as("Request config should be set").isNotNull(); - assertThat(config instanceof RequestConfig).as("Wrong request config type" + config.getClass().getName()).isTrue(); + assertThat(config).as("Wrong request config type" + config.getClass().getName()).isInstanceOf(RequestConfig.class); RequestConfig requestConfig = (RequestConfig) config; assertThat(requestConfig.getConnectTimeout()).as("Wrong custom connection timeout").isEqualTo(1234); assertThat(requestConfig.getConnectionRequestTimeout()).as("Wrong custom connection request timeout").isEqualTo(4321); @@ -132,7 +132,7 @@ public HttpClient getHttpClient() { assertThat(requestConfig.getConnectionRequestTimeout()).isEqualTo(-1); assertThat(requestConfig.getSocketTimeout()).isEqualTo(5000); - // Update the Http client so that it returns an updated config + // Update the Http client so that it returns an updated config RequestConfig updatedDefaultConfig = RequestConfig.custom() .setConnectTimeout(1234).build(); given(configurable.getConfig()).willReturn(updatedDefaultConfig);