diff options
author | Emmanuel Bourg <ebourg@apache.org> | 2019-01-01 11:22:29 +0100 |
---|---|---|
committer | Emmanuel Bourg <ebourg@apache.org> | 2019-01-01 11:22:29 +0100 |
commit | d2188a36ffbb40643baa12f9a68494774552563f (patch) | |
tree | be7118bd87b5b0960603ccda439d474261fbd69d /spring-core/src/main/java | |
parent | cb53abe54064010cd788530c7a882ecebb88afcd (diff) |
New upstream version 4.3.21
Diffstat (limited to 'spring-core/src/main/java')
9 files changed, 57 insertions, 49 deletions
diff --git a/spring-core/src/main/java/org/springframework/asm/package-info.java b/spring-core/src/main/java/org/springframework/asm/package-info.java index dc7bf516..69209083 100644 --- a/spring-core/src/main/java/org/springframework/asm/package-info.java +++ b/spring-core/src/main/java/org/springframework/asm/package-info.java @@ -1,7 +1,7 @@ /** * Spring's repackaging of - * <a href="http://asm.ow2.org">ASM</a> - * (for internal use only). + * <a href="http://asm.ow2.org">ASM 6.0</a> + * (with Spring-specific patches; for internal use only). * * <p>This repackaging technique avoids any potential conflicts with * dependencies on ASM at the application level or from third-party diff --git a/spring-core/src/main/java/org/springframework/cglib/package-info.java b/spring-core/src/main/java/org/springframework/cglib/package-info.java index 85d1758e..f82ef60a 100644 --- a/spring-core/src/main/java/org/springframework/cglib/package-info.java +++ b/spring-core/src/main/java/org/springframework/cglib/package-info.java @@ -1,7 +1,7 @@ /** * Spring's repackaging of - * <a href="http://cglib.sourceforge.net">CGLIB</a> - * (for internal use only). + * <a href="https://github.com/cglib/cglib">CGLIB 3.2</a> + * (with Spring naming strategy; for internal use only). * * <p>This repackaging technique avoids any potential conflicts with * dependencies on CGLIB at the application level or from third-party diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index 131bb0a1..69de70c4 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -17,6 +17,7 @@ package org.springframework.core.io.support; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @@ -170,7 +171,7 @@ import org.springframework.util.StringUtils; * @author Colin Sampaleanu * @author Marius Bogoevici * @author Costin Leau - * @author Phil Webb + * @author Phillip Webb * @since 1.0.2 * @see #CLASSPATH_ALL_URL_PREFIX * @see org.springframework.util.AntPathMatcher @@ -716,10 +717,16 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol try { rootDir = rootDirResource.getFile().getAbsoluteFile(); } - catch (IOException ex) { + catch (FileNotFoundException ex) { + if (logger.isInfoEnabled()) { + logger.info("Cannot search for matching files underneath " + rootDirResource + + " in the file system: " + ex.getMessage()); + } + return Collections.emptySet(); + } + catch (Exception ex) { if (logger.isWarnEnabled()) { - logger.warn("Cannot search for matching files underneath " + rootDirResource + - " because it does not correspond to a directory in the file system", ex); + logger.warn("Failed to resolve " + rootDirResource + " in the file system: " + ex); } return Collections.emptySet(); } diff --git a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java index fa378ed0..0f3d891b 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java @@ -57,14 +57,14 @@ import org.springframework.util.StringUtils; */ public abstract class SpringFactoriesLoader { - private static final Log logger = LogFactory.getLog(SpringFactoriesLoader.class); - /** * The location to look for factories. * <p>Can be present in multiple JAR files. */ public static final String FACTORIES_RESOURCE_LOCATION = "META-INF/spring.factories"; + private static final Log logger = LogFactory.getLog(SpringFactoriesLoader.class); + /** * Load and instantiate the factory implementations of the given type from @@ -74,9 +74,9 @@ public abstract class SpringFactoriesLoader { * to obtain all registered factory names. * @param factoryClass the interface or abstract class representing the factory * @param classLoader the ClassLoader to use for loading (can be {@code null} to use the default) - * @see #loadFactoryNames * @throws IllegalArgumentException if any factory implementation class cannot * be loaded or if an error occurs while instantiating any factory + * @see #loadFactoryNames */ public static <T> List<T> loadFactories(Class<T> factoryClass, ClassLoader classLoader) { Assert.notNull(factoryClass, "'factoryClass' must not be null"); @@ -103,8 +103,8 @@ public abstract class SpringFactoriesLoader { * @param factoryClass the interface or abstract class representing the factory * @param classLoader the ClassLoader to use for loading resources; can be * {@code null} to use the default - * @see #loadFactories * @throws IllegalArgumentException if an error occurs while loading factory names + * @see #loadFactories */ public static List<String> loadFactoryNames(Class<?> factoryClass, ClassLoader classLoader) { String factoryClassName = factoryClass.getName(); @@ -115,14 +115,16 @@ public abstract class SpringFactoriesLoader { while (urls.hasMoreElements()) { URL url = urls.nextElement(); Properties properties = PropertiesLoaderUtils.loadProperties(new UrlResource(url)); - String factoryClassNames = properties.getProperty(factoryClassName); - result.addAll(Arrays.asList(StringUtils.commaDelimitedListToStringArray(factoryClassNames))); + String propertyValue = properties.getProperty(factoryClassName); + for (String factoryName : StringUtils.commaDelimitedListToStringArray(propertyValue)) { + result.add(factoryName.trim()); + } } return result; } catch (IOException ex) { - throw new IllegalArgumentException("Unable to load [" + factoryClass.getName() + - "] factories from location [" + FACTORIES_RESOURCE_LOCATION + "]", ex); + throw new IllegalArgumentException("Unable to load factories from location [" + + FACTORIES_RESOURCE_LOCATION + "]", ex); } } diff --git a/spring-core/src/main/java/org/springframework/objenesis/package-info.java b/spring-core/src/main/java/org/springframework/objenesis/package-info.java index 2c5158a7..71cf5123 100644 --- a/spring-core/src/main/java/org/springframework/objenesis/package-info.java +++ b/spring-core/src/main/java/org/springframework/objenesis/package-info.java @@ -1,7 +1,7 @@ /** * Spring's repackaging of - * <a href="http://objenesis.org">Objenesis 2.1</a> - * (for internal use only). + * <a href="http://objenesis.org">Objenesis 2.6</a> + * (with SpringObjenesis entry point; for internal use only). * * <p>This repackaging technique avoids any potential conflicts with * dependencies on different Objenesis versions at the application diff --git a/spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java b/spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java index 886f92c0..81d761ac 100644 --- a/spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java +++ b/spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -367,7 +367,7 @@ public class FastByteArrayOutputStream extends OutputStream { else { if (this.nextIndexInCurrentBuffer < this.currentBufferLength) { this.totalBytesRead++; - return this.currentBuffer[this.nextIndexInCurrentBuffer++]; + return this.currentBuffer[this.nextIndexInCurrentBuffer++] & 0xFF; } else { if (this.buffersIterator.hasNext()) { @@ -487,7 +487,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Update the message digest with the remaining bytes in this stream. - * @param messageDigest The message digest to update + * @param messageDigest the message digest to update */ @Override public void updateMessageDigest(MessageDigest messageDigest) { @@ -497,7 +497,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Update the message digest with the next len bytes in this stream. * Avoids creating new byte arrays and use internal buffers for performance. - * @param messageDigest The message digest to update + * @param messageDigest the message digest to update * @param len how many bytes to read from this stream and use to update the message digest */ @Override diff --git a/spring-core/src/main/java/org/springframework/util/MultiValueMap.java b/spring-core/src/main/java/org/springframework/util/MultiValueMap.java index a526af78..408273db 100644 --- a/spring-core/src/main/java/org/springframework/util/MultiValueMap.java +++ b/spring-core/src/main/java/org/springframework/util/MultiValueMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -30,7 +30,7 @@ public interface MultiValueMap<K, V> extends Map<K, List<V>> { /** * Return the first value for the given key. * @param key the key - * @return the first value for the specified key, or {@code null} + * @return the first value for the specified key, or {@code null} if none */ V getFirst(K key); @@ -55,7 +55,7 @@ public interface MultiValueMap<K, V> extends Map<K, List<V>> { void setAll(Map<K, V> values); /** - * Returns the first values contained in this {@code MultiValueMap}. + * Return a {@code Map} with the first values contained in this {@code MultiValueMap}. * @return a single value representation of this map */ Map<K, V> toSingleValueMap(); diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java index 10db9f54..05a46229 100644 --- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -170,7 +170,7 @@ public abstract class ObjectUtils { /** * Check whether the given array of enum constants contains a constant with the given name, * ignoring case when determining a match. - * @param enumValues the enum values to check, typically the product of a call to MyEnum.values() + * @param enumValues the enum values to check, typically obtained via {@code MyEnum.values()} * @param constant the constant name to find (must not be null or empty string) * @return whether the constant has been found in the given array */ @@ -180,15 +180,14 @@ public abstract class ObjectUtils { /** * Check whether the given array of enum constants contains a constant with the given name. - * @param enumValues the enum values to check, typically the product of a call to MyEnum.values() + * @param enumValues the enum values to check, typically obtained via {@code MyEnum.values()} * @param constant the constant name to find (must not be null or empty string) * @param caseSensitive whether case is significant in determining a match * @return whether the constant has been found in the given array */ public static boolean containsConstant(Enum<?>[] enumValues, String constant, boolean caseSensitive) { for (Enum<?> candidate : enumValues) { - if (caseSensitive ? - candidate.toString().equals(constant) : + if (caseSensitive ? candidate.toString().equals(constant) : candidate.toString().equalsIgnoreCase(constant)) { return true; } @@ -199,7 +198,7 @@ public abstract class ObjectUtils { /** * Case insensitive alternative to {@link Enum#valueOf(Class, String)}. * @param <E> the concrete Enum type - * @param enumValues the array of all Enum constants in question, usually per Enum.values() + * @param enumValues the array of all Enum constants in question, usually per {@code Enum.values()} * @param constant the constant to get the enum value of * @throws IllegalArgumentException if the given constant is not found in the given array * of enum values. Use {@link #containsConstant(Enum[], String)} as a guard to avoid this exception. @@ -210,9 +209,8 @@ public abstract class ObjectUtils { return candidate; } } - throw new IllegalArgumentException( - String.format("constant [%s] does not exist in enum type %s", - constant, enumValues.getClass().getComponentType().getName())); + throw new IllegalArgumentException("Constant [" + constant + "] does not exist in enum type " + + enumValues.getClass().getComponentType().getName()); } /** diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java index a43d016b..4d02886a 100644 --- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java @@ -25,7 +25,6 @@ import java.lang.reflect.UndeclaredThrowableException; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; -import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -635,7 +634,7 @@ public abstract class ReflectionUtils { for (Method ifcMethod : ifc.getMethods()) { if (!Modifier.isAbstract(ifcMethod.getModifiers())) { if (result == null) { - result = new LinkedList<Method>(); + result = new ArrayList<Method>(); } result.add(ifcMethod); } @@ -802,19 +801,8 @@ public abstract class ReflectionUtils { /** - * Pre-built FieldFilter that matches all non-static, non-final fields. - */ - public static final FieldFilter COPYABLE_FIELDS = new FieldFilter() { - - @Override - public boolean matches(Field field) { - return !(Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers())); - } - }; - - - /** * Pre-built MethodFilter that matches all non-bridge methods. + * @since 3.0 */ public static final MethodFilter NON_BRIDGED_METHODS = new MethodFilter() { @@ -828,6 +816,7 @@ public abstract class ReflectionUtils { /** * Pre-built MethodFilter that matches all non-bridge methods * which are not declared on {@code java.lang.Object}. + * @since 3.0.5 */ public static final MethodFilter USER_DECLARED_METHODS = new MethodFilter() { @@ -837,4 +826,16 @@ public abstract class ReflectionUtils { } }; + + /** + * Pre-built FieldFilter that matches all non-static, non-final fields. + */ + public static final FieldFilter COPYABLE_FIELDS = new FieldFilter() { + + @Override + public boolean matches(Field field) { + return !(Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers())); + } + }; + } |