...
 
Commits (7)
......@@ -62,11 +62,11 @@ configure(allprojects) { project ->
ext.jtaVersion = "1.2"
ext.junitVersion = "4.12"
ext.log4jVersion = "1.2.17"
ext.nettyVersion = "4.1.31.Final"
ext.nettyVersion = "4.1.32.Final"
ext.okhttpVersion = "2.7.5"
ext.okhttp3Version = "3.8.1"
ext.openjpaVersion = "2.4.2"
ext.poiVersion = "3.14"
ext.poiVersion = "3.17"
ext.reactorVersion = "2.0.8.RELEASE"
ext.romeVersion = "1.7.4"
ext.slf4jVersion = "1.7.25"
......@@ -75,7 +75,7 @@ configure(allprojects) { project ->
ext.testngVersion = "6.9.10"
ext.tiles2Version = "2.2.2"
ext.tiles3Version = "3.0.8"
ext.tomcatVersion = "8.5.35"
ext.tomcatVersion = "8.5.37"
ext.tyrusVersion = "1.3.5" // constrained by WebLogic 12.1.3 support
ext.undertowVersion = "1.3.33.Final"
ext.xmlunitVersion = "1.6"
......@@ -206,7 +206,8 @@ configure(allprojects) { project ->
"http://fasterxml.github.io/jackson-core/javadoc/2.8/",
"http://fasterxml.github.io/jackson-databind/javadoc/2.8/",
"http://fasterxml.github.io/jackson-dataformat-xml/javadoc/2.8/",
"http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/"
"http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/",
"https://junit.org/junit4/javadoc/${junitVersion}/"
] as String[]
}
......
libspring-java (4.3.22-1) unstable; urgency=medium
* Team upload.
* New upstream release
- Refreshed the patches
* Depend on librome-java (>= 1.6)
* Depend on libapache-poi-java (>= 4.0)
* Switch from libservlet3.1-java to lib{servlet,jsp,el,websocket}-api-java
-- Emmanuel Bourg <ebourg@apache.org> Tue, 22 Jan 2019 21:44:42 +0100
libspring-java (4.3.21-2) unstable; urgency=medium
* Team upload.
......
......@@ -14,7 +14,7 @@ Build-Depends-Indep: bsh,
jruby (>= 1.7.19~),
junit4 (>= 4.5),
libactivation-java,
libapache-poi-java,
libapache-poi-java (>= 4.0),
libasm-java (>= 5.0),
libaspectj-java,
libatinject-jsr330-api-java,
......@@ -32,6 +32,7 @@ Build-Depends-Indep: bsh,
libecj-java,
libeclipselink-java,
libehcache-java,
libel-api-java,
libfreemarker-java,
libgeronimo-annotation-1.3-spec-java,
libgeronimo-commonj-spec-java (>= 1.1.1-3),
......@@ -65,6 +66,7 @@ Build-Depends-Indep: bsh,
libjpa-2.1-spec-java,
libjsf-api-java,
libjsonpath-java,
libjsp-api-java,
libjws-api-java,
libmail-java,
libnetty-java,
......@@ -74,14 +76,15 @@ Build-Depends-Indep: bsh,
libprotobuf-java-format-java (>= 1.3),
libquartz2-java,
libreactor-core-java (>= 2.0.8),
librome-java,
libservlet3.1-java,
librome-java (>= 1.6),
libservlet-api-java,
libtaglibs-standard-jstlel-java,
libtiles-java (>= 3.0),
libtomcat9-java,
libvelocity-tools-java (>= 2.0-3),
libwebjars-locator-java,
libwebjars-locator-core-java,
libwebsocket-api-java,
libxmlbeans-java,
libxmlunit-java,
libxstream-java,
......
......@@ -2,7 +2,6 @@ com.fasterxml.jackson.core jackson-databind * s/.*/2.x/ * *
com.fasterxml.jackson.dataformat jackson-dataformat-xml * s/.*/2.x/ * *
s/com.mchange/c3p0/ c3p0 * s/.*/debian/ * *
s/hsqldb/org.hsqldb/ hsqldb * s/.*/debian/ * *
javax.el javax.el-api * s/.*/3.0/ * *
s/javax.cache/org.apache.geronimo.specs/ s/cache-api/geronimo-jcache_1.0_spec/ * s/.*/debian/ * *
s/javax.enterprise.concurrent/org.apache.geronimo.specs/ s/javax.enterprise.concurrent-api/geronimo-concurrent_1.0_spec/ * s/.*/debian/ * *
s/javax.faces/com.sun.faces/ s/javax.faces-api/jsf-api/ * s/.*/debian/ * *
......@@ -10,11 +9,8 @@ s/javax.jms/org.apache.geronimo.specs/ s/jms-api/geronimo-jms_1.1_spec/ * s/.*/d
javax.portlet portlet-api * * * *
s/javax.resource/org.apache.geronimo.specs/ s/connector-api/geronimo-j2ee-connector_1.5_spec/ * s/.*/debian/ * *
s/javax.servlet.jsp.jstl/org.apache.taglibs/ s/javax.servlet.jsp.jstl-api/taglibs-standard-spec/ * s/.*/debian/ * *
javax.servlet javax.servlet-api * s/.*/3.1/ * *
javax.servlet.jsp javax.servlet.jsp-api * s/2.*/2.3/ * * *
s/javax.transaction/org.apache.geronimo.specs/ s/javax.transaction-api/geronimo-jta_1.2_spec/ * s/.*/debian/ * *
s/javax.validation/org.apache.geronimo.specs/ s/validation-api/geronimo-validation_1.0_spec/ * s/.*/debian/ * *
javax.websocket javax.websocket-api * * * *
junit junit * s/.*/4.x/ * *
log4j log4j * s/.*/1.2.x/ * *
org.apache.tomcat s/catalina/tomcat-catalina/ * s/.*/9.x/ * *
......@@ -32,5 +28,4 @@ s/velocity/org.apache.velocity/ velocity * s/.*/debian/ * *
org.apache.jdo parent-pom * * * *
org.yaml snakeyaml * s/.*/1.x/ * *
net.sf.ehcache s/ehcache/ehcache-core/ * s/.*/debian/ * *
s/com.rometools/rome/ rome * s/.*/debian/ * *
org.quartz-scheduler quartz * s/.*/2.x/ * *
......@@ -4,7 +4,7 @@ Last-Update: 2010-06-20
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -585,6 +585,15 @@
@@ -586,6 +586,15 @@
testCompile("org.eclipse.persistence:javax.persistence:2.0.0")
testCompile("org.codehaus.groovy:groovy-all:${groovyVersion}")
}
......
......@@ -4,7 +4,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -1155,7 +1155,6 @@
@@ -1156,7 +1156,6 @@
description = "Spring Framework"
apply plugin: "org.asciidoctor.convert"
......@@ -12,7 +12,7 @@ Forwarded: not-needed
apply plugin: "groovy"
// apply plugin: "detect-split-packages"
@@ -1169,13 +1168,6 @@
@@ -1170,13 +1169,6 @@
attributes 'spring-version': project.version, 'revnumber': project.version, 'docinfo': ""
}
......@@ -26,7 +26,7 @@ Forwarded: not-needed
afterEvaluate {
tasks.findAll { it.name.startsWith("reference") }.each{ it.dependsOn.add("asciidoctor") }
}
@@ -1249,7 +1241,7 @@
@@ -1250,7 +1242,7 @@
}
}
......@@ -35,7 +35,7 @@ Forwarded: not-needed
group = "Distribution"
baseName = "spring-framework"
classifier = "docs"
@@ -1263,10 +1255,6 @@
@@ -1264,10 +1256,6 @@
from (api) {
into "javadoc-api"
}
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -1158,7 +1158,7 @@
@@ -1159,7 +1159,7 @@
apply plugin: "groovy"
// apply plugin: "detect-split-packages"
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -1154,24 +1154,11 @@
@@ -1155,24 +1155,11 @@
configure(rootProject) {
description = "Spring Framework"
......
......@@ -14,7 +14,7 @@ Forwarded: not-needed
ext {
linkHomepage = 'https://projects.spring.io/spring-framework'
linkCi = 'https://build.spring.io/browse/SPR'
@@ -1137,20 +1133,6 @@
@@ -1138,20 +1134,6 @@
}
}
......@@ -35,7 +35,7 @@ Forwarded: not-needed
configure(rootProject) {
description = "Spring Framework"
@@ -1366,21 +1348,6 @@
@@ -1367,21 +1349,6 @@
}
......
Description: Use the older ROME API available in Debian
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java
@@ -21,8 +21,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import com.rometools.rome.feed.atom.Entry;
-import com.rometools.rome.feed.atom.Feed;
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
/**
* Abstract superclass for Atom Feed views, using the
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractFeedView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractFeedView.java
@@ -22,8 +22,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import com.rometools.rome.feed.WireFeed;
-import com.rometools.rome.io.WireFeedOutput;
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.io.WireFeedOutput;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.view.AbstractView;
--- a/spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java
+++ b/spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java
@@ -23,10 +23,10 @@
import java.io.Writer;
import java.nio.charset.Charset;
-import com.rometools.rome.feed.WireFeed;
-import com.rometools.rome.io.FeedException;
-import com.rometools.rome.io.WireFeedInput;
-import com.rometools.rome.io.WireFeedOutput;
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.WireFeedInput;
+import com.sun.syndication.io.WireFeedOutput;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
--- a/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java
+++ b/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java
@@ -16,7 +16,7 @@
package org.springframework.http.converter.feed;
-import com.rometools.rome.feed.atom.Feed;
+import com.sun.syndication.feed.atom.Feed;
import org.springframework.http.MediaType;
--- a/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java
+++ b/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java
@@ -16,7 +16,7 @@
package org.springframework.http.converter.feed;
-import com.rometools.rome.feed.rss.Channel;
+import com.sun.syndication.feed.rss.Channel;
import org.springframework.http.MediaType;
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java
@@ -21,8 +21,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import com.rometools.rome.feed.rss.Channel;
-import com.rometools.rome.feed.rss.Item;
+import com.sun.syndication.feed.rss.Channel;
+import com.sun.syndication.feed.rss.Item;
import org.springframework.http.MediaType;
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -765,6 +765,7 @@
@@ -766,6 +766,7 @@
exclude group: 'org.apache.geronimo.specs', module: 'geronimo-jta_1.1_spec'
exclude group: 'org.apache.geronimo.specs', module: 'geronimo-jms_1.1_spec'
}
......
......@@ -29,7 +29,7 @@ Forwarded: not-needed
// just handling JSR-310 specific date and time types
--- a/build.gradle
+++ b/build.gradle
@@ -492,6 +492,14 @@
@@ -493,6 +493,14 @@
testCompile("org.apache.commons:commons-pool2:2.4.2")
testCompile("org.slf4j:slf4j-api:${slf4jVersion}")
}
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -742,6 +742,14 @@
@@ -743,6 +743,14 @@
testCompile("com.squareup.okhttp3:mockwebserver:${okhttp3Version}")
testRuntime("com.sun.mail:javax.mail:${javamailVersion}")
}
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -1060,6 +1060,15 @@
@@ -1061,6 +1061,15 @@
testRuntime("log4j:log4j:${log4jVersion}")
}
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -673,6 +673,14 @@
@@ -674,6 +674,14 @@
testRuntime("org.ehcache:ehcache:${ehcache3Version}")
testRuntime("org.terracotta:management-model:2.3.0")
}
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -475,7 +475,8 @@
@@ -476,7 +476,8 @@
compile(files(project(":spring-core").cglibRepackJar))
optional(project(":spring-instrument"))
optional("javax.inject:javax.inject:1")
......@@ -13,7 +13,7 @@ Forwarded: not-needed
optional("javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0")
optional("javax.money:money-api:1.0.1")
optional("org.eclipse.persistence:javax.persistence:2.0.0")
@@ -583,7 +584,8 @@
@@ -584,7 +585,8 @@
optional(project(":spring-context")) // for JCA, @EnableTransactionManagement
optional("javax.transaction:javax.transaction-api:${jtaVersion}")
optional("javax.resource:connector-api:1.5")
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -347,6 +347,8 @@
@@ -348,6 +348,8 @@
compile(files(cglibRepackJar))
compile(files(objenesisRepackJar))
compile("commons-logging:commons-logging:1.2")
......@@ -12,7 +12,7 @@ Forwarded: not-needed
optional("commons-codec:commons-codec:1.10")
optional("org.aspectj:aspectjweaver:${aspectjVersion}")
optional("net.sf.jopt-simple:jopt-simple:5.0.3")
@@ -487,6 +489,8 @@
@@ -488,6 +490,8 @@
optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
optional("org.beanshell:bsh:2.0b5")
optional("org.jruby:jruby:${jrubyVersion}")
......@@ -21,7 +21,7 @@ Forwarded: not-needed
testCompile("javax.inject:javax.inject-tck:1")
testCompile("org.javamoney:moneta:1.1")
testCompile("commons-dbcp:commons-dbcp:1.4")
@@ -717,6 +721,7 @@
@@ -718,6 +722,7 @@
optional("javax.el:javax.el-api:2.2.5")
optional("javax.faces:javax.faces-api:2.2")
optional("javax.validation:validation-api:1.0.0.GA")
......
Description: Fixes the compatibility with the version of Apache POI in Debian
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractExcelView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractExcelView.java
@@ -217,7 +217,7 @@
* @param text the text to put in the cell
*/
protected void setText(HSSFCell cell, String text) {
- cell.setCellType(HSSFCell.CELL_TYPE_STRING);
+ cell.setCellType(org.apache.poi.ss.usermodel.CellType.STRING);
cell.setCellValue(text);
}
......@@ -6,7 +6,6 @@
0035-ignore-asciidoctor-plugin.patch
0036-ignore-compilation-warnings.patch
0037-ignore-sonar-plugin.patch
0038-rome-compatibility.patch
0039-openjpa-compatibility.patch
0040-ignore-json-assert.patch
0041-servlet-api-compatibility.patch
......@@ -18,3 +17,4 @@
0047-ejb-api-compatibility.patch
0048-snakeyaml-compatibility.patch
0049-java11-compatibility.patch
0050-apache-poi-compatibility.patch
version=4.3.21.RELEASE
version=4.3.22.RELEASE
/*
* 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.
......@@ -28,32 +28,26 @@ 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.
*
* <p>As of Spring 3.1, {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
* PropertySourcesPlaceholderConfigurer} should be used preferentially over this implementation; it is
* more flexible through taking advantage of the {@link org.springframework.core.env.Environment Environment} and
* {@link org.springframework.core.env.PropertySource PropertySource} mechanisms also made available in Spring 3.1.
* more flexible through taking advantage of the {@link org.springframework.core.env.Environment} and
* {@link org.springframework.core.env.PropertySource} mechanisms also made available in Spring 3.1.
*
* <p>{@link PropertyPlaceholderConfigurer} is still appropriate for use when:
* <ul>
* <li>the {@code spring-context} module is not available (i.e., one is using Spring's
* {@code BeanFactory} API as opposed to {@code ApplicationContext}).
* <li>existing configuration makes use of the {@link #setSystemPropertiesMode(int) "systemPropertiesMode"} and/or
* {@link #setSystemPropertiesModeName(String) "systemPropertiesModeName"} properties. Users are encouraged to move
* away from using these settings, and rather configure property source search order through the container's
* {@code Environment}; however, exact preservation of functionality may be maintained by continuing to
* use {@code PropertyPlaceholderConfigurer}.
* <li>existing configuration makes use of the {@link #setSystemPropertiesMode(int) "systemPropertiesMode"}
* and/or {@link #setSystemPropertiesModeName(String) "systemPropertiesModeName"} properties.
* Users are encouraged to move away from using these settings, and rather configure property
* source search order through the container's {@code Environment}; however, exact preservation
* of functionality may be maintained by continuing to use {@code PropertyPlaceholderConfigurer}.
* </ul>
*
* <p>Prior to Spring 3.1, the {@code <context:property-placeholder/>} 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,14 +117,9 @@ 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.
* <p><b>NOTE:</b> 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)
* @see System#getProperty(String)
* @see System#getenv(String)
*/
public void setSearchSystemEnvironment(boolean searchSystemEnvironment) {
this.searchSystemEnvironment = searchSystemEnvironment;
......@@ -264,7 +252,7 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
}
private class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver {
private final class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver {
private final Properties props;
......@@ -274,7 +262,8 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
@Override
public String resolvePlaceholder(String placeholderName) {
return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName, props, systemPropertiesMode);
return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName,
this.props, systemPropertiesMode);
}
}
......
/*
* 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.
......@@ -164,7 +164,7 @@ abstract class AutowireUtils {
* on the given method itself.
* <p>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}.
* <pre class="code">{@code public static <T> T createProxy(Class<T> clazz)}</pre>
......
/*
* 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.
......@@ -1594,7 +1594,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
/**
* A dependency descriptor marker for multiple elements.
* A dependency descriptor for a multi-element declaration with nested elements.
*/
private static class MultiElementDescriptor extends NestedDependencyDescriptor {
......@@ -1622,7 +1622,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
super.resolveCandidate(beanName, requiredType, beanFactory));
}
};
return Optional.ofNullable(doResolveDependency(descriptorToUse, beanName, null, null));
Object result = doResolveDependency(descriptorToUse, beanName, null, null);
return (result instanceof Optional ? (Optional<?>) result : Optional.ofNullable(result));
}
}
......
/*
* Copyright 2002-2014 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.
......@@ -79,12 +79,13 @@ public class ReplaceOverride extends MethodOverride {
return true;
}
// If we get here, we need to insist on precise argument matching...
if (this.typeIdentifiers.size() != method.getParameterTypes().length) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (this.typeIdentifiers.size() != parameterTypes.length) {
return false;
}
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;
}
}
......
/*
* 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.
......@@ -340,21 +340,21 @@ public class BeanDefinitionParserDelegate {
*/
protected void populateDefaults(DocumentDefaultsDefinition defaults, DocumentDefaultsDefinition parentDefaults, Element root) {
String lazyInit = root.getAttribute(DEFAULT_LAZY_INIT_ATTRIBUTE);
if (DEFAULT_VALUE.equals(lazyInit)) {
if (isDefaultValue(lazyInit)) {
// Potentially inherited from outer <beans> sections, otherwise falling back to false.
lazyInit = (parentDefaults != null ? parentDefaults.getLazyInit() : FALSE_VALUE);
}
defaults.setLazyInit(lazyInit);
String merge = root.getAttribute(DEFAULT_MERGE_ATTRIBUTE);
if (DEFAULT_VALUE.equals(merge)) {
if (isDefaultValue(merge)) {
// Potentially inherited from outer <beans> sections, otherwise falling back to false.
merge = (parentDefaults != null ? parentDefaults.getMerge() : FALSE_VALUE);
}
defaults.setMerge(merge);
String autowire = root.getAttribute(DEFAULT_AUTOWIRE_ATTRIBUTE);
if (DEFAULT_VALUE.equals(autowire)) {
if (isDefaultValue(autowire)) {
// Potentially inherited from outer <beans> sections, otherwise falling back to 'no'.
autowire = (parentDefaults != null ? parentDefaults.getAutowire() : AUTOWIRE_NO_VALUE);
}
......@@ -593,7 +593,7 @@ public class BeanDefinitionParserDelegate {
}
String lazyInit = ele.getAttribute(LAZY_INIT_ATTRIBUTE);
if (DEFAULT_VALUE.equals(lazyInit)) {
if (isDefaultValue(lazyInit)) {
lazyInit = this.defaults.getLazyInit();
}
bd.setLazyInit(TRUE_VALUE.equals(lazyInit));
......@@ -610,7 +610,7 @@ public class BeanDefinitionParserDelegate {
}
String autowireCandidate = ele.getAttribute(AUTOWIRE_CANDIDATE_ATTRIBUTE);
if ("".equals(autowireCandidate) || DEFAULT_VALUE.equals(autowireCandidate)) {
if (isDefaultValue(autowireCandidate)) {
String candidatePattern = this.defaults.getAutowireCandidates();
if (candidatePattern != null) {
String[] patterns = StringUtils.commaDelimitedListToStringArray(candidatePattern);
......@@ -691,7 +691,7 @@ public class BeanDefinitionParserDelegate {
@SuppressWarnings("deprecation")
public int getAutowireMode(String attValue) {
String att = attValue;
if (DEFAULT_VALUE.equals(att)) {
if (isDefaultValue(att)) {
att = this.defaults.getAutowire();
}
int autowire = AbstractBeanDefinition.AUTOWIRE_NO;
......@@ -1390,7 +1390,7 @@ public class BeanDefinitionParserDelegate {
*/
public boolean parseMergeAttribute(Element collectionElement) {
String value = collectionElement.getAttribute(MERGE_ATTRIBUTE);
if (DEFAULT_VALUE.equals(value)) {
if (isDefaultValue(value)) {
value = this.defaults.getMerge();
}
return TRUE_VALUE.equals(value);
......@@ -1519,6 +1519,10 @@ public class BeanDefinitionParserDelegate {
return isDefaultNamespace(getNamespaceURI(node));
}
private boolean isDefaultValue(String value) {
return (DEFAULT_VALUE.equals(value) || "".equals(value));
}
private boolean isCandidateElement(Node node) {
return (node instanceof Element && (isDefaultNamespace(node) || !isDefaultNamespace(node.getParentNode())));
}
......
/*
* 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")
......
/*
* Copyright 2002-2013 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.
......@@ -41,6 +41,21 @@ public class NestedBeansElementAttributeRecursionTests {
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
assertLazyInits(bf);
}
@Test
public void defaultLazyInitWithNonValidatingParser() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
xmlBeanDefinitionReader.setValidating(false);
xmlBeanDefinitionReader.loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
assertLazyInits(bf);
}
private void assertLazyInits(DefaultListableBeanFactory bf) {
BeanDefinition foo = bf.getBeanDefinition("foo");
BeanDefinition bar = bf.getBeanDefinition("bar");
BeanDefinition baz = bf.getBeanDefinition("baz");
......@@ -61,6 +76,22 @@ public class NestedBeansElementAttributeRecursionTests {
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
assertMerge(bf);
}
@Test
@SuppressWarnings("unchecked")
public void defaultMergeWithNonValidatingParser() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
xmlBeanDefinitionReader.setValidating(false);
xmlBeanDefinitionReader.loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
assertMerge(bf);
}
private void assertMerge(DefaultListableBeanFactory bf) {
TestBean topLevel = bf.getBean("topLevelConcreteTestBean", TestBean.class);
// has the concrete child bean values
assertThat((Iterable<String>) topLevel.getSomeList(), hasItems("charlie", "delta"));
......@@ -84,6 +115,21 @@ public class NestedBeansElementAttributeRecursionTests {
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
assertAutowireCandidates(bf);
}
@Test
public void defaultAutowireCandidatesWithNonValidatingParser() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
xmlBeanDefinitionReader.setValidating(false);
xmlBeanDefinitionReader.loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
assertAutowireCandidates(bf);
}
private void assertAutowireCandidates(DefaultListableBeanFactory bf) {
assertThat(bf.getBeanDefinition("fooService").isAutowireCandidate(), is(true));
assertThat(bf.getBeanDefinition("fooRepository").isAutowireCandidate(), is(true));
assertThat(bf.getBeanDefinition("other").isAutowireCandidate(), is(false));
......
/*
* Copyright 2002-2015 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.
......@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.activation.FileTypeMap;
import javax.mail.Address;
import javax.mail.AuthenticationFailedException;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
......@@ -390,7 +391,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
/**
* Actually send the given array of MimeMessages via JavaMail.
* @param mimeMessages MimeMessage objects to send
* @param mimeMessages the MimeMessage objects to send
* @param originalMessages corresponding original message objects
* that the MimeMessages have been created from (with same array
* length and indices as the "mimeMessages" array), if any
......@@ -445,7 +446,8 @@ public class JavaMailSenderImpl implements JavaMailSender {
// Preserve explicitly specified message id...
mimeMessage.setHeader(HEADER_MESSAGE_ID, messageId);
}
transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients());
Address[] addresses = mimeMessage.getAllRecipients();
transport.sendMessage(mimeMessage, (addresses != null ? addresses : new Address[0]));
}
catch (Exception ex) {
Object original = (originalMessages != null ? originalMessages[i] : mimeMessage);
......
/*
* Copyright 2002-2015 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.
......@@ -56,6 +56,7 @@ public class JavaMailSenderTests {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Test
public void javaMailSenderWithSimpleMessage() throws MessagingException, IOException {
MockJavaMailSender sender = new MockJavaMailSender();
......@@ -105,7 +106,8 @@ public class JavaMailSenderTests {
assertEquals("my text", sentMessage.getContent());
}
public void testJavaMailSenderWithSimpleMessages() throws MessagingException, IOException {
@Test
public void javaMailSenderWithSimpleMessages() throws MessagingException {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost("host");
sender.setUsername("username");
......@@ -133,7 +135,8 @@ public class JavaMailSenderTests {
assertEquals("she@mail.org", ((InternetAddress) tos2.get(0)).getAddress());
}
public void testJavaMailSenderWithMimeMessage() throws MessagingException {
@Test
public void javaMailSenderWithMimeMessage() throws MessagingException {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost("host");
sender.setUsername("username");
......@@ -180,7 +183,7 @@ public class JavaMailSenderTests {
sender.setUsername("username");
sender.setPassword("password");
final List<Message> messages = new ArrayList<Message>();
final List<Message> messages = new ArrayList<>();
MimeMessagePreparator preparator = new MimeMessagePreparator() {
@Override
......@@ -206,7 +209,7 @@ public class JavaMailSenderTests {
sender.setUsername("username");
sender.setPassword("password");
final List<Message> messages = new ArrayList<Message>();
final List<Message> messages = new ArrayList<>();
MimeMessagePreparator preparator1 = new MimeMessagePreparator() {
@Override
......@@ -394,7 +397,7 @@ public class JavaMailSenderTests {
}
@Test
public void failedMailServerConnect() throws Exception {
public void failedMailServerConnect() {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost(null);
sender.setUsername("username");
......@@ -415,7 +418,7 @@ public class JavaMailSenderTests {
}
@Test
public void failedMailServerClose() throws Exception {
public void failedMailServerClose() {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost("");
sender.setUsername("username");
......@@ -434,7 +437,7 @@ public class JavaMailSenderTests {
}
@Test
public void failedSimpleMessage() throws Exception {
public void failedSimpleMessage() throws MessagingException {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost("host");
sender.setUsername("username");
......@@ -466,7 +469,7 @@ public class JavaMailSenderTests {
}
@Test
public void fFailedMimeMessage() throws Exception {
public void failedMimeMessage() throws MessagingException {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost("host");
sender.setUsername("username");
......@@ -498,14 +501,14 @@ public class JavaMailSenderTests {
}
@Test
public void testConnection() throws Exception {
public void testConnection() throws MessagingException {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost("host");
sender.testConnection();
}
@Test
public void testConnectionWithFailure() throws Exception {
public void testConnectionWithFailure() throws MessagingException {
MockJavaMailSender sender = new MockJavaMailSender();
sender.setHost(null);
......@@ -533,7 +536,7 @@ public class JavaMailSenderTests {
private String connectedUsername = null;
private String connectedPassword = null;
private boolean closeCalled = false;
private List<Message> sentMessages = new ArrayList<Message>();
private List<Message> sentMessages = new ArrayList<>();
private MockTransport(Session session, URLName urlName) {
super(session, urlName);
......@@ -592,7 +595,8 @@ public class JavaMailSenderTests {
if ("fail".equals(message.getSubject())) {
throw new MessagingException("failed");
}
if (!ObjectUtils.nullSafeEquals(addresses, message.getAllRecipients())) {
if (addresses == null || (message.getAllRecipients() == null ? addresses.length > 0 :
!ObjectUtils.nullSafeEquals(addresses, message.getAllRecipients()))) {
throw new MessagingException("addresses not correct");
}
if (message.getSentDate() == null) {
......
/*
* Copyright 2002-2015 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.
......@@ -41,13 +41,14 @@ import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRPdfExporterParameter;
import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
import net.sf.jasperreports.engine.util.JRLoader;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.tests.Assume;
......@@ -149,6 +150,7 @@ public class JasperReportsUtilsTests {
}
@Test
@Ignore("JasperReports 6.2.1 is incompatible with POI 3.17")
public void renderAsXlsWithDataSource() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
JasperReportsUtils.renderAsXls(getReport(), getParameters(), getDataSource(), os);
......@@ -157,6 +159,7 @@ public class JasperReportsUtilsTests {
}
@Test
@Ignore("JasperReports 6.2.1 is incompatible with POI 3.17")
public void renderAsXlsWithCollection() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
JasperReportsUtils.renderAsXls(getReport(), getParameters(), getData(), os);
......@@ -165,6 +168,7 @@ public class JasperReportsUtilsTests {
}
@Test
@Ignore("JasperReports 6.2.1 is incompatible with POI 3.17")
public void renderAsXlsWithExporterParameters() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
Map<JRExporterParameter, Object> exporterParameters = new HashMap<JRExporterParameter, Object>();
......
/*
* 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));
......
/*
* 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.
......@@ -25,6 +25,7 @@ import java.net.URI;
import java.net.URL;
import java.security.AccessControlException;
import java.security.Permission;
import java.util.Optional;
import java.util.Properties;
import org.apache.commons.logging.Log;
......@@ -45,7 +46,7 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.AnnotationConfigUtils;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
......@@ -61,6 +62,7 @@ import static org.junit.Assert.*;
/**
* @author Juergen Hoeller
* @author Sam Brannen
* @since 3.0
*/
public class ApplicationContextExpressionTests {
......@@ -100,6 +102,8 @@ public class ApplicationContextExpressionTests {
}
});
ac.getBeanFactory().setConversionService(new DefaultConversionService());
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
Properties placeholders = new Properties();
placeholders.setProperty("code", "123");
......@@ -174,6 +178,9 @@ public class ApplicationContextExpressionTests {
System.getProperties().put("country", "UK");
assertEquals("123 UK", tb3.country);
assertEquals("123 UK", tb3.countryFactory.getObject());
assertEquals("123", tb3.optionalValue1.get());
assertEquals("123", tb3.optionalValue2.get());
assertFalse(tb3.optionalValue3.isPresent());
assertSame(tb0, tb3.tb);
tb3 = (ValueTestBean) SerializationTestUtils.serializeAndDeserialize(tb3);
......@@ -207,12 +214,7 @@ public class ApplicationContextExpressionTests {
GenericApplicationContext ac = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);
GenericConversionService cs = new GenericConversionService();
cs.addConverter(String.class, String.class, new Converter<String, String>() {
@Override
public String convert(String source) {
return source.trim();
}
});
cs.addConverter(String.class, String.class, String::trim);
ac.getBeanFactory().registerSingleton(GenericApplicationContext.CONVERSION_SERVICE_BEAN_NAME, cs);
RootBeanDefinition rbd = new RootBeanDefinition(PrototypeTestBean.class);
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
......@@ -274,8 +276,7 @@ public class ApplicationContextExpressionTests {
@Test
public void systemPropertiesSecurityManager() {
GenericApplicationContext ac = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setBeanClass(TestBean.class);
......@@ -311,8 +312,7 @@ public class ApplicationContextExpressionTests {
@Test
public void stringConcatenationWithDebugLogging() {
GenericApplicationContext ac = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setBeanClass(String.class);
......@@ -327,8 +327,7 @@ public class ApplicationContextExpressionTests {
@Test
public void resourceInjection() throws IOException {
System.setProperty("logfile", "log4j.properties");
try {
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(ResourceInjectionBean.class);
try (AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(ResourceInjectionBean.class)) {
ResourceInjectionBean resourceInjectionBean = ac.getBean(ResourceInjectionBean.class);
Resource resource = new ClassPathResource("log4j.properties");
assertEquals(resource, resourceInjectionBean.resource);
......@@ -364,6 +363,15 @@ public class ApplicationContextExpressionTests {
@Value("${code} #{systemProperties.country}")
public ObjectFactory<String> countryFactory;
@Value("${code}")
private transient Optional<String> optionalValue1;
@Value("${code:#{null}}")
private transient Optional<String> optionalValue2;
@Value("${codeX:#{null}}")
private transient Optional<String> optionalValue3;
@Autowired @Qualifier("original")
public transient TestBean tb;
}
......
/*
* 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.
......@@ -226,8 +226,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()));
}
}
/*
* 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.
......@@ -189,7 +189,7 @@ public abstract class CollectionFactory {
throw new IllegalArgumentException("Unsupported Collection interface: " + collectionType.getName());
}
}
else if (EnumSet.class == collectionType) {
else if (EnumSet.class.isAssignableFrom(collectionType)) {
Assert.notNull(elementType, "Cannot create EnumSet for unknown element type");
// Cast is necessary for compilation in Eclipse 4.4.1.
return (Collection<E>) EnumSet.noneOf(asEnumType(elementType));
......
/*
* 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.
......@@ -559,8 +559,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}
*/
......@@ -569,11 +569,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<Set<Integer>>} 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.
* <p>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<Set<Integer>>} level 1 refers
* to the {@code List}, level 2 the {@code Set}, and level 3 the {@code Integer}.
* <p>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
......@@ -582,11 +582,11 @@ public class ResolvableType implements Serializable {
* {@code String[]}, a nesting level of 2 refers to {@code String}.
* <p>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, Map<Integer, Integer> typeIndexesPerLevel) {
ResolvableType result = this;
......@@ -608,17 +608,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<Integer, List<String>>}, {@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.
* <p>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...)
......@@ -693,9 +693,8 @@ public class ResolvableType implements Serializable {
* Convenience method that will {@link #getGenerics() get} and {@link #resolve()
* resolve} generic parameters, using the specified {@code fallback} if any type
* cannot be resolved.
* @param fallback the fallback class to use if resolution fails (may be {@code null})
* @return an array of resolved generic parameters (the resulting array will never be
* {@code null}, but it may contain {@code null} elements})
* @param fallback the fallback class to use if resolution fails
* @return an array of resolved generic parameters
* @see #getGenerics()
* @see #resolve()
*/
......@@ -740,7 +739,7 @@ public class ResolvableType implements Serializable {
* {@code fallback} if the type cannot be resolved. This method will consider bounds
* of {@link TypeVariable}s and {@link WildcardType}s if direct resolution fails;
* however, bounds of {@code Object.class} will be ignored.
* @param fallback the fallback class to use if resolution fails (may be {@code null})
* @param fallback the fallback class to use if resolution fails
* @return the resolved {@link Class} or the {@code fallback}
* @see #resolve()
* @see #resolveGeneric(int...)
......@@ -935,8 +934,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
......@@ -1286,7 +1285,7 @@ public class ResolvableType implements Serializable {
/**
* Return a {@link ResolvableType} for the specified {@link Type}.
* Note: The resulting {@link ResolvableType} may not be {@link Serializable}.
* @param type the source type or {@code null}
* @param type the source type (potentially {@code null})
* @return a {@link ResolvableType} for the specified {@link Type}
* @see #forType(Type, ResolvableType)
*/
......
/*
* 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.
......@@ -83,7 +83,7 @@ public class TypeDescriptor implements Serializable {
*/
public TypeDescriptor(MethodParameter methodParameter) {
this.resolvableType = ResolvableType.forMethodParameter(methodParameter);
this.type = this.resolvableType.resolve(methodParameter.getParameterType());
this.type = this.resolvableType.resolve(methodParameter.getNestedParameterType());
this.annotatedElement = new AnnotatedElementAdapter(methodParameter.getParameterIndex() == -1 ?
methodParameter.getMethodAnnotations() : methodParameter.getParameterAnnotations());
}
......@@ -607,7 +607,7 @@ public class TypeDescriptor implements Serializable {
}
/**
* Creates a type descriptor for a nested type declared within the method parameter.
* Create a type descriptor for a nested type declared within the method parameter.
* <p>For example, if the methodParameter is a {@code List<String>} and the
* nesting level is 1, the nested type descriptor will be String.class.
* <p>If the methodParameter is a {@code List<List<String>>} and the nesting
......@@ -637,7 +637,7 @@ public class TypeDescriptor implements Serializable {
}
/**
* Creates a type descriptor for a nested type declared within the field.
* Create a type descriptor for a nested type declared within the field.
* <p>For example, if the field is a {@code List<String>} and the nesting
* level is 1, the nested type descriptor will be {@code String.class}.
* <p>If the field is a {@code List<List<String>>} and the nesting level is
......@@ -646,8 +646,9 @@ public class TypeDescriptor implements Serializable {
* is 1, the nested type descriptor will be String, derived from the map value.
* <p>If the field is a {@code List<Map<Integer, String>>} and the nesting
* level is 2, the nested type descriptor will be String, derived from the map value.
* <p>Returns {@code null} if a nested type cannot be obtained because it was not declared.
* For example, if the field is a {@code List<?>}, the nested type descriptor returned will be {@code null}.
* <p>Returns {@code null} if a nested type cannot be obtained because it was not
* declared. For example, if the field is a {@code List<?>}, the nested type
* descriptor returned will be {@code null}.
* @param field the field
* @param nestingLevel the nesting level of the collection/array element or
* map key/value declaration within the field
......@@ -661,7 +662,7 @@ public class TypeDescriptor implements Serializable {
}
/**
* Creates a type descriptor for a nested type declared within the property.
* Create a type descriptor for a nested type declared within the property.
* <p>For example, if the property is a {@code List<String>} and the nesting
* level is 1, the nested type descriptor will be {@code String.class}.
* <p>If the property is a {@code List<List<String>>} and the nesting level
......@@ -670,9 +671,9 @@ public class TypeDescriptor implements Serializable {
* is 1, the nested type descriptor will be String, derived from the map value.
* <p>If the property is a {@code List<Map<Integer, String>>} and the nesting
* level is 2, the nested type descriptor will be String, derived from the map value.
* <p>Returns {@code null} if a nested type cannot be obtained because it was not declared.
* For example, if the property is a {@code List<?>}, the nested type descriptor
* returned will be {@code null}.
* <p>Returns {@code null} if a nested type cannot be obtained because it was not
* declared. For example, if the property is a {@code List<?>}, the nested type
* descriptor returned will be {@code null}.
* @param property the property
* @param nestingLevel the nesting level of the collection/array element or
* map key/value declaration within the property
......
/*
* Copyright 2002-2015 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.
......@@ -28,9 +28,9 @@ import org.springframework.util.Assert;
/**
* JBoss VFS based {@link Resource} implementation.
*
* <p>As of Spring 4.0, this class supports VFS 3.x on JBoss AS 6+ (package
* {@code org.jboss.vfs}) and is in particular compatible with JBoss AS 7 and
* WildFly 8.
* <p>As of Spring 4.0, this class supports VFS 3.x on JBoss AS 6+
* (package {@code org.jboss.vfs}) and is in particular compatible with
* JBoss AS 7 and WildFly 8+.
*
* @author Ales Justin
* @author Juergen Hoeller
......@@ -44,6 +44,11 @@ public class VfsResource extends AbstractResource {
private final Object resource;
/**
* Create a new {@code VfsResource} wrapping the given resource handle.
* @param resource a {@code org.jboss.vfs.VirtualFile} instance
* (untyped in order to avoid a static dependency on the VFS API)
*/
public VfsResource(Object resource) {
Assert.notNull(resource, "VirtualFile must not be null");
this.resource = resource;
......
/*
* 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.
......@@ -30,9 +30,9 @@ import org.springframework.util.ReflectionUtils;
/**
* Utility for detecting and accessing JBoss VFS in the classpath.
*
* <p>As of Spring 4.0, this class supports VFS 3.x on JBoss AS 6+ (package
* {@code org.jboss.vfs}) and is in particular compatible with JBoss AS 7 and
* WildFly 8.
* <p>As of Spring 4.0, this class supports VFS 3.x on JBoss AS 6+
* (package {@code org.jboss.vfs}) and is in particular compatible with
* JBoss AS 7 and WildFly 8+.
*
* <p>Thanks go to Marius Bogoevici for the initial patch.
* <b>Note:</b> This is an internal class and should not be used outside the framework.
......@@ -57,13 +57,13 @@ public abstract class VfsUtils {
private static final Method VIRTUAL_FILE_METHOD_TO_URI;
private static final Method VIRTUAL_FILE_METHOD_GET_NAME;
private static final Method VIRTUAL_FILE_METHOD_GET_PATH_NAME;
private static final Method VIRTUAL_FILE_METHOD_GET_PHYSICAL_FILE;
private static final Method VIRTUAL_FILE_METHOD_GET_CHILD;
protected static final Class<?> VIRTUAL_FILE_VISITOR_INTERFACE;
protected static final Method VIRTUAL_FILE_METHOD_VISIT;
private static final Field VISITOR_ATTRIBUTES_FIELD_RECURSE;
private static final Method GET_PHYSICAL_FILE;
static {
ClassLoader loader = VfsUtils.class.getClassLoader();
......@@ -81,7 +81,7 @@ public abstract class VfsUtils {
VIRTUAL_FILE_METHOD_TO_URL = ReflectionUtils.findMethod(virtualFile, "toURL");
VIRTUAL_FILE_METHOD_GET_NAME = ReflectionUtils.findMethod(virtualFile, "getName");
VIRTUAL_FILE_METHOD_GET_PATH_NAME = ReflectionUtils.findMethod(virtualFile, "getPathName");
GET_PHYSICAL_FILE = ReflectionUtils.findMethod(virtualFile, "getPhysicalFile");
VIRTUAL_FILE_METHOD_GET_PHYSICAL_FILE = ReflectionUtils.findMethod(virtualFile, "getPhysicalFile");
VIRTUAL_FILE_METHOD_GET_CHILD = ReflectionUtils.findMethod(virtualFile, "getChild", String.class);
VIRTUAL_FILE_VISITOR_INTERFACE = loader.loadClass(VFS3_PKG + "VirtualFileVisitor");
......@@ -124,7 +124,7 @@ public abstract class VfsUtils {
static boolean isReadable(Object vfsResource) {
try {
return ((Long) invokeVfsMethod(VIRTUAL_FILE_METHOD_GET_SIZE, vfsResource) > 0);
return (Long) invokeVfsMethod(VIRTUAL_FILE_METHOD_GET_SIZE, vfsResource) > 0;
}
catch (IOException ex) {
return false;
......@@ -169,7 +169,7 @@ public abstract class VfsUtils {
}
static File getFile(Object vfsResource) throws IOException {
return (File) invokeVfsMethod(GET_PHYSICAL_FILE, vfsResource);
return (File) invokeVfsMethod(VIRTUAL_FILE_METHOD_GET_PHYSICAL_FILE, vfsResource);
}
static Object getRoot(URI url) throws IOException {
......
/*
* Copyright 2002-2014 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.
......@@ -35,10 +35,11 @@ import java.util.TreeMap;
import java.util.TreeSet;
import org.junit.Test;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.springframework.core.CollectionFactory.*;
......@@ -103,7 +104,7 @@ public class CollectionFactoryTests {
* {@link CollectionFactory#createApproximateMap(Object, int)}
* is not type-safe.
* <p>The reasoning is similar that described in
* {@link #createApproximateCollectionIsNotTypeSafe()}.
* {@link #createApproximateCollectionIsNotTypeSafeForEnumSet}.
*/
@Test
public void createApproximateMapIsNotTypeSafeForEnumMap() {
......@@ -165,27 +166,27 @@ public class CollectionFactoryTests {
@Test
public void createApproximateCollectionFromEmptyHashSet() {
Collection<String> set = createApproximateCollection(new HashSet<String>(), 2);
assertThat(set.size(), is(0));
assertThat(set, is(empty()));
}
@Test
public void createApproximateCollectionFromNonEmptyHashSet() {
HashSet<String> hashSet = new HashSet<String>();
HashSet<String> hashSet = new HashSet<>();
hashSet.add("foo");
Collection<String> set = createApproximateCollection(hashSet, 2);
assertThat(set.size(), is(0));
assertThat(set, is(empty()));
}
@Test
public void createApproximateCollectionFromEmptyEnumSet() {
Collection<Color> colors = createApproximateCollection(EnumSet.noneOf(Color.class), 2);
assertThat(colors.size(), is(0));
assertThat(colors, is(empty()));
}
@Test
public void createApproximateCollectionFromNonEmptyEnumSet() {
Collection<Color> colors = createApproximateCollection(EnumSet.of(Color.BLUE), 2);
assertThat(colors.size(), is(0));
assertThat(colors, is(empty()));
}
@Test
......@@ -196,7 +197,7 @@ public class CollectionFactoryTests {
@Test
public void createApproximateMapFromNonEmptyHashMap() {
Map<String, String> hashMap = new HashMap<String, String>();
Map<String, String> hashMap = new HashMap<>();
hashMap.put("foo", "bar");
Map<String, String> map = createApproximateMap(hashMap, 2);
assertThat(map.size(), is(0));
......@@ -210,7 +211,7 @@ public class CollectionFactoryTests {
@Test
public void createApproximateMapFromNonEmptyEnumMap() {
EnumMap<Color, String> enumMap = new EnumMap<Color, String>(Color.class);
EnumMap<Color, String> enumMap = new EnumMap<>(Color.class);
enumMap.put(Color.BLUE, "blue");
Map<Color, String> colors = createApproximateMap(enumMap, 2);
assertThat(colors.size(), is(0));
......@@ -241,6 +242,12 @@ public class CollectionFactoryTests {
assertThat(createCollection(EnumSet.class, Color.class, 0), is(instanceOf(EnumSet.class)));
}
@Test // SPR-17619
public void createsEnumSetSubclass() {
EnumSet<Color> enumSet = EnumSet.noneOf(Color.class);
assertThat(createCollection(enumSet.getClass(), Color.class, 0), is(instanceOf(enumSet.getClass())));
}
@Test(expected = IllegalArgumentException.class)
public void rejectsInvalidElementTypeForEnumSet() {
createCollection(EnumSet.class, Object.class, 0);
......@@ -296,7 +303,8 @@ public class CollectionFactoryTests {
}
static enum Color {
enum Color {
RED, BLUE;
}
}