diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java index 34fe7ec5f5b..56e69745e8f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 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. @@ -28,8 +28,8 @@ import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; import org.springframework.util.StringValueResolver; /** - * {@link PlaceholderConfigurerSupport} subclass that resolves ${...} placeholders - * against {@link #setLocation local} {@link #setProperties properties} and/or system properties + * {@link PlaceholderConfigurerSupport} subclass that resolves ${...} placeholders against + * {@link #setLocation local} {@link #setProperties properties} and/or system properties * and environment variables. * *

As of Spring 3.1, {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer @@ -41,19 +41,13 @@ import org.springframework.util.StringValueResolver; *

* - *

Prior to Spring 3.1, the {@code } namespace element - * registered an instance of {@code PropertyPlaceholderConfigurer}. It will still do so if - * using the {@code spring-context-3.0.xsd} definition of the namespace. That is, you can preserve - * registration of {@code PropertyPlaceholderConfigurer} through the namespace, even if using Spring 3.1; - * simply do not update your {@code xsi:schemaLocation} and continue using the 3.0 XSD. - * * @author Juergen Hoeller * @author Chris Beams * @since 02.10.2003 @@ -92,7 +86,6 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport * Set the system property mode by the name of the corresponding constant, * e.g. "SYSTEM_PROPERTIES_MODE_OVERRIDE". * @param constantName name of the constant - * @throws java.lang.IllegalArgumentException if an invalid constant was specified * @see #setSystemPropertiesMode */ public void setSystemPropertiesModeName(String constantName) throws IllegalArgumentException { @@ -124,11 +117,6 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport * against system environment variables. Note that it is generally recommended * to pass external values in as JVM system properties: This can easily be * achieved in a startup script, even for existing environment variables. - *

NOTE: Access to environment variables does not work on the - * Sun VM 1.4, where the corresponding {@link System#getenv} support was - * disabled - before it eventually got re-enabled for the Sun VM 1.5. - * Please upgrade to 1.5 (or higher) if you intend to rely on the - * environment variable support. * @see #setSystemPropertiesMode * @see java.lang.System#getProperty(String) * @see java.lang.System#getenv(String) @@ -250,7 +238,7 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport } - private class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver { + private final class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver { private final Properties props; @@ -261,7 +249,8 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport @Override @Nullable public String resolvePlaceholder(String placeholderName) { - return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName, props, systemPropertiesMode); + return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName, + this.props, systemPropertiesMode); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java index 7e1adbacddd..e75c87bd9bd 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 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. @@ -158,7 +158,7 @@ abstract class AutowireUtils { * on the given method itself. *

For example, given a factory method with the following signature, if * {@code resolveReturnTypeForFactoryMethod()} is invoked with the reflected - * method for {@code creatProxy()} and an {@code Object[]} array containing + * method for {@code createProxy()} and an {@code Object[]} array containing * {@code MyService.class}, {@code resolveReturnTypeForFactoryMethod()} will * infer that the target return type is {@code MyService}. *

{@code public static  T createProxy(Class clazz)}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java index fd4f8666546..e1240f3b657 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 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. @@ -82,9 +82,10 @@ public class ReplaceOverride extends MethodOverride { if (this.typeIdentifiers.size() != method.getParameterCount()) { return false; } + Class[] parameterTypes = method.getParameterTypes(); for (int i = 0; i < this.typeIdentifiers.size(); i++) { String identifier = this.typeIdentifiers.get(i); - if (!method.getParameterTypes()[i].getName().contains(identifier)) { + if (!parameterTypes[i].getName().contains(identifier)) { return false; } } diff --git a/spring-beans/src/test/java/org/springframework/beans/DirectFieldAccessorTests.java b/spring-beans/src/test/java/org/springframework/beans/DirectFieldAccessorTests.java index e67bae0c263..bcce5a86779 100644 --- a/spring-beans/src/test/java/org/springframework/beans/DirectFieldAccessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/DirectFieldAccessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2019 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. @@ -38,7 +38,7 @@ public class DirectFieldAccessorTests extends AbstractPropertyAccessorTests { @Test - public void withShadowedField() throws Exception { + public void withShadowedField() { final StringBuilder sb = new StringBuilder(); @SuppressWarnings("serial") diff --git a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java index 384be563f67..9190f60615d 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 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. @@ -20,7 +20,6 @@ import java.io.Serializable; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; - import org.junit.Test; import org.springframework.aop.interceptor.ExposeInvocationInterceptor; @@ -60,7 +59,7 @@ public class JdkDynamicProxyTests extends AbstractAopProxyTests implements Seria } @Test - public void testProxyIsJustInterface() throws Throwable { + public void testProxyIsJustInterface() { TestBean raw = new TestBean(); raw.setAge(32); AdvisedSupport pc = new AdvisedSupport(ITestBean.class); @@ -73,7 +72,7 @@ public class JdkDynamicProxyTests extends AbstractAopProxyTests implements Seria } @Test - public void testInterceptorIsInvokedWithNoTarget() throws Throwable { + public void testInterceptorIsInvokedWithNoTarget() { // Test return value final int age = 25; MethodInterceptor mi = (invocation -> age); @@ -87,7 +86,7 @@ public class JdkDynamicProxyTests extends AbstractAopProxyTests implements Seria } @Test - public void testTargetCanGetInvocationWithPrivateClass() throws Throwable { + public void testTargetCanGetInvocationWithPrivateClass() { final ExposedInvocationTestBean expectedTarget = new ExposedInvocationTestBean() { @Override protected void assertions(MethodInvocation invocation) { @@ -128,7 +127,7 @@ public class JdkDynamicProxyTests extends AbstractAopProxyTests implements Seria } @Test - public void testEqualsAndHashCodeDefined() throws Exception { + public void testEqualsAndHashCodeDefined() { AdvisedSupport as = new AdvisedSupport(Named.class); as.setTarget(new Person()); JdkDynamicAopProxy aopProxy = new JdkDynamicAopProxy(as); @@ -139,7 +138,7 @@ public class JdkDynamicProxyTests extends AbstractAopProxyTests implements Seria } @Test // SPR-13328 - public void testVarargsWithEnumArray() throws Exception { + public void testVarargsWithEnumArray() { ProxyFactory proxyFactory = new ProxyFactory(new VarargTestBean()); VarargTestInterface proxy = (VarargTestInterface) proxyFactory.getProxy(); assertTrue(proxy.doWithVarargs(MyEnum.A, MyOtherEnum.C)); diff --git a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java b/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java index 2c7318b8d61..5a5f835250a 100644 --- a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java +++ b/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -231,8 +231,8 @@ public abstract class BridgeMethodResolver { if (bridgeMethod == bridgedMethod) { return true; } - return (Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) && - bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType())); + return (bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType()) && + Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes())); } } diff --git a/spring-core/src/main/java/org/springframework/core/ResolvableType.java b/spring-core/src/main/java/org/springframework/core/ResolvableType.java index 68caa7259d5..a46354daf36 100644 --- a/spring-core/src/main/java/org/springframework/core/ResolvableType.java +++ b/spring-core/src/main/java/org/springframework/core/ResolvableType.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -573,8 +573,8 @@ public class ResolvableType implements Serializable { } /** - * Return a {@link ResolvableType} for the specified nesting level. See - * {@link #getNested(int, Map)} for details. + * Return a {@link ResolvableType} for the specified nesting level. + * See {@link #getNested(int, Map)} for details. * @param nestingLevel the nesting level * @return the {@link ResolvableType} type, or {@code #NONE} */ @@ -583,11 +583,11 @@ public class ResolvableType implements Serializable { } /** - * Return a {@link ResolvableType} for the specified nesting level. The nesting level - * refers to the specific generic parameter that should be returned. A nesting level - * of 1 indicates this type; 2 indicates the first nested generic; 3 the second; and so - * on. For example, given {@code List>} level 1 refers to the - * {@code List}, level 2 the {@code Set}, and level 3 the {@code Integer}. + * Return a {@link ResolvableType} for the specified nesting level. + *

The nesting level refers to the specific generic parameter that should be returned. + * A nesting level of 1 indicates this type; 2 indicates the first nested generic; + * 3 the second; and so on. For example, given {@code List>} level 1 refers + * to the {@code List}, level 2 the {@code Set}, and level 3 the {@code Integer}. *

The {@code typeIndexesPerLevel} map can be used to reference a specific generic * for the given level. For example, an index of 0 would refer to a {@code Map} key; * whereas, 1 would refer to the value. If the map does not contain a value for a @@ -596,11 +596,11 @@ public class ResolvableType implements Serializable { * {@code String[]}, a nesting level of 2 refers to {@code String}. *

If a type does not {@link #hasGenerics() contain} generics the * {@link #getSuperType() supertype} hierarchy will be considered. - * @param nestingLevel the required nesting level, indexed from 1 for the current - * type, 2 for the first nested generic, 3 for the second and so on - * @param typeIndexesPerLevel a map containing the generic index for a given nesting - * level (may be {@code null}) - * @return a {@link ResolvableType} for the nested level or {@link #NONE} + * @param nestingLevel the required nesting level, indexed from 1 for the + * current type, 2 for the first nested generic, 3 for the second and so on + * @param typeIndexesPerLevel a map containing the generic index for a given + * nesting level (may be {@code null}) + * @return a {@link ResolvableType} for the nested level, or {@link #NONE} */ public ResolvableType getNested(int nestingLevel, @Nullable Map typeIndexesPerLevel) { ResolvableType result = this; @@ -622,17 +622,17 @@ public class ResolvableType implements Serializable { } /** - * Return a {@link ResolvableType} representing the generic parameter for the given - * indexes. Indexes are zero based; for example given the type + * Return a {@link ResolvableType} representing the generic parameter for the + * given indexes. Indexes are zero based; for example given the type * {@code Map>}, {@code getGeneric(0)} will access the * {@code Integer}. Nested generics can be accessed by specifying multiple indexes; - * for example {@code getGeneric(1, 0)} will access the {@code String} from the nested - * {@code List}. For convenience, if no indexes are specified the first generic is - * returned. + * for example {@code getGeneric(1, 0)} will access the {@code String} from the + * nested {@code List}. For convenience, if no indexes are specified the first + * generic is returned. *

If no generic is available at the specified indexes {@link #NONE} is returned. - * @param indexes the indexes that refer to the generic parameter (may be omitted to - * return the first generic) - * @return a {@link ResolvableType} for the specified generic or {@link #NONE} + * @param indexes the indexes that refer to the generic parameter + * (may be omitted to return the first generic) + * @return a {@link ResolvableType} for the specified generic, or {@link #NONE} * @see #hasGenerics() * @see #getGenerics() * @see #resolveGeneric(int...) @@ -968,8 +968,8 @@ public class ResolvableType implements Serializable { } /** - * Return a {@link ResolvableType} for the specified {@link Class}, doing - * assignability checks against the raw class only (analogous to + * Return a {@link ResolvableType} for the specified {@link Class}, + * doing assignability checks against the raw class only (analogous to * {@link Class#isAssignableFrom}, which this serves as a wrapper for. * For example: {@code ResolvableType.forRawClass(List.class)}. * @param clazz the class to introspect ({@code null} is semantically diff --git a/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java index 3e89da1a161..e4398f3c700 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -340,15 +340,15 @@ public class FormHttpMessageConverter implements HttpMessageConverter parts, - HttpOutputMessage outputMessage) throws IOException { + private void writeMultipart(final MultiValueMap parts, HttpOutputMessage outputMessage) + throws IOException { final byte[] boundary = generateMultipartBoundary(); Map parameters = new LinkedHashMap<>(2); if (!isFilenameCharsetSet()) { parameters.put("charset", this.charset.name()); } - parameters.put("boundary", new String(boundary, "US-ASCII")); + parameters.put("boundary", new String(boundary, StandardCharsets.US_ASCII)); MediaType contentType = new MediaType(MediaType.MULTIPART_FORM_DATA, parameters); HttpHeaders headers = outputMessage.getHeaders(); diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketMessageBrokerStats.java b/spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketMessageBrokerStats.java index 8f5d311e0fd..5b06b3bd2db 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketMessageBrokerStats.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketMessageBrokerStats.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -199,7 +199,7 @@ public class WebSocketMessageBrokerStats { ", stompSubProtocol[" + getStompSubProtocolStatsInfo() + "]" + ", stompBrokerRelay[" + getStompBrokerRelayStatsInfo() + "]" + ", inboundChannel[" + getClientInboundExecutorStatsInfo() + "]" + - ", outboundChannel" + getClientOutboundExecutorStatsInfo() + "]" + + ", outboundChannel[" + getClientOutboundExecutorStatsInfo() + "]" + ", sockJsScheduler[" + getSockJsTaskSchedulerStatsInfo() + "]"; }