Merge branch 'SPR-10127' into cleanup-3.2.x

* SPR-10127:
  Replace space indentation with tabs
  Remove trailing whitespace in source files
This commit is contained in:
Chris Beams 2012-12-28 20:53:32 +01:00
commit 84e2be4412
1510 changed files with 7329 additions and 7327 deletions

View File

@ -151,12 +151,12 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
} }
Object interceptorOrInterceptionAdvice = Object interceptorOrInterceptionAdvice =
this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex); this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex);
if (interceptorOrInterceptionAdvice instanceof InterceptorAndDynamicMethodMatcher) { if (interceptorOrInterceptionAdvice instanceof InterceptorAndDynamicMethodMatcher) {
// Evaluate dynamic method matcher here: static part will already have // Evaluate dynamic method matcher here: static part will already have
// been evaluated and found to match. // been evaluated and found to match.
InterceptorAndDynamicMethodMatcher dm = InterceptorAndDynamicMethodMatcher dm =
(InterceptorAndDynamicMethodMatcher) interceptorOrInterceptionAdvice; (InterceptorAndDynamicMethodMatcher) interceptorOrInterceptionAdvice;
if (dm.methodMatcher.matches(this.method, this.targetClass, this.arguments)) { if (dm.methodMatcher.matches(this.method, this.targetClass, this.arguments)) {
return dm.interceptor.invoke(this); return dm.interceptor.invoke(this);
} }

View File

@ -78,8 +78,10 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
Object target = this.targetInThread.get(); Object target = this.targetInThread.get();
if (target == null) { if (target == null) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " + logger.debug("No target for prototype '" + getTargetBeanName() +
"creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); "' bound to thread: " +
"creating one and binding it to thread '" +
Thread.currentThread().getName() + "'");
} }
// Associate target with ThreadLocal. // Associate target with ThreadLocal.
target = newPrototypeInstance(); target = newPrototypeInstance();

View File

