summaryrefslogtreecommitdiff
path: root/spring-core
diff options
context:
space:
mode:
Diffstat (limited to 'spring-core')
-rw-r--r--spring-core/src/main/java/org/springframework/asm/package-info.java4
-rw-r--r--spring-core/src/main/java/org/springframework/cglib/package-info.java4
-rw-r--r--spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java17
-rw-r--r--spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java18
-rw-r--r--spring-core/src/main/java/org/springframework/objenesis/package-info.java4
-rw-r--r--spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java8
-rw-r--r--spring-core/src/main/java/org/springframework/util/MultiValueMap.java6
-rw-r--r--spring-core/src/main/java/org/springframework/util/ObjectUtils.java16
-rw-r--r--spring-core/src/main/java/org/springframework/util/ReflectionUtils.java29
-rw-r--r--spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java11
-rw-r--r--spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java54
-rw-r--r--spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java22
-rw-r--r--spring-core/src/test/resources/META-INF/spring.factories4
13 files changed, 104 insertions, 93 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()));
+ }
+ };
+
}
diff --git a/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java b/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java
index 4de87d2c..56939b9c 100644
--- a/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java
+++ b/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 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.
@@ -33,8 +33,7 @@ public class SpringFactoriesLoaderTests {
@Test
public void loadFactoriesInCorrectOrder() {
- List<DummyFactory> factories = SpringFactoriesLoader
- .loadFactories(DummyFactory.class, null);
+ List<DummyFactory> factories = SpringFactoriesLoader.loadFactories(DummyFactory.class, null);
assertEquals(2, factories.size());
assertTrue(factories.get(0) instanceof MyDummyFactory1);
assertTrue(factories.get(1) instanceof MyDummyFactory2);
@@ -46,9 +45,9 @@ public class SpringFactoriesLoaderTests {
}
@Test
- public void loadPackagePrivateFactory() throws Exception {
- List<DummyPackagePrivateFactory> factories = SpringFactoriesLoader
- .loadFactories(DummyPackagePrivateFactory.class, null);
+ public void loadPackagePrivateFactory() {
+ List<DummyPackagePrivateFactory> factories =
+ SpringFactoriesLoader.loadFactories(DummyPackagePrivateFactory.class, null);
assertEquals(1, factories.size());
assertTrue((factories.get(0).getClass().getModifiers() & Modifier.PUBLIC) == 0);
}
diff --git a/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java b/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java
index 15217c87..69bd0466 100644
--- a/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java
+++ b/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 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.
@@ -16,39 +16,34 @@
package org.springframework.util;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
-import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
- * Test suite for {@link FastByteArrayOutputStream}
+ * Test suite for {@link FastByteArrayOutputStream}.
+ *
* @author Craig Andrews
*/
public class FastByteArrayOutputStreamTests {
private static final int INITIAL_CAPACITY = 256;
- private FastByteArrayOutputStream os;
-
- private byte[] helloBytes;
+ private final FastByteArrayOutputStream os = new FastByteArrayOutputStream(INITIAL_CAPACITY);;
-
- @Before
- public void setUp() throws Exception {
- this.os = new FastByteArrayOutputStream(INITIAL_CAPACITY);
- this.helloBytes = "Hello World".getBytes("UTF-8");
- }
+ private final byte[] helloBytes = "Hello World".getBytes(StandardCharsets.UTF_8);;
@Test
public void size() throws Exception {
this.os.write(this.helloBytes);
- assertEquals(this.os.size(), this.helloBytes.length);
+ assertEquals(this.helloBytes.length, this.os.size());
}
@Test
@@ -124,17 +119,26 @@ public class FastByteArrayOutputStreamTests {
@Test
public void getInputStreamAvailable() throws Exception {
this.os.write(this.helloBytes);
- assertEquals(this.os.getInputStream().available(), this.helloBytes.length);
+ assertEquals(this.helloBytes.length, this.os.getInputStream().available());
}
@Test
public void getInputStreamRead() throws Exception {
this.os.write(this.helloBytes);
InputStream inputStream = this.os.getInputStream();
- assertEquals(inputStream.read(), this.helloBytes[0]);
- assertEquals(inputStream.read(), this.helloBytes[1]);
- assertEquals(inputStream.read(), this.helloBytes[2]);
- assertEquals(inputStream.read(), this.helloBytes[3]);
+ assertEquals(this.helloBytes[0], inputStream.read());
+ assertEquals(this.helloBytes[1], inputStream.read());
+ assertEquals(this.helloBytes[2], inputStream.read());
+ assertEquals(this.helloBytes[3], inputStream.read());
+ }
+
+ @Test
+ public void getInputStreamReadBytePromotion() throws Exception {
+ byte[] bytes = new byte[] { -1 };
+ this.os.write(bytes);
+ InputStream inputStream = this.os.getInputStream();
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ assertEquals(bais.read(), inputStream.read());
}
@Test
@@ -166,9 +170,9 @@ public class FastByteArrayOutputStreamTests {
public void getInputStreamSkip() throws Exception {
this.os.write(this.helloBytes);
InputStream inputStream = this.os.getInputStream();
- assertEquals(inputStream.read(), this.helloBytes[0]);
- assertEquals(inputStream.skip(1), 1);
- assertEquals(inputStream.read(), this.helloBytes[2]);
+ assertEquals(this.helloBytes[0], inputStream.read());
+ assertEquals(1, inputStream.skip(1));
+ assertEquals(this.helloBytes[2], inputStream.read());
assertEquals(this.helloBytes.length - 3, inputStream.available());
}
@@ -176,7 +180,7 @@ public class FastByteArrayOutputStreamTests {
public void getInputStreamSkipAll() throws Exception {
this.os.write(this.helloBytes);
InputStream inputStream = this.os.getInputStream();
- assertEquals(inputStream.skip(1000), this.helloBytes.length);
+ assertEquals(this.helloBytes.length, inputStream.skip(1000));
assertEquals(0, inputStream.available());
}
@@ -187,8 +191,7 @@ public class FastByteArrayOutputStreamTests {
InputStream inputStream = this.os.getInputStream();
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
builder.append("\"");
- String actual = builder.toString();
- assertEquals("\"0b10a8db164e0754105b7a99be72e3fe5\"", actual);
+ assertEquals("\"0b10a8db164e0754105b7a99be72e3fe5\"", builder.toString());
}
@Test
@@ -201,8 +204,7 @@ public class FastByteArrayOutputStreamTests {
InputStream inputStream = this.os.getInputStream();
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
builder.append("\"");
- String actual = builder.toString();
- assertEquals("\"06225ca1e4533354c516e74512065331d\"", actual);
+ assertEquals("\"06225ca1e4533354c516e74512065331d\"", builder.toString());
}
diff --git a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java
index d11ea1f7..c783657c 100644
--- a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java
+++ b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java
@@ -45,6 +45,7 @@ public class ObjectUtilsTests {
@Rule
public final ExpectedException exception = ExpectedException.none();
+
@Test
public void isCheckedException() {
assertTrue(ObjectUtils.isCheckedException(new Exception()));
@@ -101,8 +102,8 @@ public class ObjectUtilsTests {
assertTrue(isEmpty(new Object[0]));
assertTrue(isEmpty(new Integer[0]));
- assertFalse(isEmpty(new int[] { 42 }));
- assertFalse(isEmpty(new Integer[] { new Integer(42) }));
+ assertFalse(isEmpty(new int[] {42}));
+ assertFalse(isEmpty(new Integer[] {42}));
}
@Test
@@ -271,7 +272,7 @@ public class ObjectUtilsTests {
@Test
@Deprecated
public void hashCodeWithLong() {
- long lng = 883l;
+ long lng = 883L;
int expected = (new Long(lng)).hashCode();
assertEquals(expected, ObjectUtils.hashCode(lng));
}
@@ -489,12 +490,12 @@ public class ObjectUtilsTests {
@Test
public void nullSafeHashCodeWithLongArray() {
- long lng = 7993l;
+ long lng = 7993L;
int expected = 31 * 7 + (int) (lng ^ (lng >>> 32));
- lng = 84320l;
+ lng = 84320L;
expected = 31 * expected + (int) (lng ^ (lng >>> 32));
- long[] array = {7993l, 84320l};
+ long[] array = {7993L, 84320L};
int actual = ObjectUtils.nullSafeHashCode(array);
assertEquals(expected, actual);
@@ -715,7 +716,7 @@ public class ObjectUtilsTests {
@Test
public void nullSafeToStringWithLongArray() {
- long[] array = {434l, 23423l};
+ long[] array = {434L, 23423L};
assertEquals("{434, 23423}", ObjectUtils.nullSafeToString(array));
}
@@ -737,7 +738,7 @@ public class ObjectUtilsTests {
@Test
public void nullSafeToStringWithObjectArray() {
- Object[] array = {"Han", new Long(43)};
+ Object[] array = {"Han", Long.valueOf(43)};
assertEquals("{Han, 43}", ObjectUtils.nullSafeToString(array));
}
@@ -807,7 +808,8 @@ public class ObjectUtilsTests {
assertThat(ObjectUtils.caseInsensitiveValueOf(Tropes.values(), "BAR"), is(Tropes.BAR));
exception.expect(IllegalArgumentException.class);
- exception.expectMessage(is("constant [bogus] does not exist in enum type org.springframework.util.ObjectUtilsTests$Tropes"));
+ exception.expectMessage(
+ is("Constant [bogus] does not exist in enum type org.springframework.util.ObjectUtilsTests$Tropes"));
ObjectUtils.caseInsensitiveValueOf(Tropes.values(), "bogus");
}
@@ -818,6 +820,6 @@ public class ObjectUtilsTests {
}
- enum Tropes { FOO, BAR, baz }
+ enum Tropes {FOO, BAR, baz}
}
diff --git a/spring-core/src/test/resources/META-INF/spring.factories b/spring-core/src/test/resources/META-INF/spring.factories
index ab64ffe1..3c2c4e9d 100644
--- a/spring-core/src/test/resources/META-INF/spring.factories
+++ b/spring-core/src/test/resources/META-INF/spring.factories
@@ -1,5 +1,5 @@
-org.springframework.core.io.support.DummyFactory=\
-org.springframework.core.io.support.MyDummyFactory2,\
+org.springframework.core.io.support.DummyFactory =\
+org.springframework.core.io.support.MyDummyFactory2, \
org.springframework.core.io.support.MyDummyFactory1
java.lang.String=\