Commit 55535b5b authored by Emmanuel Bourg's avatar Emmanuel Bourg

New upstream version 4.3.22

parent d2188a36
......@@ -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[]
}
......
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();