@ -90,9 +90,9 @@ public final class TigerAspectJExpressionPointcutTests {
@Test @Test
public void testMatchVarargs() throws SecurityException, NoSuchMethodException { public void testMatchVarargs() throws SecurityException, NoSuchMethodException {
class MyTemplate { class MyTemplate {
public int queryForInt(String sql, Object... params) { public int queryForInt(String sql, Object... params) {
return 0; return 0;
} }
} }
String expression = "execution(int *.*(String, Object...))"; String expression = "execution(int *.*(String, Object...))";
@ -101,8 +101,8 @@ public final class TigerAspectJExpressionPointcutTests {
// TODO: the expression above no longer matches Object[] // TODO: the expression above no longer matches Object[]
// assertFalse(jdbcVarArgs.matches( // assertFalse(jdbcVarArgs.matches(
// JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class), // JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class),
// JdbcTemplate.class)); // JdbcTemplate.class));
assertTrue(jdbcVarArgs.matches( assertTrue(jdbcVarArgs.matches(
MyTemplate.class.getMethod("queryForInt", String.class, Object[].class), MyTemplate.class.getMethod("queryForInt", String.class, Object[].class),

View File

@ -131,14 +131,14 @@ public class TrickyAspectJPointcutExpressionTests {
} }
public static interface TestService { public static interface TestService {
public String sayHello(); public String sayHello();
} }
@Log @Log
public static class TestServiceImpl implements TestService{ public static class TestServiceImpl implements TestService {
public String sayHello() { public String sayHello() {
throw new TestException("TestServiceImpl"); throw new TestException("TestServiceImpl");
} }
} }
public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice { public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice {
@ -149,12 +149,12 @@ public class TrickyAspectJPointcutExpressionTests {
public void before(Method method, Object[] objects, Object o) throws Throwable { public void before(Method method, Object[] objects, Object o) throws Throwable {
countBefore++; countBefore++;
} }
public void afterThrowing(Exception e) throws Throwable { public void afterThrowing(Exception e) throws Throwable {
countThrows++; countThrows++;
throw e; throw e;
} }
public int getCountBefore() { public int getCountBefore() {
return countBefore; return countBefore;

View File

@ -80,7 +80,7 @@ public final class TypePatternClassFilterTests {
@Test(expected=IllegalArgumentException.class) @Test(expected=IllegalArgumentException.class)
public void testSetTypePatternWithNullArgument() throws Exception { public void testSetTypePatternWithNullArgument() throws Exception {
new TypePatternClassFilter(null); new TypePatternClassFilter(null);
} }
@Test(expected=IllegalStateException.class) @Test(expected=IllegalStateException.class)

View File

@ -411,6 +411,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
CannotBeUnlocked.class); CannotBeUnlocked.class);
assertFalse("Type pattern must have excluded mixin", proxy instanceof Lockable); assertFalse("Type pattern must have excluded mixin", proxy instanceof Lockable);
} }
/* prereq AspectJ 1.6.7 /* prereq AspectJ 1.6.7
@Test @Test
public void testIntroductionBasedOnAnnotationMatch_Spr5307() { public void testIntroductionBasedOnAnnotationMatch_Spr5307() {
@ -426,8 +427,10 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
Lockable lockable = (Lockable)proxy; Lockable lockable = (Lockable)proxy;
lockable.locked(); lockable.locked();
} }
*/ */
// TODO: Why does this test fail? It hasn't been run before, so it maybe never actually passed... // TODO: Why does this test fail? It hasn't been run before, so it maybe never actually passed...
public void XtestIntroductionWithArgumentBinding() { public void XtestIntroductionWithArgumentBinding() {
TestBean target = new TestBean(); TestBean target = new TestBean();
@ -764,8 +767,8 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
public void setAge(int a) {} public void setAge(int a) {}
@Around(value="setAge(age)",argNames="age") @Around(value="setAge(age)",argNames="age")
// @ArgNames({"age"}) // AMC needs more work here? ignoring pjp arg... ok?? // @ArgNames({"age"}) // AMC needs more work here? ignoring pjp arg... ok??
// // argNames should be suported in Around as it is in Pointcut // argNames should be suported in Around as it is in Pointcut
public void changeReturnType(ProceedingJoinPoint pjp, int age) throws Throwable { public void changeReturnType(ProceedingJoinPoint pjp, int age) throws Throwable {
pjp.proceed(new Object[] {age*2}); pjp.proceed(new Object[] {age*2});
} }

View File

@ -68,7 +68,7 @@ public final class MethodInvocationTests {
Method m = Object.class.getMethod("hashCode", (Class[]) null); Method m = Object.class.getMethod("hashCode", (Class[]) null);
Object proxy = new Object(); Object proxy = new Object();
ReflectiveMethodInvocation invocation = ReflectiveMethodInvocation invocation =
new ReflectiveMethodInvocation(proxy, target, m, null, null, is); new ReflectiveMethodInvocation(proxy, target, m, null, null, is);
// If it hits target, the test will fail with the UnsupportedOpException // If it hits target, the test will fail with the UnsupportedOpException
// in the inner class above. // in the inner class above.

View File

@ -41,7 +41,7 @@ package org.springframework.beans.factory.aspectj;
* @since 3.0.0 * @since 3.0.0
*/ */
public abstract aspect GenericInterfaceDrivenDependencyInjectionAspect<I> extends AbstractInterfaceDrivenDependencyInjectionAspect { public abstract aspect GenericInterfaceDrivenDependencyInjectionAspect<I> extends AbstractInterfaceDrivenDependencyInjectionAspect {
declare parents: I implements ConfigurableObject; declare parents: I implements ConfigurableObject;
public pointcut inConfigurableBean() : within(I+); public pointcut inConfigurableBean() : within(I+);

View File

@ -9,14 +9,14 @@ import org.springframework.dao.DataAccessException;
import org.springframework.orm.jpa.EntityManagerFactoryUtils; import org.springframework.orm.jpa.EntityManagerFactoryUtils;
public aspect JpaExceptionTranslatorAspect { public aspect JpaExceptionTranslatorAspect {
pointcut entityManagerCall(): call(* EntityManager.*(..)) || call(* EntityManagerFactory.*(..)) || call(* EntityTransaction.*(..)) || call(* Query.*(..)); pointcut entityManagerCall(): call(* EntityManager.*(..)) || call(* EntityManagerFactory.*(..)) || call(* EntityTransaction.*(..)) || call(* Query.*(..));
after() throwing(RuntimeException re): entityManagerCall() { after() throwing(RuntimeException re): entityManagerCall() {
DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(re); DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(re);
if (dex != null) { if (dex != null) {
throw dex; throw dex;
} else { } else {
throw re; throw re;
} }
} }
} }

View File

@ -66,7 +66,7 @@ public abstract aspect AbstractTransactionAspect extends TransactionAspectSuppor
@SuppressAjWarnings("adviceDidNotMatch") @SuppressAjWarnings("adviceDidNotMatch")
after(Object txObject) throwing(Throwable t) : transactionalMethodExecution(txObject) { after(Object txObject) throwing(Throwable t) : transactionalMethodExecution(txObject) {
try { try {
completeTransactionAfterThrowing(TransactionAspectSupport.currentTransactionInfo(), t); completeTransactionAfterThrowing(TransactionAspectSupport.currentTransactionInfo(), t);
} }
catch (Throwable t2) { catch (Throwable t2) {
logger.error("Failed to close transaction after throwing in a transactional method", t2); logger.error("Failed to close transaction after throwing in a transactional method", t2);

View File

@ -18,83 +18,83 @@ package org.springframework.mock.staticmock;
privileged aspect Person_Roo_Entity { privileged aspect Person_Roo_Entity {
@javax.persistence.PersistenceContext @javax.persistence.PersistenceContext
transient javax.persistence.EntityManager Person.entityManager; transient javax.persistence.EntityManager Person.entityManager;
@javax.persistence.Id @javax.persistence.Id
@javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO) @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
@javax.persistence.Column(name = "id") @javax.persistence.Column(name = "id")
private java.lang.Long Person.id; private java.lang.Long Person.id;
@javax.persistence.Version @javax.persistence.Version
@javax.persistence.Column(name = "version") @javax.persistence.Column(name = "version")
private java.lang.Integer Person.version; private java.lang.Integer Person.version;
public java.lang.Long Person.getId() { public java.lang.Long Person.getId() {
return this.id; return this.id;
} }
public void Person.setId(java.lang.Long id) { public void Person.setId(java.lang.Long id) {
this.id = id; this.id = id;
} }
public java.lang.Integer Person.getVersion() { public java.lang.Integer Person.getVersion() {
return this.version; return this.version;
} }
public void Person.setVersion(java.lang.Integer version) { public void Person.setVersion(java.lang.Integer version) {
this.version = version; this.version = version;
} }
@org.springframework.transaction.annotation.Transactional @org.springframework.transaction.annotation.Transactional
public void Person.persist() { public void Person.persist() {
if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
this.entityManager.persist(this); this.entityManager.persist(this);
} }
@org.springframework.transaction.annotation.Transactional @org.springframework.transaction.annotation.Transactional
public void Person.remove() { public void Person.remove() {
if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
this.entityManager.remove(this); this.entityManager.remove(this);
} }
@org.springframework.transaction.annotation.Transactional @org.springframework.transaction.annotation.Transactional
public void Person.flush() { public void Person.flush() {
if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
this.entityManager.flush(); this.entityManager.flush();
} }
@org.springframework.transaction.annotation.Transactional @org.springframework.transaction.annotation.Transactional
public void Person.merge() { public void Person.merge() {
if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (this.entityManager == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
Person merged = this.entityManager.merge(this); Person merged = this.entityManager.merge(this);
this.entityManager.flush(); this.entityManager.flush();
this.id = merged.getId(); this.id = merged.getId();
} }
public static long Person.countPeople() { public static long Person.countPeople() {
javax.persistence.EntityManager em = new Person().entityManager; javax.persistence.EntityManager em = new Person().entityManager;
if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return (Long) em.createQuery("select count(o) from Person o").getSingleResult(); return (Long) em.createQuery("select count(o) from Person o").getSingleResult();
} }
public static java.util.List<Person> Person.findAllPeople() { public static java.util.List<Person> Person.findAllPeople() {
javax.persistence.EntityManager em = new Person().entityManager; javax.persistence.EntityManager em = new Person().entityManager;
if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return em.createQuery("select o from Person o").getResultList(); return em.createQuery("select o from Person o").getResultList();
} }
public static Person Person.findPerson(java.lang.Long id) { public static Person Person.findPerson(java.lang.Long id) {
if (id == null) throw new IllegalArgumentException("An identifier is required to retrieve an instance of Person"); if (id == null) throw new IllegalArgumentException("An identifier is required to retrieve an instance of Person");
javax.persistence.EntityManager em = new Person().entityManager; javax.persistence.EntityManager em = new Person().entityManager;
if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return em.find(Person.class, id); return em.find(Person.class, id);
} }
public static java.util.List<Person> Person.findPersonEntries(int firstResult, int maxResults) { public static java.util.List<Person> Person.findPersonEntries(int firstResult, int maxResults) {
javax.persistence.EntityManager em = new Person().entityManager; javax.persistence.EntityManager em = new Person().entityManager;
if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return em.createQuery("select o from Person o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList(); return em.createQuery("select o from Person o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
} }
} }

View File

@ -103,7 +103,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
} }
// Redefined with public visibility. // Redefined with public visibility.
@Override @Override
public Class getPropertyType(String propertyPath) { public Class getPropertyType(String propertyPath) {
return null; return null;

View File

@ -738,7 +738,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
} }
} }
else { else {
value = readMethod.invoke(object, (Object[]) null); value = readMethod.invoke(object, (Object[]) null);
} }
if (tokens.keys != null) { if (tokens.keys != null) {

View File

@ -64,7 +64,7 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
if (fieldMap.containsKey(field.getName())) { if (fieldMap.containsKey(field.getName())) {
// ignore superclass declarations of fields already found in a subclass // ignore superclass declarations of fields already found in a subclass
} }
else { else {
fieldMap.put(field.getName(), field); fieldMap.put(field.getName(), field);
} }
} }

View File

@ -191,7 +191,7 @@ public interface PropertyAccessor {
* @see #setPropertyValues(PropertyValues, boolean, boolean) * @see #setPropertyValues(PropertyValues, boolean, boolean)
*/ */
void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown)
throws BeansException; throws BeansException;
/** /**
* Perform a batch update with full control over behavior. * Perform a batch update with full control over behavior.
@ -213,6 +213,6 @@ public interface PropertyAccessor {
* successfully updated. * successfully updated.
*/ */
void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid)
throws BeansException; throws BeansException;
} }

View File

@ -159,7 +159,7 @@ public class FieldRetrievingFactoryBean
if (this.targetClass == null && this.targetObject == null) { if (this.targetClass == null && this.targetObject == null) {
if (this.targetField != null) { if (this.targetField != null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Specify targetClass or targetObject in combination with targetField"); "Specify targetClass or targetObject in combination with targetField");
} }
// If no other property specified, consider bean name as static field expression. // If no other property specified, consider bean name as static field expression.

View File

@ -76,9 +76,9 @@ public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigu
*/ */
public void afterPropertiesSet() { public void afterPropertiesSet() {
this.systemPrefs = (this.systemTreePath != null) ? this.systemPrefs = (this.systemTreePath != null) ?
Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot(); Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot();
this.userPrefs = (this.userTreePath != null) ? this.userPrefs = (this.userTreePath != null) ?
Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot(); Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot();
} }
/** /**

View File

@ -162,15 +162,15 @@ public class PropertyPathFactoryBean implements FactoryBean<Object>, BeanNameAwa
if (this.targetBeanWrapper == null && this.targetBeanName == null) { if (this.targetBeanWrapper == null && this.targetBeanName == null) {
if (this.propertyPath != null) { if (this.propertyPath != null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Specify 'targetObject' or 'targetBeanName' in combination with 'propertyPath'"); "Specify 'targetObject' or 'targetBeanName' in combination with 'propertyPath'");
} }
// No other properties specified: check bean name. // No other properties specified: check bean name.
int dotIndex = this.beanName.indexOf('.'); int dotIndex = this.beanName.indexOf('.');
if (dotIndex == -1) { if (dotIndex == -1) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " + "Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " +
"bean name '" + this.beanName + "' does not follow 'beanName.property' syntax"); "bean name '" + this.beanName + "' does not follow 'beanName.property' syntax");
} }
this.targetBeanName = this.beanName.substring(0, dotIndex); this.targetBeanName = this.beanName.substring(0, dotIndex);
this.propertyPath = this.beanName.substring(dotIndex + 1); this.propertyPath = this.beanName.substring(dotIndex + 1);

View File

@ -80,7 +80,7 @@ class BeanDefinitionResource extends AbstractResource {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj == this || return (obj == this ||
(obj instanceof BeanDefinitionResource && (obj instanceof BeanDefinitionResource &&
((BeanDefinitionResource) obj).beanDefinition.equals(this.beanDefinition))); ((BeanDefinitionResource) obj).beanDefinition.equals(this.beanDefinition)));
} }

View File

@ -339,7 +339,7 @@ class BeanDefinitionValueResolver {
Object resolved = Array.newInstance(elementType, ml.size()); Object resolved = Array.newInstance(elementType, ml.size());
for (int i = 0; i < ml.size(); i++) { for (int i = 0; i < ml.size(); i++) {
Array.set(resolved, i, Array.set(resolved, i,
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i))); resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
} }
return resolved; return resolved;
} }
@ -351,7 +351,7 @@ class BeanDefinitionValueResolver {
List<Object> resolved = new ArrayList<Object>(ml.size()); List<Object> resolved = new ArrayList<Object>(ml.size());
for (int i = 0; i < ml.size(); i++) { for (int i = 0; i < ml.size(); i++) {
resolved.add( resolved.add(
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i))); resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
} }
return resolved; return resolved;
} }

View File

@ -744,7 +744,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter()); TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter());
return (descriptor.getField() != null ? return (descriptor.getField() != null ?
converter.convertIfNecessary(value, type, descriptor.getField()) : converter.convertIfNecessary(value, type, descriptor.getField()) :
converter.convertIfNecessary(value, type, descriptor.getMethodParameter())); converter.convertIfNecessary(value, type, descriptor.getMethodParameter()));
} }
if (type.isArray()) { if (type.isArray()) {

View File

@ -85,8 +85,8 @@ public class CustomNumberEditor extends PropertyEditorSupport {
* @see java.text.NumberFormat#parse * @see java.text.NumberFormat#parse
* @see java.text.NumberFormat#format * @see java.text.NumberFormat#format
*/ */
public CustomNumberEditor(Class<? extends Number> numberClass, NumberFormat numberFormat, boolean allowEmpty) public CustomNumberEditor(Class<? extends Number> numberClass,
throws IllegalArgumentException { NumberFormat numberFormat, boolean allowEmpty) throws IllegalArgumentException {
if (numberClass == null || !Number.class.isAssignableFrom(numberClass)) { if (numberClass == null || !Number.class.isAssignableFrom(numberClass)) {
throw new IllegalArgumentException("Property class must be a subclass of Number"); throw new IllegalArgumentException("Property class must be a subclass of Number");

View File

@ -159,7 +159,8 @@ public class MutableSortDefinition implements SortDefinition, Serializable {
} }
SortDefinition otherSd = (SortDefinition) other; SortDefinition otherSd = (SortDefinition) other;
return (getProperty().equals(otherSd.getProperty()) && return (getProperty().equals(otherSd.getProperty()) &&
isAscending() == otherSd.isAscending() && isIgnoreCase() == otherSd.isIgnoreCase()); isAscending() == otherSd.isAscending() &&
isIgnoreCase() == otherSd.isIgnoreCase());
} }
@Override @Override

View File

@ -250,17 +250,17 @@ public final class BeanUtilsTests {
} }
@Test @Test
public void testSPR6063() { public void testSPR6063() {
PropertyDescriptor[] descrs = BeanUtils.getPropertyDescriptors(Bean.class); PropertyDescriptor[] descrs = BeanUtils.getPropertyDescriptors(Bean.class);
PropertyDescriptor keyDescr = BeanUtils.getPropertyDescriptor(Bean.class, "value"); PropertyDescriptor keyDescr = BeanUtils.getPropertyDescriptor(Bean.class, "value");
assertEquals(String.class, keyDescr.getPropertyType()); assertEquals(String.class, keyDescr.getPropertyType());
for (PropertyDescriptor propertyDescriptor : descrs) { for (PropertyDescriptor propertyDescriptor : descrs) {
if (propertyDescriptor.getName().equals(keyDescr.getName())) { if (propertyDescriptor.getName().equals(keyDescr.getName())) {
assertEquals(propertyDescriptor.getName() + " has unexpected type", keyDescr.getPropertyType(), propertyDescriptor.getPropertyType()); assertEquals(propertyDescriptor.getName() + " has unexpected type", keyDescr.getPropertyType(), propertyDescriptor.getPropertyType());
} }
} }
} }
private void assertSignatureEquals(Method desiredMethod, String signature) { private void assertSignatureEquals(Method desiredMethod, String signature) {
assertEquals(desiredMethod, BeanUtils.resolveSignature(signature, MethodSignatureBean.class)); assertEquals(desiredMethod, BeanUtils.resolveSignature(signature, MethodSignatureBean.class));

View File

@ -27,20 +27,20 @@ import org.springframework.core.io.ClassPathResource;
*/ */
public class TestResourceUtils { public class TestResourceUtils {
/** /**
* Loads a {@link ClassPathResource} qualified by the simple name of clazz, * Loads a {@link ClassPathResource} qualified by the simple name of clazz,
* and relative to the package for clazz. * and relative to the package for clazz.
* *
* <p>Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', * <p>Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml',
* this method will return a ClassPathResource representing com/foo/BarTests-context.xml * this method will return a ClassPathResource representing com/foo/BarTests-context.xml
* *
* <p>Intended for use loading context configuration XML files within JUnit tests. * <p>Intended for use loading context configuration XML files within JUnit tests.
* *
* @param clazz * @param clazz
* @param resourceSuffix * @param resourceSuffix
*/ */
public static ClassPathResource qualifiedResource(Class<?> clazz, String resourceSuffix) { public static ClassPathResource qualifiedResource(Class<?> clazz, String resourceSuffix) {
return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz); return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz);
} }
} }

View File

@ -241,7 +241,7 @@ public class MimeMessageHelper {
* @see #MimeMessageHelper(javax.mail.internet.MimeMessage, int, String) * @see #MimeMessageHelper(javax.mail.internet.MimeMessage, int, String)
*/ */
public MimeMessageHelper(MimeMessage mimeMessage, boolean multipart, String encoding) public MimeMessageHelper(MimeMessage mimeMessage, boolean multipart, String encoding)
throws MessagingException { throws MessagingException {
this(mimeMessage, (multipart ? MULTIPART_MODE_MIXED_RELATED : MULTIPART_MODE_NO), encoding); this(mimeMessage, (multipart ? MULTIPART_MODE_MIXED_RELATED : MULTIPART_MODE_NO), encoding);
} }
@ -283,7 +283,7 @@ public class MimeMessageHelper {
* @see #MULTIPART_MODE_MIXED_RELATED * @see #MULTIPART_MODE_MIXED_RELATED
*/ */
public MimeMessageHelper(MimeMessage mimeMessage, int multipartMode, String encoding) public MimeMessageHelper(MimeMessage mimeMessage, int multipartMode, String encoding)
throws MessagingException { throws MessagingException {
this.mimeMessage = mimeMessage; this.mimeMessage = mimeMessage;
createMimeMultiparts(mimeMessage, multipartMode); createMimeMultiparts(mimeMessage, multipartMode);
@ -380,8 +380,8 @@ public class MimeMessageHelper {
private void checkMultipart() throws IllegalStateException { private void checkMultipart() throws IllegalStateException {
if (!isMultipart()) { if (!isMultipart()) {
throw new IllegalStateException("Not in multipart mode - " + throw new IllegalStateException("Not in multipart mode - " +
"create an appropriate MimeMessageHelper via a constructor that takes a 'multipart' flag " + "create an appropriate MimeMessageHelper via a constructor that takes a 'multipart' flag " +
"if you need to set alternative texts or add inline elements or attachments."); "if you need to set alternative texts or add inline elements or attachments.");
} }
} }
@ -546,7 +546,7 @@ public class MimeMessageHelper {
public void setFrom(String from, String personal) throws MessagingException, UnsupportedEncodingException { public void setFrom(String from, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(from, "From address must not be null"); Assert.notNull(from, "From address must not be null");
setFrom(getEncoding() != null ? setFrom(getEncoding() != null ?
new InternetAddress(from, personal, getEncoding()) : new InternetAddress(from, personal)); new InternetAddress(from, personal, getEncoding()) : new InternetAddress(from, personal));
} }
public void setReplyTo(InternetAddress replyTo) throws MessagingException { public void setReplyTo(InternetAddress replyTo) throws MessagingException {
@ -608,8 +608,8 @@ public class MimeMessageHelper {
public void addTo(String to, String personal) throws MessagingException, UnsupportedEncodingException { public void addTo(String to, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(to, "To address must not be null"); Assert.notNull(to, "To address must not be null");
addTo(getEncoding() != null ? addTo(getEncoding() != null ?
new InternetAddress(to, personal, getEncoding()) : new InternetAddress(to, personal, getEncoding()) :
new InternetAddress(to, personal)); new InternetAddress(to, personal));
} }
@ -653,8 +653,8 @@ public class MimeMessageHelper {
public void addCc(String cc, String personal) throws MessagingException, UnsupportedEncodingException { public void addCc(String cc, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(cc, "Cc address must not be null"); Assert.notNull(cc, "Cc address must not be null");
addCc(getEncoding() != null ? addCc(getEncoding() != null ?
new InternetAddress(cc, personal, getEncoding()) : new InternetAddress(cc, personal, getEncoding()) :
new InternetAddress(cc, personal)); new InternetAddress(cc, personal));
} }
@ -698,8 +698,8 @@ public class MimeMessageHelper {
public void addBcc(String bcc, String personal) throws MessagingException, UnsupportedEncodingException { public void addBcc(String bcc, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(bcc, "Bcc address must not be null"); Assert.notNull(bcc, "Bcc address must not be null");
addBcc(getEncoding() != null ? addBcc(getEncoding() != null ?
new InternetAddress(bcc, personal, getEncoding()) : new InternetAddress(bcc, personal, getEncoding()) :
new InternetAddress(bcc, personal)); new InternetAddress(bcc, personal));
} }
private InternetAddress parseAddress(String address) throws MessagingException { private InternetAddress parseAddress(String address) throws MessagingException {
@ -960,7 +960,7 @@ public class MimeMessageHelper {
* @see #addInline(String, javax.activation.DataSource) * @see #addInline(String, javax.activation.DataSource)
*/ */
public void addInline(String contentId, InputStreamSource inputStreamSource, String contentType) public void addInline(String contentId, InputStreamSource inputStreamSource, String contentType)
throws MessagingException { throws MessagingException {
Assert.notNull(inputStreamSource, "InputStreamSource must not be null"); Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
if (inputStreamSource instanceof Resource && ((Resource) inputStreamSource).isOpen()) { if (inputStreamSource instanceof Resource && ((Resource) inputStreamSource).isOpen()) {
@ -1035,7 +1035,7 @@ public class MimeMessageHelper {
* @see org.springframework.core.io.Resource * @see org.springframework.core.io.Resource
*/ */
public void addAttachment(String attachmentFilename, InputStreamSource inputStreamSource) public void addAttachment(String attachmentFilename, InputStreamSource inputStreamSource)
throws MessagingException { throws MessagingException {
String contentType = getFileTypeMap().getContentType(attachmentFilename); String contentType = getFileTypeMap().getContentType(attachmentFilename);
addAttachment(attachmentFilename, inputStreamSource, contentType); addAttachment(attachmentFilename, inputStreamSource, contentType);
@ -1059,7 +1059,7 @@ public class MimeMessageHelper {
*/ */
public void addAttachment( public void addAttachment(
String attachmentFilename, InputStreamSource inputStreamSource, String contentType) String attachmentFilename, InputStreamSource inputStreamSource, String contentType)
throws MessagingException { throws MessagingException {
Assert.notNull(inputStreamSource, "InputStreamSource must not be null"); Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
if (inputStreamSource instanceof Resource && ((Resource) inputStreamSource).isOpen()) { if (inputStreamSource instanceof Resource && ((Resource) inputStreamSource).isOpen()) {
@ -1079,7 +1079,7 @@ public class MimeMessageHelper {
* @return the Activation Framework DataSource * @return the Activation Framework DataSource
*/ */
protected DataSource createDataSource( protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) { final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() { return new DataSource() {
public InputStream getInputStream() throws IOException { public InputStream getInputStream() throws IOException {

View File

@ -83,14 +83,14 @@ public class LocalDataSourceJobStore extends JobStoreCMT {
@Override @Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
throws SchedulerConfigException { throws SchedulerConfigException {
// Absolutely needs thread-bound DataSource to initialize. // Absolutely needs thread-bound DataSource to initialize.
this.dataSource = SchedulerFactoryBean.getConfigTimeDataSource(); this.dataSource = SchedulerFactoryBean.getConfigTimeDataSource();
if (this.dataSource == null) { if (this.dataSource == null) {
throw new SchedulerConfigException( throw new SchedulerConfigException(
"No local DataSource found for configuration - " + "No local DataSource found for configuration - " +
"'dataSource' property must be set on SchedulerFactoryBean"); "'dataSource' property must be set on SchedulerFactoryBean");
} }
// Configure transactional connection settings for Quartz. // Configure transactional connection settings for Quartz.

View File

@ -52,8 +52,8 @@ public class LocalTaskExecutorThreadPool implements ThreadPool {
this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor(); this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor();
if (this.taskExecutor == null) { if (this.taskExecutor == null) {
throw new SchedulerConfigException( throw new SchedulerConfigException(
"No local TaskExecutor found for configuration - " + "No local TaskExecutor found for configuration - " +
"'taskExecutor' property must be set on SchedulerFactoryBean"); "'taskExecutor' property must be set on SchedulerFactoryBean");
} }
} }

View File

@ -77,8 +77,8 @@ public class ResourceLoaderClassLoadHelper implements ClassLoadHelper {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws ClassNotFoundException { public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws ClassNotFoundException {
return loadClass(name); return loadClass(name);
} }
public URL getResource(String name) { public URL getResource(String name) {
Resource resource = this.resourceLoader.getResource(name); Resource resource = this.resourceLoader.getResource(name);

View File

@ -32,7 +32,7 @@ public class CronTriggerBeanTests {
@Test @Test
public void testStartTime() throws Exception { public void testStartTime() throws Exception {
CronTriggerBean bean = createTriggerBean(); CronTriggerBean bean = createTriggerBean();
Date startTime = new Date(System.currentTimeMillis() + 1234L); Date startTime = new Date(System.currentTimeMillis() + 1234L);
bean.setStartTime(startTime); bean.setStartTime(startTime);
bean.afterPropertiesSet(); bean.afterPropertiesSet();

View File

@ -1257,7 +1257,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/ */
protected MessageSource getInternalParentMessageSource() { protected MessageSource getInternalParentMessageSource() {
return (getParent() instanceof AbstractApplicationContext) ? return (getParent() instanceof AbstractApplicationContext) ?
((AbstractApplicationContext) getParent()).messageSource : getParent(); ((AbstractApplicationContext) getParent()).messageSource : getParent();
} }

View File

@ -93,7 +93,7 @@ public class LocalSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor
} }
catch (IllegalAccessException ex) { catch (IllegalAccessException ex) {
throw new EjbAccessException("Could not access method [" + invocation.getMethod().getName() + throw new EjbAccessException("Could not access method [" + invocation.getMethod().getName() +
"] of local EJB [" + getJndiName() + "]", ex); "] of local EJB [" + getJndiName() + "]", ex);
} }
finally { finally {
if (ejb instanceof EJBLocalObject) { if (ejb instanceof EJBLocalObject) {

View File

@ -106,7 +106,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke
if (targetEx instanceof RemoteException) { if (targetEx instanceof RemoteException) {
RemoteException rex = (RemoteException) targetEx; RemoteException rex = (RemoteException) targetEx;
throw RmiClientInterceptorUtils.convertRmiAccessException( throw RmiClientInterceptorUtils.convertRmiAccessException(
invocation.getMethod(), rex, isConnectFailure(rex), getJndiName()); invocation.getMethod(), rex, isConnectFailure(rex), getJndiName());
} }
else if (targetEx instanceof CreateException) { else if (targetEx instanceof CreateException) {
throw RmiClientInterceptorUtils.convertRmiAccessException( throw RmiClientInterceptorUtils.convertRmiAccessException(

View File

@ -190,8 +190,8 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
else if (getServiceInterface() != null) { else if (getServiceInterface() != null) {
boolean isImpl = getServiceInterface().isInstance(remoteObj); boolean isImpl = getServiceInterface().isInstance(remoteObj);
logger.debug("Using service interface [" + getServiceInterface().getName() + logger.debug("Using service interface [" + getServiceInterface().getName() +
"] for JNDI RMI object [" + getJndiName() + "] - " + "] for JNDI RMI object [" + getJndiName() + "] - " +
(!isImpl ? "not " : "") + "directly implemented"); (!isImpl ? "not " : "") + "directly implemented");
} }
} }
if (this.cacheStub) { if (this.cacheStub) {
@ -426,7 +426,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
* @see org.springframework.remoting.support.RemoteInvocation * @see org.springframework.remoting.support.RemoteInvocation
*/ */
protected Object doInvoke(MethodInvocation methodInvocation, RmiInvocationHandler invocationHandler) protected Object doInvoke(MethodInvocation methodInvocation, RmiInvocationHandler invocationHandler)
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
if (AopUtils.isToStringMethod(methodInvocation.getMethod())) { if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
return "RMI invoker proxy for service URL [" + getJndiName() + "]"; return "RMI invoker proxy for service URL [" + getJndiName() + "]";

View File

@ -152,8 +152,8 @@ public class RmiClientInterceptor extends RemoteInvocationBasedAccessor
else if (getServiceInterface() != null) { else if (getServiceInterface() != null) {
boolean isImpl = getServiceInterface().isInstance(remoteObj); boolean isImpl = getServiceInterface().isInstance(remoteObj);
logger.debug("Using service interface [" + getServiceInterface().getName() + logger.debug("Using service interface [" + getServiceInterface().getName() +
"] for RMI stub [" + getServiceUrl() + "] - " + "] for RMI stub [" + getServiceUrl() + "] - " +
(!isImpl ? "not " : "") + "directly implemented"); (!isImpl ? "not " : "") + "directly implemented");
} }
} }
if (this.cacheStub) { if (this.cacheStub) {

View File

@ -54,6 +54,6 @@ public interface RmiInvocationHandler extends Remote {
* @throws InvocationTargetException if the method invocation resulted in an exception * @throws InvocationTargetException if the method invocation resulted in an exception
*/ */
public Object invoke(RemoteInvocation invocation) public Object invoke(RemoteInvocation invocation)
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
} }

View File

@ -67,7 +67,7 @@ class RmiInvocationWrapper implements RmiInvocationHandler {
* @see RmiBasedExporter#invoke(org.springframework.remoting.support.RemoteInvocation, Object) * @see RmiBasedExporter#invoke(org.springframework.remoting.support.RemoteInvocation, Object)
*/ */
public Object invoke(RemoteInvocation invocation) public Object invoke(RemoteInvocation invocation)
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return this.rmiExporter.invoke(invocation, this.wrappedObject); return this.rmiExporter.invoke(invocation, this.wrappedObject);
} }

View File

@ -678,8 +678,8 @@ public final class ProxyFactoryBeanTests {
public void testFrozenFactoryBean() { public void testFrozenFactoryBean() {
BeanFactory bf = new XmlBeanFactory(new ClassPathResource(FROZEN_CONTEXT, CLASS)); BeanFactory bf = new XmlBeanFactory(new ClassPathResource(FROZEN_CONTEXT, CLASS));
Advised advised = (Advised)bf.getBean("frozen"); Advised advised = (Advised)bf.getBean("frozen");
assertTrue("The proxy should be frozen", advised.isFrozen()); assertTrue("The proxy should be frozen", advised.isFrozen());
} }
@Test @Test

View File

@ -46,7 +46,7 @@ public class AutowiredConfigurationTests {
@Test @Test
public void testAutowiredConfigurationDependencies() { public void testAutowiredConfigurationDependencies() {
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext( ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext(
AutowiredConfigurationTests.class.getSimpleName() + ".xml", AutowiredConfigurationTests.class); AutowiredConfigurationTests.class.getSimpleName() + ".xml", AutowiredConfigurationTests.class);
assertThat(factory.getBean("colour", Colour.class), equalTo(Colour.RED)); assertThat(factory.getBean("colour", Colour.class), equalTo(Colour.RED));
assertThat(factory.getBean("testBean", TestBean.class).getName(), equalTo(Colour.RED.toString())); assertThat(factory.getBean("testBean", TestBean.class).getName(), equalTo(Colour.RED.toString()));
@ -100,7 +100,7 @@ public class AutowiredConfigurationTests {
@Test @Test
public void testValueInjection() { public void testValueInjection() {
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext( ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext(
"ValueInjectionTests.xml", AutowiredConfigurationTests.class); "ValueInjectionTests.xml", AutowiredConfigurationTests.class);
System.clearProperty("myProp"); System.clearProperty("myProp");
@ -155,7 +155,7 @@ public class AutowiredConfigurationTests {
@Test @Test
public void testCustomProperties() { public void testCustomProperties() {
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext( ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext(
"AutowiredConfigurationTests-custom.xml", AutowiredConfigurationTests.class); "AutowiredConfigurationTests-custom.xml", AutowiredConfigurationTests.class);
TestBean testBean = factory.getBean("testBean", TestBean.class); TestBean testBean = factory.getBean("testBean", TestBean.class);
assertThat(testBean.getName(), equalTo("localhost")); assertThat(testBean.getName(), equalTo("localhost"));

View File

@ -42,140 +42,140 @@ import org.springframework.context.annotation.ImportResource;
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
public class ImportResourceTests { public class ImportResourceTests {
@Test @Test
public void testImportXml() { public void testImportXml() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlConfig.class);
assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean")); assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean"));
assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class); TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class);
assertEquals("myName", tb.getName()); assertEquals("myName", tb.getName());
} }
@Configuration @Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class ImportXmlConfig { static class ImportXmlConfig {
@Value("${name}") @Value("${name}")
private String name; private String name;
public @Bean TestBean javaDeclaredBean() { public @Bean TestBean javaDeclaredBean() {
return new TestBean(this.name); return new TestBean(this.name);
} }
} }
@Ignore // TODO: SPR-6310 @Ignore // TODO: SPR-6310
@Test @Test
public void testImportXmlWithRelativePath() { public void testImportXmlWithRelativePath() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithRelativePathConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithRelativePathConfig.class);
assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean")); assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean"));
assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class); TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class);
assertEquals("myName", tb.getName()); assertEquals("myName", tb.getName());
} }
@Configuration @Configuration
@ImportResource("ImportXmlConfig-context.xml") @ImportResource("ImportXmlConfig-context.xml")
static class ImportXmlWithRelativePathConfig { static class ImportXmlWithRelativePathConfig {
public @Bean TestBean javaDeclaredBean() { public @Bean TestBean javaDeclaredBean() {
return new TestBean("java.declared"); return new TestBean("java.declared");
} }
} }
@Ignore // TODO: SPR-6310 @Ignore // TODO: SPR-6310
@Test @Test
public void testImportXmlByConvention() { public void testImportXmlByConvention() {
ApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlByConventionConfig.class); ApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlByConventionConfig.class);
assertTrue("context does not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); assertTrue("context does not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
} }
@Configuration @Configuration
//@ImportXml //@ImportXml
static class ImportXmlByConventionConfig { static class ImportXmlByConventionConfig {
} }
@Test @Test
public void testImportXmlIsInheritedFromSuperclassDeclarations() { public void testImportXmlIsInheritedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FirstLevelSubConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FirstLevelSubConfig.class);
assertTrue(ctx.containsBean("xmlDeclaredBean")); assertTrue(ctx.containsBean("xmlDeclaredBean"));
} }
@Test @Test
public void testImportXmlIsMergedFromSuperclassDeclarations() { public void testImportXmlIsMergedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SecondLevelSubConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SecondLevelSubConfig.class);
assertTrue("failed to pick up second-level-declared XML bean", ctx.containsBean("secondLevelXmlDeclaredBean")); assertTrue("failed to pick up second-level-declared XML bean", ctx.containsBean("secondLevelXmlDeclaredBean"));
assertTrue("failed to pick up parent-declared XML bean", ctx.containsBean("xmlDeclaredBean")); assertTrue("failed to pick up parent-declared XML bean", ctx.containsBean("xmlDeclaredBean"));
} }
@Configuration @Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class BaseConfig { static class BaseConfig {
} }
@Configuration @Configuration
static class FirstLevelSubConfig extends BaseConfig { static class FirstLevelSubConfig extends BaseConfig {
} }
@Configuration @Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/SecondLevelSubConfig-context.xml") @ImportResource("classpath:org/springframework/context/annotation/configuration/SecondLevelSubConfig-context.xml")
static class SecondLevelSubConfig extends BaseConfig { static class SecondLevelSubConfig extends BaseConfig {
} }
@Test @Test
public void testImportXmlWithNamespaceConfig() { public void testImportXmlWithNamespaceConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithAopNamespaceConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithAopNamespaceConfig.class);
Object bean = ctx.getBean("proxiedXmlBean"); Object bean = ctx.getBean("proxiedXmlBean");
assertTrue(AopUtils.isAopProxy(bean)); assertTrue(AopUtils.isAopProxy(bean));
} }
@Configuration @Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml") @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml")
static class ImportXmlWithAopNamespaceConfig { static class ImportXmlWithAopNamespaceConfig {
} }
@Aspect @Aspect
static class AnAspect { static class AnAspect {
@Before("execution(* test.beans.TestBean.*(..))") @Before("execution(* test.beans.TestBean.*(..))")
public void advice() { } public void advice() { }
} }
@Test @Test
public void testImportXmlWithAutowiredConfig() { public void testImportXmlWithAutowiredConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlAutowiredConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlAutowiredConfig.class);
String name = ctx.getBean("xmlBeanName", String.class); String name = ctx.getBean("xmlBeanName", String.class);
assertThat(name, equalTo("xml.declared")); assertThat(name, equalTo("xml.declared"));
} }
@Configuration @Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") @ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class ImportXmlAutowiredConfig { static class ImportXmlAutowiredConfig {
@Autowired TestBean xmlDeclaredBean; @Autowired TestBean xmlDeclaredBean;
public @Bean String xmlBeanName() { public @Bean String xmlBeanName() {
return xmlDeclaredBean.getName(); return xmlDeclaredBean.getName();
} }
} }
@Test @Test
public void testImportNonXmlResource() { public void testImportNonXmlResource() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportNonXmlResourceConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportNonXmlResourceConfig.class);
assertTrue(ctx.containsBean("propertiesDeclaredBean")); assertTrue(ctx.containsBean("propertiesDeclaredBean"));
} }
@Configuration @Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties", @ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties",
reader=PropertiesBeanDefinitionReader.class) reader=PropertiesBeanDefinitionReader.class)
static class ImportNonXmlResourceConfig { static class ImportNonXmlResourceConfig {
} }
@Ignore // TODO: SPR-6327 @Ignore // TODO: SPR-6327
@Test @Test
public void testImportDifferentResourceTypes() { public void testImportDifferentResourceTypes() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SubResourceConfig.class); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SubResourceConfig.class);
assertTrue(ctx.containsBean("propertiesDeclaredBean")); assertTrue(ctx.containsBean("propertiesDeclaredBean"));
assertTrue(ctx.containsBean("xmlDeclaredBean")); assertTrue(ctx.containsBean("xmlDeclaredBean"));
} }
@Configuration @Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml", @ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml",
reader=XmlBeanDefinitionReader.class) reader=XmlBeanDefinitionReader.class)
static class SubResourceConfig extends ImportNonXmlResourceConfig { static class SubResourceConfig extends ImportNonXmlResourceConfig {
} }
} }

View File

@ -319,8 +319,7 @@ public final class ClassPathXmlApplicationContextTests {
@Test @Test
public void testResourceAndInputStream() throws IOException { public void testResourceAndInputStream() throws IOException {
ClassPathXmlApplicationContext ctx = ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(RESOURCE_CONTEXT) {
new ClassPathXmlApplicationContext(RESOURCE_CONTEXT) {
public Resource getResource(String location) { public Resource getResource(String location) {
if (TEST_PROPERTIES.equals(location)) { if (TEST_PROPERTIES.equals(location)) {
return new ClassPathResource(TEST_PROPERTIES, ClassPathXmlApplicationContextTests.class); return new ClassPathResource(TEST_PROPERTIES, ClassPathXmlApplicationContextTests.class);

View File

@ -26,7 +26,7 @@ import org.springframework.aop.ThrowsAdvice;
public class NoOpAdvice implements ThrowsAdvice { public class NoOpAdvice implements ThrowsAdvice {
public void afterThrowing(Exception ex) throws Throwable { public void afterThrowing(Exception ex) throws Throwable {
// no-op // no-op
} }
} }

View File

@ -27,22 +27,22 @@ import org.junit.Test;
*/ */
public class Spr7283Tests { public class Spr7283Tests {
@Test @Test
public void testListWithInconsistentElementType() { public void testListWithInconsistentElementType() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass()); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass());
List list = ctx.getBean("list", List.class); List list = ctx.getBean("list", List.class);
assertEquals(2, list.size()); assertEquals(2, list.size());
assertTrue(list.get(0) instanceof A); assertTrue(list.get(0) instanceof A);
assertTrue(list.get(1) instanceof B); assertTrue(list.get(1) instanceof B);
} }
public static class A { public static class A {
public A() {} public A() {}
} }
public static class B { public static class B {
public B() {} public B() {}
} }
} }

View File

@ -13,17 +13,17 @@ public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice {
public void before(Method method, Object[] objects, Object o) throws Throwable { public void before(Method method, Object[] objects, Object o) throws Throwable {
countBefore++; countBefore++;
System.out.println("Method:"+method.getName()); System.out.println("Method:"+method.getName());
} }
public void afterThrowing(Exception e) throws Throwable { public void afterThrowing(Exception e) throws Throwable {
countThrows++; countThrows++;
System.out.println("***********************************************************************************"); System.out.println("***********************************************************************************");
System.out.println("Exception caught:"); System.out.println("Exception caught:");
System.out.println("***********************************************************************************"); System.out.println("***********************************************************************************");
e.printStackTrace(); e.printStackTrace();
throw e; throw e;
} }
public int getCountBefore() { public int getCountBefore() {
return countBefore; return countBefore;

View File

@ -319,17 +319,17 @@ public class Constants {
* @see #toCodeForProperty * @see #toCodeForProperty
*/ */
public String propertyToConstantNamePrefix(String propertyName) { public String propertyToConstantNamePrefix(String propertyName) {
StringBuilder parsedPrefix = new StringBuilder(); StringBuilder parsedPrefix = new StringBuilder();
for(int i = 0; i < propertyName.length(); i++) { for (int i = 0; i < propertyName.length(); i++) {
char c = propertyName.charAt(i); char c = propertyName.charAt(i);
if (Character.isUpperCase(c)) { if (Character.isUpperCase(c)) {
parsedPrefix.append("_"); parsedPrefix.append("_");
parsedPrefix.append(c); parsedPrefix.append(c);
} }
else { else {
parsedPrefix.append(Character.toUpperCase(c)); parsedPrefix.append(Character.toUpperCase(c));
} }
} }
return parsedPrefix.toString(); return parsedPrefix.toString();
} }

View File

@ -94,23 +94,23 @@ public interface GenericConverter {
return this.targetType; return this.targetType;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj == null || obj.getClass() != ConvertiblePair.class) { if (obj == null || obj.getClass() != ConvertiblePair.class) {
return false; return false;
} }
ConvertiblePair other = (ConvertiblePair) obj; ConvertiblePair other = (ConvertiblePair) obj;
return this.sourceType.equals(other.sourceType) && this.targetType.equals(other.targetType); return this.sourceType.equals(other.sourceType) && this.targetType.equals(other.targetType);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return this.sourceType.hashCode() * 31 + this.targetType.hashCode(); return this.sourceType.hashCode() * 31 + this.targetType.hashCode();
} }
} }
} }

View File

@ -194,7 +194,7 @@ public abstract class AbstractResource implements Resource {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj == this || return (obj == this ||
(obj instanceof Resource && ((Resource) obj).getDescription().equals(getDescription()))); (obj instanceof Resource && ((Resource) obj).getDescription().equals(getDescription())));
} }
/** /**

View File

@ -112,7 +112,7 @@ public class ByteArrayResource extends AbstractResource {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj == this || return (obj == this ||
(obj instanceof ByteArrayResource && Arrays.equals(((ByteArrayResource) obj).byteArray, this.byteArray))); (obj instanceof ByteArrayResource && Arrays.equals(((ByteArrayResource) obj).byteArray, this.byteArray)));
} }
/** /**

View File

@ -70,7 +70,7 @@ public class DescriptiveResource extends AbstractResource {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj == this || return (obj == this ||
(obj instanceof DescriptiveResource && ((DescriptiveResource) obj).description.equals(this.description))); (obj instanceof DescriptiveResource && ((DescriptiveResource) obj).description.equals(this.description)));
} }
/** /**

View File

@ -204,7 +204,7 @@ public class FileSystemResource extends AbstractResource implements WritableReso
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj == this || return (obj == this ||
(obj instanceof FileSystemResource && this.path.equals(((FileSystemResource) obj).path))); (obj instanceof FileSystemResource && this.path.equals(((FileSystemResource) obj).path)));
} }
/** /**

View File

@ -111,7 +111,7 @@ public class InputStreamResource extends AbstractResource {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj == this || return (obj == this ||
(obj instanceof InputStreamResource && ((InputStreamResource) obj).inputStream.equals(this.inputStream))); (obj instanceof InputStreamResource && ((InputStreamResource) obj).inputStream.equals(this.inputStream)));
} }
/** /**

View File

@ -207,7 +207,7 @@ public class UrlResource extends AbstractFileResolvingResource {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj == this || return (obj == this ||
(obj instanceof UrlResource && this.cleanedUrl.equals(((UrlResource) obj).cleanedUrl))); (obj instanceof UrlResource && this.cleanedUrl.equals(((UrlResource) obj).cleanedUrl)));
} }
/** /**

View File

@ -61,7 +61,7 @@ public abstract class FileCopyUtils {
Assert.notNull(in, "No input File specified"); Assert.notNull(in, "No input File specified");
Assert.notNull(out, "No output File specified"); Assert.notNull(out, "No output File specified");
return copy(new BufferedInputStream(new FileInputStream(in)), return copy(new BufferedInputStream(new FileInputStream(in)),
new BufferedOutputStream(new FileOutputStream(out))); new BufferedOutputStream(new FileOutputStream(out)));
} }
/** /**

View File

@ -28,78 +28,78 @@ import static org.junit.Assert.*;
*/ */
public class ExceptionDepthComparatorTests { public class ExceptionDepthComparatorTests {
@Test @Test
public void targetBeforeSameDepth() throws Exception { public void targetBeforeSameDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, SameDepthException.class); Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, SameDepthException.class);
assertEquals(TargetException.class, foundClass); assertEquals(TargetException.class, foundClass);
} }
@Test @Test
public void sameDepthBeforeTarget() throws Exception { public void sameDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(SameDepthException.class, TargetException.class); Class<? extends Throwable> foundClass = findClosestMatch(SameDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass); assertEquals(TargetException.class, foundClass);
} }
@Test @Test
public void lowestDepthBeforeTarget() throws Exception { public void lowestDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, TargetException.class); Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass); assertEquals(TargetException.class, foundClass);
} }
@Test @Test
public void targetBeforeLowestDepth() throws Exception { public void targetBeforeLowestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, LowestDepthException.class); Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, LowestDepthException.class);
assertEquals(TargetException.class, foundClass); assertEquals(TargetException.class, foundClass);
} }
@Test @Test
public void noDepthBeforeTarget() throws Exception { public void noDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, TargetException.class); Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass); assertEquals(TargetException.class, foundClass);
} }
@Test @Test
public void noDepthBeforeHighestDepth() throws Exception { public void noDepthBeforeHighestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, HighestDepthException.class); Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, HighestDepthException.class);
assertEquals(HighestDepthException.class, foundClass); assertEquals(HighestDepthException.class, foundClass);
} }
@Test @Test
public void highestDepthBeforeNoDepth() throws Exception { public void highestDepthBeforeNoDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, NoDepthException.class); Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, NoDepthException.class);
assertEquals(HighestDepthException.class, foundClass); assertEquals(HighestDepthException.class, foundClass);
} }
@Test @Test
public void highestDepthBeforeLowestDepth() throws Exception { public void highestDepthBeforeLowestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, LowestDepthException.class); Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, LowestDepthException.class);
assertEquals(LowestDepthException.class, foundClass); assertEquals(LowestDepthException.class, foundClass);
} }
@Test @Test
public void lowestDepthBeforeHighestDepth() throws Exception { public void lowestDepthBeforeHighestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, HighestDepthException.class); Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, HighestDepthException.class);
assertEquals(LowestDepthException.class, foundClass); assertEquals(LowestDepthException.class, foundClass);
} }
private Class<? extends Throwable> findClosestMatch(Class<? extends Throwable>... classes) { private Class<? extends Throwable> findClosestMatch(
return ExceptionDepthComparator.findClosestMatch(Arrays.asList(classes), new TargetException()); Class<? extends Throwable>... classes) {
} return ExceptionDepthComparator.findClosestMatch(Arrays.asList(classes), new TargetException());
}
public class HighestDepthException extends Throwable {
}
public class HighestDepthException extends Throwable { public class LowestDepthException extends HighestDepthException {
} }
public class LowestDepthException extends HighestDepthException { public class TargetException extends LowestDepthException {
} }
public class TargetException extends LowestDepthException { public class SameDepthException extends LowestDepthException {
} }
public class SameDepthException extends LowestDepthException { public class NoDepthException extends TargetException {
} }
public class NoDepthException extends TargetException {
}
} }

View File

@ -130,26 +130,26 @@ public class GenericTypeResolverTests {
assertEquals(Object.class, resolveReturnTypeForGenericMethod(extractMagicValue, new Object[] { map })); assertEquals(Object.class, resolveReturnTypeForGenericMethod(extractMagicValue, new Object[] { map }));
} }
/** /**
* @since 3.2 * @since 3.2
*/ */
@Test @Test
public void testResolveType() { public void testResolveType() {
Method intMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerInputMessage", MyInterfaceType.class); Method intMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerInputMessage", MyInterfaceType.class);
MethodParameter intMessageMethodParam = new MethodParameter(intMessageMethod, 0); MethodParameter intMessageMethodParam = new MethodParameter(intMessageMethod, 0);
assertEquals(MyInterfaceType.class, assertEquals(MyInterfaceType.class,
resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>())); resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method intArrMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerArrayInputMessage", MyInterfaceType[].class); Method intArrMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerArrayInputMessage", MyInterfaceType[].class);
MethodParameter intArrMessageMethodParam = new MethodParameter(intArrMessageMethod, 0); MethodParameter intArrMessageMethodParam = new MethodParameter(intArrMessageMethod, 0);
assertEquals(MyInterfaceType[].class, assertEquals(MyInterfaceType[].class,
resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>())); resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method genericArrMessageMethod = findMethod(MySimpleTypeWithMethods.class, "readGenericArrayInputMessage", Object[].class); Method genericArrMessageMethod = findMethod(MySimpleTypeWithMethods.class, "readGenericArrayInputMessage", Object[].class);
MethodParameter genericArrMessageMethodParam = new MethodParameter(genericArrMessageMethod, 0); MethodParameter genericArrMessageMethodParam = new MethodParameter(genericArrMessageMethod, 0);
Map<TypeVariable, Type> varMap = getTypeVariableMap(MySimpleTypeWithMethods.class); Map<TypeVariable, Type> varMap = getTypeVariableMap(MySimpleTypeWithMethods.class);
assertEquals(Integer[].class, resolveType(genericArrMessageMethodParam.getGenericParameterType(), varMap)); assertEquals(Integer[].class, resolveType(genericArrMessageMethodParam.getGenericParameterType(), varMap));
} }
public interface MyInterfaceType<T> { public interface MyInterfaceType<T> {
@ -234,14 +234,14 @@ public class GenericTypeResolverTests {
return null; return null;
} }
public void readIntegerInputMessage(MyInterfaceType<Integer> message) { public void readIntegerInputMessage(MyInterfaceType<Integer> message) {
} }
public void readIntegerArrayInputMessage(MyInterfaceType<Integer>[] message) { public void readIntegerArrayInputMessage(MyInterfaceType<Integer>[] message) {
} }
public void readGenericArrayInputMessage(T[] message) { public void readGenericArrayInputMessage(T[] message) {
} }
} }
public static class MySimpleTypeWithMethods extends MyTypeWithMethods<Integer> { public static class MySimpleTypeWithMethods extends MyTypeWithMethods<Integer> {

View File

@ -35,4 +35,3 @@ public interface BeanResolver {
Object resolve(EvaluationContext context, String beanName) throws AccessException; Object resolve(EvaluationContext context, String beanName) throws AccessException;
} }

View File

@ -124,7 +124,7 @@ public class ReflectionHelper {
Class paramTypeClazz = paramType.getType(); Class paramTypeClazz = paramType.getType();
if (paramTypeClazz.isPrimitive()) { if (paramTypeClazz.isPrimitive()) {
paramTypeClazz = Object.class; paramTypeClazz = Object.class;
} }
Class superClass = argType.getClass().getSuperclass(); Class superClass = argType.getClass().getSuperclass();
while (superClass != null) { while (superClass != null) {
if (paramType.equals(superClass)) { if (paramType.equals(superClass)) {

View File

@ -192,7 +192,7 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
@Test @Test
public void testVarargsInvocation02() { public void testVarargsInvocation02() {
// Calling 'Fruit(int i, String... strings)' - returns int+length_of_strings // Calling 'Fruit(int i, String... strings)' - returns int+length_of_strings
evaluate("new org.springframework.expression.spel.testresources.Fruit(5,'a','b','c').stringscount()", 8, Integer.class); evaluate("new org.springframework.expression.spel.testresources.Fruit(5,'a','b','c').stringscount()", 8, Integer.class);
evaluate("new org.springframework.expression.spel.testresources.Fruit(2,'a').stringscount()", 3, Integer.class); evaluate("new org.springframework.expression.spel.testresources.Fruit(2,'a').stringscount()", 3, Integer.class);
evaluate("new org.springframework.expression.spel.testresources.Fruit(4).stringscount()", 4, Integer.class); evaluate("new org.springframework.expression.spel.testresources.Fruit(4).stringscount()", 4, Integer.class);

View File

@ -435,8 +435,8 @@ public class SpelDocumentationTests extends ExpressionTestCase {
ExpressionParser parser = new SpelExpressionParser(); ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext context = new StandardEvaluationContext(); StandardEvaluationContext context = new StandardEvaluationContext();
context.registerFunction("reverseString", context.registerFunction("reverseString", StringUtils.class.getDeclaredMethod(
StringUtils.class.getDeclaredMethod("reverseString", new Class[] { String.class })); "reverseString", new Class[] { String.class }));
String helloWorldReversed = parser.parseExpression("#reverseString('hello world')").getValue(context, String.class); String helloWorldReversed = parser.parseExpression("#reverseString('hello world')").getValue(context, String.class);
Assert.assertEquals("dlrow olleh",helloWorldReversed); Assert.assertEquals("dlrow olleh",helloWorldReversed);
@ -456,8 +456,8 @@ public class SpelDocumentationTests extends ExpressionTestCase {
parser.parseExpression("Name").setValue(societyContext, "IEEE"); parser.parseExpression("Name").setValue(societyContext, "IEEE");
societyContext.setVariable("queryName", "Nikola Tesla"); societyContext.setVariable("queryName", "Nikola Tesla");
String expression = "isMember(#queryName)? #queryName + ' is a member of the ' " + String expression = "isMember(#queryName)? #queryName + ' is a member of the ' "
"+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'"; + "+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'";
String queryResultString = parser.parseExpression(expression).getValue(societyContext, String.class); String queryResultString = parser.parseExpression(expression).getValue(societyContext, String.class);
Assert.assertEquals("Nikola Tesla is a member of the IEEE Society",queryResultString); Assert.assertEquals("Nikola Tesla is a member of the IEEE Society",queryResultString);
@ -487,28 +487,28 @@ public class SpelDocumentationTests extends ExpressionTestCase {
static class TemplatedParserContext implements ParserContext { static class TemplatedParserContext implements ParserContext {
public String getExpressionPrefix() { public String getExpressionPrefix() {
return "${"; return "${";
} }
public String getExpressionSuffix() { public String getExpressionSuffix() {
return "}"; return "}";
} }
public boolean isTemplate() { public boolean isTemplate() {
return true; return true;
} }
} }
static class StringUtils { static class StringUtils {
public static String reverseString(String input) { public static String reverseString(String input) {
StringBuilder backwards = new StringBuilder(); StringBuilder backwards = new StringBuilder();
for (int i = 0; i < input.length(); i++) { for (int i = 0; i < input.length(); i++) {
backwards.append(input.charAt(input.length() - 1 - i)); backwards.append(input.charAt(input.length() - 1 - i));
} }
return backwards.toString(); return backwards.toString();
} }
} }
} }

View File

@ -364,7 +364,7 @@ public interface JdbcOperations {
* @see java.sql.Types * @see java.sql.Types
*/ */
<T> T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor<T> rse) <T> T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor<T> rse)
throws DataAccessException; throws DataAccessException;
/** /**
* Query given SQL to create a prepared statement from SQL and a list * Query given SQL to create a prepared statement from SQL and a list
@ -422,7 +422,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails * @throws DataAccessException if the query fails
*/ */
void query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch) void query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch)
throws DataAccessException; throws DataAccessException;
/** /**
* Query given SQL to create a prepared statement from SQL and a list of * Query given SQL to create a prepared statement from SQL and a list of
@ -437,7 +437,7 @@ public interface JdbcOperations {
* @see java.sql.Types * @see java.sql.Types
*/ */
void query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch) void query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch)
throws DataAccessException; throws DataAccessException;
/** /**
* Query given SQL to create a prepared statement from SQL and a list of * Query given SQL to create a prepared statement from SQL and a list of
@ -510,7 +510,7 @@ public interface JdbcOperations {
* @see java.sql.Types * @see java.sql.Types
*/ */
<T> List<T> query(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper) <T> List<T> query(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
throws DataAccessException; throws DataAccessException;
/** /**
* Query given SQL to create a prepared statement from SQL and a list * Query given SQL to create a prepared statement from SQL and a list
@ -614,7 +614,7 @@ public interface JdbcOperations {
* @see java.sql.Types * @see java.sql.Types
*/ */
<T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> requiredType) <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> requiredType)
throws DataAccessException; throws DataAccessException;
/** /**
* Query given SQL to create a prepared statement from SQL and a * Query given SQL to create a prepared statement from SQL and a

View File

@ -60,4 +60,3 @@ public interface RowMapper<T> {
T mapRow(ResultSet rs, int rowNum) throws SQLException; T mapRow(ResultSet rs, int rowNum) throws SQLException;
} }

View File

@ -177,7 +177,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
DataSourceTransactionObject txObject = new DataSourceTransactionObject(); DataSourceTransactionObject txObject = new DataSourceTransactionObject();
txObject.setSavepointAllowed(isNestedTransactionAllowed()); txObject.setSavepointAllowed(isNestedTransactionAllowed());
ConnectionHolder conHolder = ConnectionHolder conHolder =
(ConnectionHolder) TransactionSynchronizationManager.getResource(this.dataSource); (ConnectionHolder) TransactionSynchronizationManager.getResource(this.dataSource);
txObject.setConnectionHolder(conHolder, false); txObject.setConnectionHolder(conHolder, false);
return txObject; return txObject;
} }

View File

@ -58,7 +58,7 @@ public abstract class LobCreatorUtils {
if (TransactionSynchronizationManager.isSynchronizationActive()) { if (TransactionSynchronizationManager.isSynchronizationActive()) {
logger.debug("Registering Spring transaction synchronization for LobCreator"); logger.debug("Registering Spring transaction synchronization for LobCreator");
TransactionSynchronizationManager.registerSynchronization( TransactionSynchronizationManager.registerSynchronization(
new SpringLobCreatorSynchronization(lobCreator)); new SpringLobCreatorSynchronization(lobCreator));
} }
else { else {
if (jtaTransactionManager != null) { if (jtaTransactionManager != null) {
@ -77,7 +77,7 @@ public abstract class LobCreatorUtils {
} }
} }
throw new IllegalStateException("Active Spring transaction synchronization or active " + throw new IllegalStateException("Active Spring transaction synchronization or active " +
"JTA transaction with specified [javax.transaction.TransactionManager] required"); "JTA transaction with specified [javax.transaction.TransactionManager] required");
} }
} }

View File

@ -414,7 +414,7 @@ public class OracleLobHandler extends AbstractLobHandler {
} }
public void setClobAsString(PreparedStatement ps, int paramIndex, final String content) public void setClobAsString(PreparedStatement ps, int paramIndex, final String content)
throws SQLException { throws SQLException {
if (content != null) { if (content != null) {
Clob clob = (Clob) createLob(ps, true, new LobCallback() { Clob clob = (Clob) createLob(ps, true, new LobCallback() {
@ -437,7 +437,7 @@ public class OracleLobHandler extends AbstractLobHandler {
public void setClobAsAsciiStream( public void setClobAsAsciiStream(
PreparedStatement ps, int paramIndex, final InputStream asciiStream, int contentLength) PreparedStatement ps, int paramIndex, final InputStream asciiStream, int contentLength)
throws SQLException { throws SQLException {
if (asciiStream != null) { if (asciiStream != null) {
Clob clob = (Clob) createLob(ps, true, new LobCallback() { Clob clob = (Clob) createLob(ps, true, new LobCallback() {
@ -460,7 +460,7 @@ public class OracleLobHandler extends AbstractLobHandler {
public void setClobAsCharacterStream( public void setClobAsCharacterStream(
PreparedStatement ps, int paramIndex, final Reader characterStream, int contentLength) PreparedStatement ps, int paramIndex, final Reader characterStream, int contentLength)
throws SQLException { throws SQLException {
if (characterStream != null) { if (characterStream != null) {
Clob clob = (Clob) createLob(ps, true, new LobCallback() { Clob clob = (Clob) createLob(ps, true, new LobCallback() {

View File

@ -94,11 +94,11 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
this.wrappedStatementClass = getClass().getClassLoader().loadClass(prefix + "WrappedStatement"); this.wrappedStatementClass = getClass().getClassLoader().loadClass(prefix + "WrappedStatement");
this.wrappedResultSetClass = getClass().getClassLoader().loadClass(prefix + "WrappedResultSet"); this.wrappedResultSetClass = getClass().getClassLoader().loadClass(prefix + "WrappedResultSet");
this.getUnderlyingConnectionMethod = this.getUnderlyingConnectionMethod =
this.wrappedConnectionClass.getMethod("getUnderlyingConnection", (Class[]) null); this.wrappedConnectionClass.getMethod("getUnderlyingConnection", (Class[]) null);
this.getUnderlyingStatementMethod = this.getUnderlyingStatementMethod =
this.wrappedStatementClass.getMethod("getUnderlyingStatement", (Class[]) null); this.wrappedStatementClass.getMethod("getUnderlyingStatement", (Class[]) null);
this.getUnderlyingResultSetMethod = this.getUnderlyingResultSetMethod =
this.wrappedResultSetClass.getMethod("getUnderlyingResultSet", (Class[]) null); this.wrappedResultSetClass.getMethod("getUnderlyingResultSet", (Class[]) null);
} }
catch (Exception ex) { catch (Exception ex) {
throw new IllegalStateException( throw new IllegalStateException(

View File

@ -160,7 +160,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked * @throws JmsException checked JMSException converted to unchecked
*/ */
void convertAndSend(Object message, MessagePostProcessor postProcessor) void convertAndSend(Object message, MessagePostProcessor postProcessor)
throws JmsException; throws JmsException;
/** /**
* Send the given object to the specified destination, converting the object * Send the given object to the specified destination, converting the object
@ -172,7 +172,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked * @throws JmsException checked JMSException converted to unchecked
*/ */
void convertAndSend(Destination destination, Object message, MessagePostProcessor postProcessor) void convertAndSend(Destination destination, Object message, MessagePostProcessor postProcessor)
throws JmsException; throws JmsException;
/** /**
* Send the given object to the specified destination, converting the object * Send the given object to the specified destination, converting the object
@ -185,7 +185,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked * @throws JmsException checked JMSException converted to unchecked
*/ */
void convertAndSend(String destinationName, Object message, MessagePostProcessor postProcessor) void convertAndSend(String destinationName, Object message, MessagePostProcessor postProcessor)
throws JmsException; throws JmsException;
//------------------------------------------------------------------------- //-------------------------------------------------------------------------

View File

@ -648,7 +648,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
public void convertAndSend( public void convertAndSend(
String destinationName, final Object message, final MessagePostProcessor postProcessor) String destinationName, final Object message, final MessagePostProcessor postProcessor)
throws JmsException { throws JmsException {
send(destinationName, new MessageCreator() { send(destinationName, new MessageCreator() {
public Message createMessage(Session session) throws JMSException { public Message createMessage(Session session) throws JMSException {

View File

@ -366,7 +366,7 @@ public class JmsTemplate102Tests extends TestCase {
template.execute(new ProducerCallback() { template.execute(new ProducerCallback() {
public Object doInJms(Session session, MessageProducer producer) public Object doInJms(Session session, MessageProducer producer)
throws JMSException { throws JMSException {
boolean b = session.getTransacted(); boolean b = session.getTransacted();
int i = producer.getPriority(); int i = producer.getPriority();
return null; return null;
@ -627,7 +627,7 @@ public class JmsTemplate102Tests extends TestCase {
else { else {
template.send("testQueue", new MessageCreator() { template.send("testQueue", new MessageCreator() {
public Message createMessage(Session session) public Message createMessage(Session session)
throws JMSException { throws JMSException {
return session.createTextMessage("just testing"); return session.createTextMessage("just testing");
} }
}); });
@ -690,7 +690,7 @@ public class JmsTemplate102Tests extends TestCase {
if (explicitTopic) { if (explicitTopic) {
template.send(mockTopic, new MessageCreator() { template.send(mockTopic, new MessageCreator() {
public Message createMessage(Session session) public Message createMessage(Session session)
throws JMSException { throws JMSException {
return session.createTextMessage("just testing"); return session.createTextMessage("just testing");
} }
}); });
@ -698,7 +698,7 @@ public class JmsTemplate102Tests extends TestCase {
else { else {
template.send("testTopic", new MessageCreator() { template.send("testTopic", new MessageCreator() {
public Message createMessage(Session session) public Message createMessage(Session session)
throws JMSException { throws JMSException {
return session.createTextMessage("just testing"); return session.createTextMessage("just testing");
} }
}); });

View File

@ -660,7 +660,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
@Override @Override
public void flush() { public void flush() {
try { try {
this.sessionHolder.getSession().flush(); this.sessionHolder.getSession().flush();
} }
catch (HibernateException ex) { catch (HibernateException ex) {
throw convertHibernateAccessException(ex); throw convertHibernateAccessException(ex);

View File

@ -888,7 +888,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
public void flush() { public void flush() {
try { try {
this.sessionHolder.getSession().flush(); this.sessionHolder.getSession().flush();
} }
catch (HibernateException ex) { catch (HibernateException ex) {
throw convertHibernateAccessException(ex); throw convertHibernateAccessException(ex);

View File

@ -41,7 +41,7 @@ public class LocalCacheProviderProxy implements CacheProvider {
// absolutely needs thread-bound CacheProvider to initialize // absolutely needs thread-bound CacheProvider to initialize
if (cp == null) { if (cp == null) {
throw new IllegalStateException("No Hibernate CacheProvider found - " + throw new IllegalStateException("No Hibernate CacheProvider found - " +
"'cacheProvider' property must be set on LocalSessionFactoryBean"); "'cacheProvider' property must be set on LocalSessionFactoryBean");
} }
this.cacheProvider = cp; this.cacheProvider = cp;
} }

View File

@ -49,7 +49,7 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
// absolutely needs thread-bound DataSource to initialize // absolutely needs thread-bound DataSource to initialize
if (this.dataSource == null) { if (this.dataSource == null) {
throw new HibernateException("No local DataSource found for configuration - " + throw new HibernateException("No local DataSource found for configuration - " +
"'dataSource' property must be set on LocalSessionFactoryBean"); "'dataSource' property must be set on LocalSessionFactoryBean");
} }
this.dataSourceToUse = getDataSourceToUse(this.dataSource); this.dataSourceToUse = getDataSourceToUse(this.dataSource);
} }

View File

@ -56,7 +56,7 @@ public class LocalRegionFactoryProxy implements RegionFactory {
// absolutely needs thread-bound RegionFactory to initialize // absolutely needs thread-bound RegionFactory to initialize
if (rf == null) { if (rf == null) {
throw new IllegalStateException("No Hibernate RegionFactory found - " + throw new IllegalStateException("No Hibernate RegionFactory found - " +
"'cacheRegionFactory' property must be set on LocalSessionFactoryBean"); "'cacheRegionFactory' property must be set on LocalSessionFactoryBean");
} }
this.regionFactory = rf; this.regionFactory = rf;
} }

View File

@ -53,7 +53,7 @@ public class LocalTransactionManagerLookup implements TransactionManagerLookup {
// absolutely needs thread-bound TransactionManager to initialize // absolutely needs thread-bound TransactionManager to initialize
if (tm == null) { if (tm == null) {
throw new IllegalStateException("No JTA TransactionManager found - " + throw new IllegalStateException("No JTA TransactionManager found - " +
"'jtaTransactionManager' property must be set on LocalSessionFactoryBean"); "'jtaTransactionManager' property must be set on LocalSessionFactoryBean");
} }
this.transactionManager = tm; this.transactionManager = tm;
} }

View File

@ -354,7 +354,7 @@ public abstract class SessionFactoryUtils {
if (!allowCreate && !isSessionTransactional(session, sessionFactory)) { if (!allowCreate && !isSessionTransactional(session, sessionFactory)) {
closeSession(session); closeSession(session);
throw new IllegalStateException("No Hibernate Session bound to thread, " + throw new IllegalStateException("No Hibernate Session bound to thread, " +
"and configuration does not allow creation of non-transactional one here"); "and configuration does not allow creation of non-transactional one here");
} }
return session; return session;
@ -371,8 +371,8 @@ public abstract class SessionFactoryUtils {
* @throws DataAccessResourceFailureException if the Session couldn't be created * @throws DataAccessResourceFailureException if the Session couldn't be created
*/ */
private static Session getJtaSynchronizedSession( private static Session getJtaSynchronizedSession(
SessionHolder sessionHolder, SessionFactory sessionFactory, SessionHolder sessionHolder, SessionFactory sessionFactory,
SQLExceptionTranslator jdbcExceptionTranslator) throws DataAccessResourceFailureException { SQLExceptionTranslator jdbcExceptionTranslator) throws DataAccessResourceFailureException {
// JTA synchronization is only possible with a javax.transaction.TransactionManager. // JTA synchronization is only possible with a javax.transaction.TransactionManager.
// We'll check the Hibernate SessionFactory: If a TransactionManagerLookup is specified // We'll check the Hibernate SessionFactory: If a TransactionManagerLookup is specified
@ -612,7 +612,7 @@ public abstract class SessionFactoryUtils {
public static void applyTransactionTimeout(Criteria criteria, SessionFactory sessionFactory) { public static void applyTransactionTimeout(Criteria criteria, SessionFactory sessionFactory) {
Assert.notNull(criteria, "No Criteria object specified"); Assert.notNull(criteria, "No Criteria object specified");
SessionHolder sessionHolder = SessionHolder sessionHolder =
(SessionHolder) TransactionSynchronizationManager.getResource(sessionFactory); (SessionHolder) TransactionSynchronizationManager.getResource(sessionFactory);
if (sessionHolder != null && sessionHolder.hasTimeout()) { if (sessionHolder != null && sessionHolder.hasTimeout()) {
criteria.setTimeout(sessionHolder.getTimeToLiveInSeconds()); criteria.setTimeout(sessionHolder.getTimeToLiveInSeconds());
} }

View File

@ -76,7 +76,7 @@ public abstract class AbstractLobType implements UserType {
*/ */
protected AbstractLobType() { protected AbstractLobType() {
this(LocalSessionFactoryBean.getConfigTimeLobHandler(), this(LocalSessionFactoryBean.getConfigTimeLobHandler(),
LocalSessionFactoryBean.getConfigTimeTransactionManager()); LocalSessionFactoryBean.getConfigTimeTransactionManager());
} }
/** /**
@ -150,7 +150,7 @@ public abstract class AbstractLobType implements UserType {
if (this.lobHandler == null) { if (this.lobHandler == null) {
throw new IllegalStateException("No LobHandler found for configuration - " + throw new IllegalStateException("No LobHandler found for configuration - " +
"lobHandler property must be set on LocalSessionFactoryBean"); "lobHandler property must be set on LocalSessionFactoryBean");
} }
try { try {
@ -172,7 +172,7 @@ public abstract class AbstractLobType implements UserType {
if (this.lobHandler == null) { if (this.lobHandler == null) {
throw new IllegalStateException("No LobHandler found for configuration - " + throw new IllegalStateException("No LobHandler found for configuration - " +
"lobHandler property must be set on LocalSessionFactoryBean"); "lobHandler property must be set on LocalSessionFactoryBean");
} }
LobCreator lobCreator = this.lobHandler.getLobCreator(); LobCreator lobCreator = this.lobHandler.getLobCreator();
@ -211,7 +211,7 @@ public abstract class AbstractLobType implements UserType {
* @throws HibernateException in case of any other exceptions * @throws HibernateException in case of any other exceptions
*/ */
protected abstract void nullSafeSetInternal( protected abstract void nullSafeSetInternal(
PreparedStatement ps, int index, Object value, LobCreator lobCreator) PreparedStatement ps, int index, Object value, LobCreator lobCreator)
throws SQLException, IOException, HibernateException; throws SQLException, IOException, HibernateException;
} }

View File

@ -138,7 +138,7 @@ public abstract class HibernateDaoSupport extends DaoSupport {
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession(SessionFactory, boolean) * @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession(SessionFactory, boolean)
*/ */
protected final Session getSession() protected final Session getSession()
throws DataAccessResourceFailureException, IllegalStateException { throws DataAccessResourceFailureException, IllegalStateException {
return getSession(this.hibernateTemplate.isAllowCreate()); return getSession(this.hibernateTemplate.isAllowCreate());
} }
@ -163,10 +163,10 @@ public abstract class HibernateDaoSupport extends DaoSupport {
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession(SessionFactory, boolean) * @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession(SessionFactory, boolean)
*/ */
protected final Session getSession(boolean allowCreate) protected final Session getSession(boolean allowCreate)
throws DataAccessResourceFailureException, IllegalStateException { throws DataAccessResourceFailureException, IllegalStateException {
return (!allowCreate ? return (!allowCreate ?
SessionFactoryUtils.getSession(getSessionFactory(), false) : SessionFactoryUtils.getSession(getSessionFactory(), false) :
SessionFactoryUtils.getSession( SessionFactoryUtils.getSession(
getSessionFactory(), getSessionFactory(),
this.hibernateTemplate.getEntityInterceptor(), this.hibernateTemplate.getEntityInterceptor(),

View File

@ -156,7 +156,7 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
} }
if ((isSingleSession() && TransactionSynchronizationManager.hasResource(getSessionFactory())) || if ((isSingleSession() && TransactionSynchronizationManager.hasResource(getSessionFactory())) ||
SessionFactoryUtils.isDeferredCloseActive(getSessionFactory())) { SessionFactoryUtils.isDeferredCloseActive(getSessionFactory())) {
// Do not modify the Session: just mark the request accordingly. // Do not modify the Session: just mark the request accordingly.
Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST); Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
int newCount = (count != null ? count + 1 : 1); int newCount = (count != null ? count + 1 : 1);

View File

@ -79,7 +79,7 @@ public abstract class AbstractLobTypeHandler extends BaseTypeHandler {
protected AbstractLobTypeHandler(LobHandler lobHandler) { protected AbstractLobTypeHandler(LobHandler lobHandler) {
if (lobHandler == null) { if (lobHandler == null) {
throw new IllegalStateException("No LobHandler found for configuration - " + throw new IllegalStateException("No LobHandler found for configuration - " +
"lobHandler property must be set on SqlMapClientFactoryBean"); "lobHandler property must be set on SqlMapClientFactoryBean");
} }
this.lobHandler = lobHandler; this.lobHandler = lobHandler;
} }

View File

@ -201,9 +201,9 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
Assert.notNull(action, "Callback object must not be null"); Assert.notNull(action, "Callback object must not be null");
PersistenceManager pm = PersistenceManagerFactoryUtils.getPersistenceManager( PersistenceManager pm = PersistenceManagerFactoryUtils.getPersistenceManager(
getPersistenceManagerFactory(), isAllowCreate()); getPersistenceManagerFactory(), isAllowCreate());
boolean existingTransaction = boolean existingTransaction =
TransactionSynchronizationManager.hasResource(getPersistenceManagerFactory()); TransactionSynchronizationManager.hasResource(getPersistenceManagerFactory());
try { try {
PersistenceManager pmToExpose = (exposeNativePersistenceManager ? pm : createPersistenceManagerProxy(pm)); PersistenceManager pmToExpose = (exposeNativePersistenceManager ? pm : createPersistenceManagerProxy(pm));
T result = action.doInJdo(pmToExpose); T result = action.doInJdo(pmToExpose);

View File

@ -281,7 +281,7 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
public Class<? extends PersistenceManagerFactory> getObjectType() { public Class<? extends PersistenceManagerFactory> getObjectType() {
return (this.persistenceManagerFactory != null ? return (this.persistenceManagerFactory != null ?
this.persistenceManagerFactory.getClass() : PersistenceManagerFactory.class); this.persistenceManagerFactory.getClass() : PersistenceManagerFactory.class);
} }
public boolean isSingleton() { public boolean isSingleton() {

View File

@ -106,7 +106,7 @@ public abstract class PersistenceManagerFactoryUtils {
* @see JdoTransactionManager * @see JdoTransactionManager
*/ */
public static PersistenceManager getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) public static PersistenceManager getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate)
throws DataAccessResourceFailureException, IllegalStateException { throws DataAccessResourceFailureException, IllegalStateException {
try { try {
return doGetPersistenceManager(pmf, allowCreate); return doGetPersistenceManager(pmf, allowCreate);
@ -133,7 +133,7 @@ public abstract class PersistenceManagerFactoryUtils {
* @see JdoTransactionManager * @see JdoTransactionManager
*/ */
public static PersistenceManager doGetPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) public static PersistenceManager doGetPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate)
throws JDOException, IllegalStateException { throws JDOException, IllegalStateException {
Assert.notNull(pmf, "No PersistenceManagerFactory specified"); Assert.notNull(pmf, "No PersistenceManagerFactory specified");
@ -204,7 +204,7 @@ public abstract class PersistenceManagerFactoryUtils {
Assert.notNull(query, "No Query object specified"); Assert.notNull(query, "No Query object specified");
PersistenceManagerHolder pmHolder = PersistenceManagerHolder pmHolder =
(PersistenceManagerHolder) TransactionSynchronizationManager.getResource(pmf); (PersistenceManagerHolder) TransactionSynchronizationManager.getResource(pmf);
if (pmHolder != null && pmHolder.hasTimeout()) { if (pmHolder != null && pmHolder.hasTimeout()) {
jdoDialect.applyQueryTimeout(query, pmHolder.getTimeToLiveInSeconds()); jdoDialect.applyQueryTimeout(query, pmHolder.getTimeToLiveInSeconds());
} }

View File

@ -144,7 +144,7 @@ public abstract class JdoDaoSupport extends DaoSupport {
* @see org.springframework.orm.jdo.PersistenceManagerFactoryUtils#getPersistenceManager * @see org.springframework.orm.jdo.PersistenceManagerFactoryUtils#getPersistenceManager
*/ */
protected final PersistenceManager getPersistenceManager(boolean allowCreate) protected final PersistenceManager getPersistenceManager(boolean allowCreate)
throws DataAccessResourceFailureException, IllegalStateException { throws DataAccessResourceFailureException, IllegalStateException {
return PersistenceManagerFactoryUtils.getPersistenceManager(getPersistenceManagerFactory(), allowCreate); return PersistenceManagerFactoryUtils.getPersistenceManager(getPersistenceManagerFactory(), allowCreate);
} }

View File

@ -659,7 +659,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
public void flush() { public void flush() {
try { try {
this.entityManagerHolder.getEntityManager().flush(); this.entityManagerHolder.getEntityManager().flush();
} }
catch (RuntimeException ex) { catch (RuntimeException ex) {
throw DataAccessUtils.translateIfNecessary(ex, getJpaDialect()); throw DataAccessUtils.translateIfNecessary(ex, getJpaDialect());

View File

@ -436,7 +436,7 @@ public class OpenSessionInViewTests {
final FilterChain filterChain2 = new FilterChain() { final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException { throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(sf2)); assertTrue(TransactionSynchronizationManager.hasResource(sf2));
filter.doFilter(servletRequest, servletResponse, filterChain); filter.doFilter(servletRequest, servletResponse, filterChain);
} }
@ -665,7 +665,7 @@ public class OpenSessionInViewTests {
final FilterChain filterChain2 = new FilterChain() { final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException { throws IOException, ServletException {
HibernateTransactionManager tm = new HibernateTransactionManager(sf2); HibernateTransactionManager tm = new HibernateTransactionManager(sf2);
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition()); TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
@ -767,7 +767,7 @@ public class OpenSessionInViewTests {
FilterChain filterChain2 = new FilterChain() { FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException { throws IOException, ServletException {
filter.doFilter(servletRequest, servletResponse, filterChain); filter.doFilter(servletRequest, servletResponse, filterChain);
} }
}; };

View File

@ -154,7 +154,7 @@ public class OpenPersistenceManagerInViewTests extends TestCase {
final FilterChain filterChain2 = new FilterChain() { final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException { throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(pmf2)); assertTrue(TransactionSynchronizationManager.hasResource(pmf2));
filter.doFilter(servletRequest, servletResponse, filterChain); filter.doFilter(servletRequest, servletResponse, filterChain);
} }

View File

@ -265,7 +265,7 @@ public class OpenEntityManagerInViewTests extends TestCase {
final FilterChain filterChain2 = new FilterChain() { final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException { throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(factory2)); assertTrue(TransactionSynchronizationManager.hasResource(factory2));
filter.doFilter(servletRequest, servletResponse, filterChain); filter.doFilter(servletRequest, servletResponse, filterChain);
} }
@ -334,7 +334,7 @@ public class OpenEntityManagerInViewTests extends TestCase {
final FilterChain filterChain2 = new FilterChain() { final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException { throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(factory2)); assertTrue(TransactionSynchronizationManager.hasResource(factory2));
filter.doFilter(servletRequest, servletResponse, filterChain); filter.doFilter(servletRequest, servletResponse, filterChain);
count2.incrementAndGet(); count2.incrementAndGet();

View File

@ -30,9 +30,9 @@ public abstract class XmlMappingException extends NestedRuntimeException {
* Construct an <code>XmlMappingException</code> with the specified detail message. * Construct an <code>XmlMappingException</code> with the specified detail message.
* @param msg the detail message * @param msg the detail message
*/ */
public XmlMappingException(String msg) { public XmlMappingException(String msg) {
super(msg); super(msg);
} }
/** /**
* Construct an <code>XmlMappingException</code> with the specified detail message * Construct an <code>XmlMappingException</code> with the specified detail message
@ -40,8 +40,8 @@ public abstract class XmlMappingException extends NestedRuntimeException {
* @param msg the detail message * @param msg the detail message
* @param cause the nested exception * @param cause the nested exception
*/ */
public XmlMappingException(String msg, Throwable cause) { public XmlMappingException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
} }
} }

View File

@ -425,12 +425,12 @@ public class XStreamMarshaller extends AbstractMarshaller implements Initializin
@Override @Override
protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException { protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException {
if (this.streamDriver != null) { if (this.streamDriver != null) {
marshal(graph, this.streamDriver.createWriter(outputStream)); marshal(graph, this.streamDriver.createWriter(outputStream));
} }
else { else {
marshalWriter(graph, new OutputStreamWriter(outputStream, this.encoding)); marshalWriter(graph, new OutputStreamWriter(outputStream, this.encoding));
} }
} }
@Override @Override

View File

@ -24,34 +24,34 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(namespace = "http://springframework.org/spring-ws") @XmlRootElement(namespace = "http://springframework.org/spring-ws")
public class BinaryObject { public class BinaryObject {
@XmlElement(namespace = "http://springframework.org/spring-ws") @XmlElement(namespace = "http://springframework.org/spring-ws")
private byte[] bytes; private byte[] bytes;
@XmlElement(namespace = "http://springframework.org/spring-ws") @XmlElement(namespace = "http://springframework.org/spring-ws")
private DataHandler dataHandler; private DataHandler dataHandler;
@XmlElement(namespace = "http://springframework.org/spring-ws") @XmlElement(namespace = "http://springframework.org/spring-ws")
@XmlAttachmentRef @XmlAttachmentRef
private DataHandler swaDataHandler; private DataHandler swaDataHandler;
public BinaryObject() { public BinaryObject() {
} }
public BinaryObject(byte[] bytes, DataHandler dataHandler) { public BinaryObject(byte[] bytes, DataHandler dataHandler) {
this.bytes = bytes; this.bytes = bytes;
this.dataHandler = dataHandler; this.dataHandler = dataHandler;
swaDataHandler = dataHandler; swaDataHandler = dataHandler;
} }
public byte[] getBytes() { public byte[] getBytes() {
return bytes; return bytes;
} }
public DataHandler getDataHandler() { public DataHandler getDataHandler() {
return dataHandler; return dataHandler;
} }
public DataHandler getSwaDataHandler() { public DataHandler getSwaDataHandler() {
return swaDataHandler; return swaDataHandler;
} }
} }

View File

@ -20,17 +20,17 @@ import java.util.ArrayList;
public class Flights { public class Flights {
protected ArrayList flightList = new ArrayList(); protected ArrayList flightList = new ArrayList();
public void addFlight(FlightType flight) { public void addFlight(FlightType flight) {
flightList.add(flight); flightList.add(flight);
} }
public FlightType getFlight(int index) { public FlightType getFlight(int index) {
return (FlightType) flightList.get(index); return (FlightType) flightList.get(index);
} }
public int sizeFlightList() { public int sizeFlightList() {
return flightList.size(); return flightList.size();
} }
} }

View File

@ -27,15 +27,15 @@ import org.junit.Test;
*/ */
public class XmlOptionsFactoryBeanTests { public class XmlOptionsFactoryBeanTests {
private XmlOptionsFactoryBean factoryBean = new XmlOptionsFactoryBean(); private XmlOptionsFactoryBean factoryBean = new XmlOptionsFactoryBean();
@Test @Test
public void xmlOptionsFactoryBean() throws Exception { public void xmlOptionsFactoryBean() throws Exception {
factoryBean.setOptions(Collections.singletonMap(XmlOptions.SAVE_PRETTY_PRINT, Boolean.TRUE)); factoryBean.setOptions(Collections.singletonMap(XmlOptions.SAVE_PRETTY_PRINT, Boolean.TRUE));
XmlOptions xmlOptions = factoryBean.getObject(); XmlOptions xmlOptions = factoryBean.getObject();
assertNotNull("No XmlOptions returned", xmlOptions); assertNotNull("No XmlOptions returned", xmlOptions);
assertTrue("Option not set", xmlOptions.hasOption(XmlOptions.SAVE_PRETTY_PRINT)); assertTrue("Option not set", xmlOptions.hasOption(XmlOptions.SAVE_PRETTY_PRINT));
assertFalse("Invalid option set", xmlOptions.hasOption(XmlOptions.LOAD_LINE_NUMBERS)); assertFalse("Invalid option set", xmlOptions.hasOption(XmlOptions.LOAD_LINE_NUMBERS));
} }
} }

View File

@ -21,14 +21,14 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("flight") @XStreamAlias("flight")
public class Flight { public class Flight {
@XStreamAlias("number") @XStreamAlias("number")
private long flightNumber; private long flightNumber;
public long getFlightNumber() { public long getFlightNumber() {
return flightNumber; return flightNumber;
} }
public void setFlightNumber(long number) { public void setFlightNumber(long number) {
this.flightNumber = number; this.flightNumber = number;
} }
} }

View File

@ -69,7 +69,7 @@ public abstract class ComponentControllerSupport extends ControllerSupport {
public final void perform( public final void perform(
ComponentContext componentContext, HttpServletRequest request, ComponentContext componentContext, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext) HttpServletResponse response, ServletContext servletContext)
throws ServletException, IOException { throws ServletException, IOException {
try { try {
execute(componentContext, request, response, servletContext); execute(componentContext, request, response, servletContext);
@ -97,7 +97,7 @@ public abstract class ComponentControllerSupport extends ControllerSupport {
public final void execute( public final void execute(
ComponentContext componentContext, HttpServletRequest request, ComponentContext componentContext, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext) HttpServletResponse response, ServletContext servletContext)
throws Exception { throws Exception {
synchronized (this) { synchronized (this) {
if (this.webApplicationContext == null) { if (this.webApplicationContext == null) {

View File

@ -138,7 +138,7 @@ public class TilesView extends InternalResourceView {
* @return the component definition * @return the component definition
*/ */
protected ComponentDefinition getComponentDefinition(DefinitionsFactory factory, HttpServletRequest request) protected ComponentDefinition getComponentDefinition(DefinitionsFactory factory, HttpServletRequest request)
throws Exception { throws Exception {
return factory.getDefinition(getUrl(), request, getServletContext()); return factory.getDefinition(getUrl(), request, getServletContext());
} }

View File

@ -340,7 +340,7 @@ public class ContextLoaderPlugIn implements PlugIn {
wac.setNamespace(getNamespace()); wac.setNamespace(getNamespace());
if (getContextConfigLocation() != null) { if (getContextConfigLocation() != null) {
wac.setConfigLocations( wac.setConfigLocations(
StringUtils.tokenizeToStringArray( StringUtils.tokenizeToStringArray(
getContextConfigLocation(), ConfigurableWebApplicationContext.CONFIG_LOCATION_DELIMITERS)); getContextConfigLocation(), ConfigurableWebApplicationContext.CONFIG_LOCATION_DELIMITERS));
} }
wac.addBeanFactoryPostProcessor( wac.addBeanFactoryPostProcessor(

View File

@ -37,7 +37,7 @@ public abstract class MatcherAssertionErrors {
private MatcherAssertionErrors() { private MatcherAssertionErrors() {
} }
/** /**
* Asserts that the given matcher matches the actual value. * Asserts that the given matcher matches the actual value.
@ -65,8 +65,8 @@ public abstract class MatcherAssertionErrors {
description.appendText("\nExpected: "); description.appendText("\nExpected: ");
description.appendDescriptionOf(matcher); description.appendDescriptionOf(matcher);
if (describeMismatchMethod != null) { if (describeMismatchMethod != null) {
description.appendText("\n but: "); description.appendText("\n but: ");
matcher.describeMismatch(actual, description); matcher.describeMismatch(actual, description);
} }
else { else {
description.appendText("\n got: "); description.appendText("\n got: ");

View File

@ -22,6 +22,6 @@ public interface RequestBuilder {
* @param servletContext the {@link ServletContext} to use to create the request * @param servletContext the {@link ServletContext} to use to create the request
* @return the request * @return the request
*/ */
MockHttpServletRequest buildRequest(ServletContext servletContext); MockHttpServletRequest buildRequest(ServletContext servletContext);
} }

View File

@ -86,461 +86,461 @@ public class StatusResultMatchers {
}; };
} }
/** /**
* Assert the response status code is {@code HttpStatus.CONTINUE} (100). * Assert the response status code is {@code HttpStatus.CONTINUE} (100).
*/ */
public ResultMatcher isContinue() { public ResultMatcher isContinue() {
return matcher(HttpStatus.CONTINUE); return matcher(HttpStatus.CONTINUE);
} }
/**
* Assert the response status code is {@code HttpStatus.SWITCHING_PROTOCOLS} (101).
*/
public ResultMatcher isSwitchingProtocols() {
return matcher(HttpStatus.SWITCHING_PROTOCOLS);
}
/**
* Assert the response status code is {@code HttpStatus.PROCESSING} (102).
*/
public ResultMatcher isProcessing() {
return matcher(HttpStatus.PROCESSING);
}
/**
* Assert the response status code is {@code HttpStatus.CHECKPOINT} (103).
*/
public ResultMatcher isCheckpoint() {
return matcher(HttpStatus.valueOf(103));
}
/**
* Assert the response status code is {@code HttpStatus.OK} (200).
*/
public ResultMatcher isOk() {
return matcher(HttpStatus.OK);
}
/**
* Assert the response status code is {@code HttpStatus.CREATED} (201).
*/
public ResultMatcher isCreated() {
return matcher(HttpStatus.CREATED);
}
/**
* Assert the response status code is {@code HttpStatus.ACCEPTED} (202).
*/
public ResultMatcher isAccepted() {
return matcher(HttpStatus.ACCEPTED);
}
/**
* Assert the response status code is {@code HttpStatus.NON_AUTHORITATIVE_INFORMATION} (203).
*/
public ResultMatcher isNonAuthoritativeInformation() {
return matcher(HttpStatus.NON_AUTHORITATIVE_INFORMATION);
}
/**
* Assert the response status code is {@code HttpStatus.NO_CONTENT} (204).
*/
public ResultMatcher isNoContent() {
return matcher(HttpStatus.NO_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.RESET_CONTENT} (205).
*/
public ResultMatcher isResetContent() {
return matcher(HttpStatus.RESET_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.PARTIAL_CONTENT} (206).
*/
public ResultMatcher isPartialContent() {
return matcher(HttpStatus.PARTIAL_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.MULTI_STATUS} (207).
*/
public ResultMatcher isMultiStatus() {
return matcher(HttpStatus.MULTI_STATUS);
}
/**
* Assert the response status code is {@code HttpStatus.ALREADY_REPORTED} (208).
*/
public ResultMatcher isAlreadyReported() {
return matcher(HttpStatus.ALREADY_REPORTED);
}
/**
* Assert the response status code is {@code HttpStatus.IM_USED} (226).
*/
public ResultMatcher isImUsed() {
return matcher(HttpStatus.IM_USED);
}
/**
* Assert the response status code is {@code HttpStatus.MULTIPLE_CHOICES} (300).
*/
public ResultMatcher isMultipleChoices() {
return matcher(HttpStatus.MULTIPLE_CHOICES);
}
/**
* Assert the response status code is {@code HttpStatus.MOVED_PERMANENTLY} (301).
*/
public ResultMatcher isMovedPermanently() {
return matcher(HttpStatus.MOVED_PERMANENTLY);
}
/**
* Assert the response status code is {@code HttpStatus.FOUND} (302).
*/
public ResultMatcher isFound() {
return matcher(HttpStatus.FOUND);
}
/**
* Assert the response status code is {@code HttpStatus.MOVED_TEMPORARILY} (302).
*/
public ResultMatcher isMovedTemporarily() {
return matcher(HttpStatus.MOVED_TEMPORARILY);
}
/**
* Assert the response status code is {@code HttpStatus.SEE_OTHER} (303).
*/
public ResultMatcher isSeeOther() {
return matcher(HttpStatus.SEE_OTHER);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_MODIFIED} (304).
*/
public ResultMatcher isNotModified() {
return matcher(HttpStatus.NOT_MODIFIED);
}
/**
* Assert the response status code is {@code HttpStatus.USE_PROXY} (305).
*/
public ResultMatcher isUseProxy() {
return matcher(HttpStatus.USE_PROXY);
}
/**
* Assert the response status code is {@code HttpStatus.TEMPORARY_REDIRECT} (307).
*/
public ResultMatcher isTemporaryRedirect() {
return matcher(HttpStatus.TEMPORARY_REDIRECT);
}
/**
* Assert the response status code is {@code HttpStatus.RESUME_INCOMPLETE} (308).
*/
public ResultMatcher isResumeIncomplete() {
return matcher(HttpStatus.valueOf(308));
}
/**
* Assert the response status code is {@code HttpStatus.BAD_REQUEST} (400).
*/
public ResultMatcher isBadRequest() {
return matcher(HttpStatus.BAD_REQUEST);
}
/**
* Assert the response status code is {@code HttpStatus.UNAUTHORIZED} (401).
*/
public ResultMatcher isUnauthorized() {
return matcher(HttpStatus.UNAUTHORIZED);
}
/**
* Assert the response status code is {@code HttpStatus.PAYMENT_REQUIRED} (402).
*/
public ResultMatcher isPaymentRequired() {
return matcher(HttpStatus.PAYMENT_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.FORBIDDEN} (403).
*/
public ResultMatcher isForbidden() {
return matcher(HttpStatus.FORBIDDEN);
}
/** /**
* Assert the response status code is {@code HttpStatus.NOT_FOUND} (404). * Assert the response status code is {@code HttpStatus.SWITCHING_PROTOCOLS} (101).
*/ */
public ResultMatcher isNotFound() { public ResultMatcher isSwitchingProtocols() {
return matcher(HttpStatus.NOT_FOUND); return matcher(HttpStatus.SWITCHING_PROTOCOLS);
} }
/** /**
* Assert the response status code is {@code HttpStatus.METHOD_NOT_ALLOWED} (405). * Assert the response status code is {@code HttpStatus.PROCESSING} (102).
*/ */
public ResultMatcher isMethodNotAllowed() { public ResultMatcher isProcessing() {
return matcher(HttpStatus.METHOD_NOT_ALLOWED); return matcher(HttpStatus.PROCESSING);
} }
/** /**
* Assert the response status code is {@code HttpStatus.NOT_ACCEPTABLE} (406). * Assert the response status code is {@code HttpStatus.CHECKPOINT} (103).
*/ */
public ResultMatcher isNotAcceptable() { public ResultMatcher isCheckpoint() {
return matcher(HttpStatus.NOT_ACCEPTABLE); return matcher(HttpStatus.valueOf(103));
} }
/** /**
* Assert the response status code is {@code HttpStatus.PROXY_AUTHENTICATION_REQUIRED} (407). * Assert the response status code is {@code HttpStatus.OK} (200).
*/ */
public ResultMatcher isProxyAuthenticationRequired() { public ResultMatcher isOk() {
return matcher(HttpStatus.PROXY_AUTHENTICATION_REQUIRED); return matcher(HttpStatus.OK);
} }
/** /**
* Assert the response status code is {@code HttpStatus.REQUEST_TIMEOUT} (408). * Assert the response status code is {@code HttpStatus.CREATED} (201).
*/ */
public ResultMatcher isRequestTimeout() { public ResultMatcher isCreated() {
return matcher(HttpStatus.REQUEST_TIMEOUT); return matcher(HttpStatus.CREATED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.CONFLICT} (409). * Assert the response status code is {@code HttpStatus.ACCEPTED} (202).
*/ */
public ResultMatcher isConflict() { public ResultMatcher isAccepted() {
return matcher(HttpStatus.CONFLICT); return matcher(HttpStatus.ACCEPTED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.GONE} (410). * Assert the response status code is {@code HttpStatus.NON_AUTHORITATIVE_INFORMATION} (203).
*/ */
public ResultMatcher isGone() { public ResultMatcher isNonAuthoritativeInformation() {
return matcher(HttpStatus.GONE); return matcher(HttpStatus.NON_AUTHORITATIVE_INFORMATION);
} }
/** /**
* Assert the response status code is {@code HttpStatus.LENGTH_REQUIRED} (411). * Assert the response status code is {@code HttpStatus.NO_CONTENT} (204).
*/ */
public ResultMatcher isLengthRequired() { public ResultMatcher isNoContent() {
return matcher(HttpStatus.LENGTH_REQUIRED); return matcher(HttpStatus.NO_CONTENT);
} }
/** /**
* Assert the response status code is {@code HttpStatus.PRECONDITION_FAILED} (412). * Assert the response status code is {@code HttpStatus.RESET_CONTENT} (205).
*/ */
public ResultMatcher isPreconditionFailed() { public ResultMatcher isResetContent() {
return matcher(HttpStatus.PRECONDITION_FAILED); return matcher(HttpStatus.RESET_CONTENT);
} }
/** /**
* Assert the response status code is {@code HttpStatus.REQUEST_ENTITY_TOO_LARGE} (413). * Assert the response status code is {@code HttpStatus.PARTIAL_CONTENT} (206).
*/ */
public ResultMatcher isRequestEntityTooLarge() { public ResultMatcher isPartialContent() {
return matcher(HttpStatus.REQUEST_ENTITY_TOO_LARGE); return matcher(HttpStatus.PARTIAL_CONTENT);
} }
/** /**
* Assert the response status code is {@code HttpStatus.REQUEST_URI_TOO_LONG} (414). * Assert the response status code is {@code HttpStatus.MULTI_STATUS} (207).
*/ */
public ResultMatcher isRequestUriTooLong() { public ResultMatcher isMultiStatus() {
return matcher(HttpStatus.REQUEST_URI_TOO_LONG); return matcher(HttpStatus.MULTI_STATUS);
} }
/** /**
* Assert the response status code is {@code HttpStatus.UNSUPPORTED_MEDIA_TYPE} (415). * Assert the response status code is {@code HttpStatus.ALREADY_REPORTED} (208).
*/ */
public ResultMatcher isUnsupportedMediaType() { public ResultMatcher isAlreadyReported() {
return matcher(HttpStatus.UNSUPPORTED_MEDIA_TYPE); return matcher(HttpStatus.ALREADY_REPORTED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE} (416). * Assert the response status code is {@code HttpStatus.IM_USED} (226).
*/ */
public ResultMatcher isRequestedRangeNotSatisfiable() { public ResultMatcher isImUsed() {
return matcher(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE); return matcher(HttpStatus.IM_USED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.EXPECTATION_FAILED} (417). * Assert the response status code is {@code HttpStatus.MULTIPLE_CHOICES} (300).
*/ */
public ResultMatcher isExpectationFailed() { public ResultMatcher isMultipleChoices() {
return matcher(HttpStatus.EXPECTATION_FAILED); return matcher(HttpStatus.MULTIPLE_CHOICES);
} }
/** /**
* Assert the response status code is {@code HttpStatus.I_AM_A_TEAPOT} (418). * Assert the response status code is {@code HttpStatus.MOVED_PERMANENTLY} (301).
*/ */
public ResultMatcher isIAmATeapot() { public ResultMatcher isMovedPermanently() {
return matcher(HttpStatus.valueOf(418)); return matcher(HttpStatus.MOVED_PERMANENTLY);
} }
/** /**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE} (419). * Assert the response status code is {@code HttpStatus.FOUND} (302).
* @deprecated matching the deprecation of HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE */
*/ public ResultMatcher isFound() {
public ResultMatcher isInsufficientSpaceOnResource() { return matcher(HttpStatus.FOUND);
return matcher(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE); }
}
/** /**
* Assert the response status code is {@code HttpStatus.METHOD_FAILURE} (420). * Assert the response status code is {@code HttpStatus.MOVED_TEMPORARILY} (302).
* @deprecated matching the deprecation of HttpStatus.METHOD_FAILURE */
*/ public ResultMatcher isMovedTemporarily() {
public ResultMatcher isMethodFailure() { return matcher(HttpStatus.MOVED_TEMPORARILY);
return matcher(HttpStatus.METHOD_FAILURE); }
}
/** /**
* Assert the response status code is {@code HttpStatus.DESTINATION_LOCKED} (421). * Assert the response status code is {@code HttpStatus.SEE_OTHER} (303).
* @deprecated matching the deprecation of HttpStatus.DESTINATION_LOCKED */
*/ public ResultMatcher isSeeOther() {
public ResultMatcher isDestinationLocked() { return matcher(HttpStatus.SEE_OTHER);
return matcher(HttpStatus.DESTINATION_LOCKED); }
}
/** /**
* Assert the response status code is {@code HttpStatus.UNPROCESSABLE_ENTITY} (422). * Assert the response status code is {@code HttpStatus.NOT_MODIFIED} (304).
*/ */
public ResultMatcher isUnprocessableEntity() { public ResultMatcher isNotModified() {
return matcher(HttpStatus.UNPROCESSABLE_ENTITY); return matcher(HttpStatus.NOT_MODIFIED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.LOCKED} (423). * Assert the response status code is {@code HttpStatus.USE_PROXY} (305).
*/ */
public ResultMatcher isLocked() { public ResultMatcher isUseProxy() {
return matcher(HttpStatus.LOCKED); return matcher(HttpStatus.USE_PROXY);
} }
/** /**
* Assert the response status code is {@code HttpStatus.FAILED_DEPENDENCY} (424). * Assert the response status code is {@code HttpStatus.TEMPORARY_REDIRECT} (307).
*/ */
public ResultMatcher isFailedDependency() { public ResultMatcher isTemporaryRedirect() {
return matcher(HttpStatus.FAILED_DEPENDENCY); return matcher(HttpStatus.TEMPORARY_REDIRECT);
} }
/** /**
* Assert the response status code is {@code HttpStatus.UPGRADE_REQUIRED} (426). * Assert the response status code is {@code HttpStatus.RESUME_INCOMPLETE} (308).
*/ */
public ResultMatcher isUpgradeRequired() { public ResultMatcher isResumeIncomplete() {
return matcher(HttpStatus.UPGRADE_REQUIRED); return matcher(HttpStatus.valueOf(308));
} }
/** /**
* Assert the response status code is {@code HttpStatus.PRECONDITION_REQUIRED} (428). * Assert the response status code is {@code HttpStatus.BAD_REQUEST} (400).
*/ */
public ResultMatcher isPreconditionRequired() { public ResultMatcher isBadRequest() {
return matcher(HttpStatus.valueOf(428)); return matcher(HttpStatus.BAD_REQUEST);
} }
/** /**
* Assert the response status code is {@code HttpStatus.TOO_MANY_REQUESTS} (429). * Assert the response status code is {@code HttpStatus.UNAUTHORIZED} (401).
*/ */
public ResultMatcher isTooManyRequests() { public ResultMatcher isUnauthorized() {
return matcher(HttpStatus.valueOf(429)); return matcher(HttpStatus.UNAUTHORIZED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE} (431). * Assert the response status code is {@code HttpStatus.PAYMENT_REQUIRED} (402).
*/ */
public ResultMatcher isRequestHeaderFieldsTooLarge() { public ResultMatcher isPaymentRequired() {
return matcher(HttpStatus.valueOf(431)); return matcher(HttpStatus.PAYMENT_REQUIRED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.INTERNAL_SERVER_ERROR} (500). * Assert the response status code is {@code HttpStatus.FORBIDDEN} (403).
*/ */
public ResultMatcher isInternalServerError() { public ResultMatcher isForbidden() {
return matcher(HttpStatus.INTERNAL_SERVER_ERROR); return matcher(HttpStatus.FORBIDDEN);
} }
/** /**
* Assert the response status code is {@code HttpStatus.NOT_IMPLEMENTED} (501). * Assert the response status code is {@code HttpStatus.NOT_FOUND} (404).
*/ */
public ResultMatcher isNotImplemented() { public ResultMatcher isNotFound() {
return matcher(HttpStatus.NOT_IMPLEMENTED); return matcher(HttpStatus.NOT_FOUND);
} }
/** /**
* Assert the response status code is {@code HttpStatus.BAD_GATEWAY} (502). * Assert the response status code is {@code HttpStatus.METHOD_NOT_ALLOWED} (405).
*/ */
public ResultMatcher isBadGateway() { public ResultMatcher isMethodNotAllowed() {
return matcher(HttpStatus.BAD_GATEWAY); return matcher(HttpStatus.METHOD_NOT_ALLOWED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.SERVICE_UNAVAILABLE} (503). * Assert the response status code is {@code HttpStatus.NOT_ACCEPTABLE} (406).
*/ */
public ResultMatcher isServiceUnavailable() { public ResultMatcher isNotAcceptable() {
return matcher(HttpStatus.SERVICE_UNAVAILABLE); return matcher(HttpStatus.NOT_ACCEPTABLE);
} }
/** /**
* Assert the response status code is {@code HttpStatus.GATEWAY_TIMEOUT} (504). * Assert the response status code is {@code HttpStatus.PROXY_AUTHENTICATION_REQUIRED} (407).
*/ */
public ResultMatcher isGatewayTimeout() { public ResultMatcher isProxyAuthenticationRequired() {
return matcher(HttpStatus.GATEWAY_TIMEOUT); return matcher(HttpStatus.PROXY_AUTHENTICATION_REQUIRED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.HTTP_VERSION_NOT_SUPPORTED} (505). * Assert the response status code is {@code HttpStatus.REQUEST_TIMEOUT} (408).
*/ */
public ResultMatcher isHttpVersionNotSupported() { public ResultMatcher isRequestTimeout() {
return matcher(HttpStatus.HTTP_VERSION_NOT_SUPPORTED); return matcher(HttpStatus.REQUEST_TIMEOUT);
} }
/** /**
* Assert the response status code is {@code HttpStatus.VARIANT_ALSO_NEGOTIATES} (506). * Assert the response status code is {@code HttpStatus.CONFLICT} (409).
*/ */
public ResultMatcher isVariantAlsoNegotiates() { public ResultMatcher isConflict() {
return matcher(HttpStatus.VARIANT_ALSO_NEGOTIATES); return matcher(HttpStatus.CONFLICT);
} }
/** /**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_STORAGE} (507). * Assert the response status code is {@code HttpStatus.GONE} (410).
*/ */
public ResultMatcher isInsufficientStorage() { public ResultMatcher isGone() {
return matcher(HttpStatus.INSUFFICIENT_STORAGE); return matcher(HttpStatus.GONE);
} }
/** /**
* Assert the response status code is {@code HttpStatus.LOOP_DETECTED} (508). * Assert the response status code is {@code HttpStatus.LENGTH_REQUIRED} (411).
*/ */
public ResultMatcher isLoopDetected() { public ResultMatcher isLengthRequired() {
return matcher(HttpStatus.LOOP_DETECTED); return matcher(HttpStatus.LENGTH_REQUIRED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.BANDWIDTH_LIMIT_EXCEEDED} (509). * Assert the response status code is {@code HttpStatus.PRECONDITION_FAILED} (412).
*/ */
public ResultMatcher isBandwidthLimitExceeded() { public ResultMatcher isPreconditionFailed() {
return matcher(HttpStatus.valueOf(509)); return matcher(HttpStatus.PRECONDITION_FAILED);
} }
/** /**
* Assert the response status code is {@code HttpStatus.NOT_EXTENDED} (510). * Assert the response status code is {@code HttpStatus.REQUEST_ENTITY_TOO_LARGE} (413).
*/ */
public ResultMatcher isNotExtended() { public ResultMatcher isRequestEntityTooLarge() {
return matcher(HttpStatus.NOT_EXTENDED); return matcher(HttpStatus.REQUEST_ENTITY_TOO_LARGE);
} }
/** /**
* Assert the response status code is {@code HttpStatus.NETWORK_AUTHENTICATION_REQUIRED} (511). * Assert the response status code is {@code HttpStatus.REQUEST_URI_TOO_LONG} (414).
*/ */
public ResultMatcher isNetworkAuthenticationRequired() { public ResultMatcher isRequestUriTooLong() {
return matcher(HttpStatus.valueOf(511)); return matcher(HttpStatus.REQUEST_URI_TOO_LONG);
} }
/** /**
* Assert the response status code is {@code HttpStatus.UNSUPPORTED_MEDIA_TYPE} (415).
*/
public ResultMatcher isUnsupportedMediaType() {
return matcher(HttpStatus.UNSUPPORTED_MEDIA_TYPE);
}
/**
* Assert the response status code is {@code HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE} (416).
*/
public ResultMatcher isRequestedRangeNotSatisfiable() {
return matcher(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE);
}
/**
* Assert the response status code is {@code HttpStatus.EXPECTATION_FAILED} (417).
*/
public ResultMatcher isExpectationFailed() {
return matcher(HttpStatus.EXPECTATION_FAILED);
}
/**
* Assert the response status code is {@code HttpStatus.I_AM_A_TEAPOT} (418).
*/
public ResultMatcher isIAmATeapot() {
return matcher(HttpStatus.valueOf(418));
}
/**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE} (419).
* @deprecated matching the deprecation of HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
*/
public ResultMatcher isInsufficientSpaceOnResource() {
return matcher(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE);
}
/**
* Assert the response status code is {@code HttpStatus.METHOD_FAILURE} (420).
* @deprecated matching the deprecation of HttpStatus.METHOD_FAILURE
*/
public ResultMatcher isMethodFailure() {
return matcher(HttpStatus.METHOD_FAILURE);
}
/**
* Assert the response status code is {@code HttpStatus.DESTINATION_LOCKED} (421).
* @deprecated matching the deprecation of HttpStatus.DESTINATION_LOCKED
*/
public ResultMatcher isDestinationLocked() {
return matcher(HttpStatus.DESTINATION_LOCKED);
}
/**
* Assert the response status code is {@code HttpStatus.UNPROCESSABLE_ENTITY} (422).
*/
public ResultMatcher isUnprocessableEntity() {
return matcher(HttpStatus.UNPROCESSABLE_ENTITY);
}
/**
* Assert the response status code is {@code HttpStatus.LOCKED} (423).
*/
public ResultMatcher isLocked() {
return matcher(HttpStatus.LOCKED);
}
/**
* Assert the response status code is {@code HttpStatus.FAILED_DEPENDENCY} (424).
*/
public ResultMatcher isFailedDependency() {
return matcher(HttpStatus.FAILED_DEPENDENCY);
}
/**
* Assert the response status code is {@code HttpStatus.UPGRADE_REQUIRED} (426).
*/
public ResultMatcher isUpgradeRequired() {
return matcher(HttpStatus.UPGRADE_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.PRECONDITION_REQUIRED} (428).
*/
public ResultMatcher isPreconditionRequired() {
return matcher(HttpStatus.valueOf(428));
}
/**
* Assert the response status code is {@code HttpStatus.TOO_MANY_REQUESTS} (429).
*/
public ResultMatcher isTooManyRequests() {
return matcher(HttpStatus.valueOf(429));
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE} (431).
*/
public ResultMatcher isRequestHeaderFieldsTooLarge() {
return matcher(HttpStatus.valueOf(431));
}
/**
* Assert the response status code is {@code HttpStatus.INTERNAL_SERVER_ERROR} (500).
*/
public ResultMatcher isInternalServerError() {
return matcher(HttpStatus.INTERNAL_SERVER_ERROR);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_IMPLEMENTED} (501).
*/
public ResultMatcher isNotImplemented() {
return matcher(HttpStatus.NOT_IMPLEMENTED);
}
/**
* Assert the response status code is {@code HttpStatus.BAD_GATEWAY} (502).
*/
public ResultMatcher isBadGateway() {
return matcher(HttpStatus.BAD_GATEWAY);
}
/**
* Assert the response status code is {@code HttpStatus.SERVICE_UNAVAILABLE} (503).
*/
public ResultMatcher isServiceUnavailable() {
return matcher(HttpStatus.SERVICE_UNAVAILABLE);
}
/**
* Assert the response status code is {@code HttpStatus.GATEWAY_TIMEOUT} (504).
*/
public ResultMatcher isGatewayTimeout() {
return matcher(HttpStatus.GATEWAY_TIMEOUT);
}
/**
* Assert the response status code is {@code HttpStatus.HTTP_VERSION_NOT_SUPPORTED} (505).
*/
public ResultMatcher isHttpVersionNotSupported() {
return matcher(HttpStatus.HTTP_VERSION_NOT_SUPPORTED);
}
/**
* Assert the response status code is {@code HttpStatus.VARIANT_ALSO_NEGOTIATES} (506).
*/
public ResultMatcher isVariantAlsoNegotiates() {
return matcher(HttpStatus.VARIANT_ALSO_NEGOTIATES);
}
/**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_STORAGE} (507).
*/
public ResultMatcher isInsufficientStorage() {
return matcher(HttpStatus.INSUFFICIENT_STORAGE);
}
/**
* Assert the response status code is {@code HttpStatus.LOOP_DETECTED} (508).
*/
public ResultMatcher isLoopDetected() {
return matcher(HttpStatus.LOOP_DETECTED);
}
/**
* Assert the response status code is {@code HttpStatus.BANDWIDTH_LIMIT_EXCEEDED} (509).
*/
public ResultMatcher isBandwidthLimitExceeded() {
return matcher(HttpStatus.valueOf(509));
}
/**
* Assert the response status code is {@code HttpStatus.NOT_EXTENDED} (510).
*/
public ResultMatcher isNotExtended() {
return matcher(HttpStatus.NOT_EXTENDED);
}
/**
* Assert the response status code is {@code HttpStatus.NETWORK_AUTHENTICATION_REQUIRED} (511).
*/
public ResultMatcher isNetworkAuthenticationRequired() {
return matcher(HttpStatus.valueOf(511));
}
/**
* Match the expected response status to that of the HttpServletResponse * Match the expected response status to that of the HttpServletResponse
*/ */
private ResultMatcher matcher(final HttpStatus status) { private ResultMatcher matcher(final HttpStatus status) {
return new ResultMatcher() { return new ResultMatcher() {
public void match(MvcResult result) { public void match(MvcResult result) {
assertEquals("Status", status.value(), result.getResponse().getStatus()); assertEquals("Status", status.value(), result.getResponse().getStatus());

View File

@ -62,7 +62,7 @@ final class PatternMappingFilterProxy implements Filter {
Assert.notNull(delegate, "A delegate Filter is required"); Assert.notNull(delegate, "A delegate Filter is required");
this.delegate = delegate; this.delegate = delegate;
for(String urlPattern : urlPatterns) { for(String urlPattern : urlPatterns) {
addUrlPattern(urlPattern); addUrlPattern(urlPattern);
} }
} }

Some files were not shown because too many files have changed in this diff Show More