提交 2cf45bad 编写于 作者: P Phillip Webb 提交者: Chris Beams

Replace space indentation with tabs

Issue: SPR-10127
上级 1762157a
......@@ -151,12 +151,12 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
}
Object interceptorOrInterceptionAdvice =
this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex);
this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex);
if (interceptorOrInterceptionAdvice instanceof InterceptorAndDynamicMethodMatcher) {
// Evaluate dynamic method matcher here: static part will already have
// been evaluated and found to match.
InterceptorAndDynamicMethodMatcher dm =
(InterceptorAndDynamicMethodMatcher) interceptorOrInterceptionAdvice;
(InterceptorAndDynamicMethodMatcher) interceptorOrInterceptionAdvice;
if (dm.methodMatcher.matches(this.method, this.targetClass, this.arguments)) {
return dm.interceptor.invoke(this);
}
......
......@@ -78,8 +78,10 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
Object target = this.targetInThread.get();
if (target == null) {
if (logger.isDebugEnabled()) {
logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " +
"creating one and binding it to thread '" + Thread.currentThread().getName() + "'");
logger.debug("No target for prototype '" + getTargetBeanName() +
"' bound to thread: " +
"creating one and binding it to thread '" +
Thread.currentThread().getName() + "'");
}
// Associate target with ThreadLocal.
target = newPrototypeInstance();
......
......@@ -90,9 +90,9 @@ public final class TigerAspectJExpressionPointcutTests {
@Test
public void testMatchVarargs() throws SecurityException, NoSuchMethodException {
class MyTemplate {
public int queryForInt(String sql, Object... params) {
return 0;
}
public int queryForInt(String sql, Object... params) {
return 0;
}
}
String expression = "execution(int *.*(String, Object...))";
......@@ -101,8 +101,8 @@ public final class TigerAspectJExpressionPointcutTests {
// TODO: the expression above no longer matches Object[]
// assertFalse(jdbcVarArgs.matches(
// JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class),
// JdbcTemplate.class));
// JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class),
// JdbcTemplate.class));
assertTrue(jdbcVarArgs.matches(
MyTemplate.class.getMethod("queryForInt", String.class, Object[].class),
......
......@@ -131,14 +131,14 @@ public class TrickyAspectJPointcutExpressionTests {
}
public static interface TestService {
public String sayHello();
public String sayHello();
}
@Log
public static class TestServiceImpl implements TestService{
public String sayHello() {
throw new TestException("TestServiceImpl");
}
public static class TestServiceImpl implements TestService {
public String sayHello() {
throw new TestException("TestServiceImpl");
}
}
public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice {
......@@ -149,12 +149,12 @@ public class TrickyAspectJPointcutExpressionTests {
public void before(Method method, Object[] objects, Object o) throws Throwable {
countBefore++;
}
}
public void afterThrowing(Exception e) throws Throwable {
countThrows++;
throw e;
}
throw e;
}
public int getCountBefore() {
return countBefore;
......
......@@ -80,7 +80,7 @@ public final class TypePatternClassFilterTests {
@Test(expected=IllegalArgumentException.class)
public void testSetTypePatternWithNullArgument() throws Exception {
new TypePatternClassFilter(null);
new TypePatternClassFilter(null);
}
@Test(expected=IllegalStateException.class)
......
......@@ -411,6 +411,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
CannotBeUnlocked.class);
assertFalse("Type pattern must have excluded mixin", proxy instanceof Lockable);
}
/* prereq AspectJ 1.6.7
@Test
public void testIntroductionBasedOnAnnotationMatch_Spr5307() {
......@@ -426,8 +427,10 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
Lockable lockable = (Lockable)proxy;
lockable.locked();
}
*/
*/
// TODO: Why does this test fail? It hasn't been run before, so it maybe never actually passed...
public void XtestIntroductionWithArgumentBinding() {
TestBean target = new TestBean();
......@@ -764,8 +767,8 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
public void setAge(int a) {}
@Around(value="setAge(age)",argNames="age")
// @ArgNames({"age"}) // AMC needs more work here? ignoring pjp arg... ok??
// // argNames should be suported in Around as it is in Pointcut
// @ArgNames({"age"}) // AMC needs more work here? ignoring pjp arg... ok??
// argNames should be suported in Around as it is in Pointcut
public void changeReturnType(ProceedingJoinPoint pjp, int age) throws Throwable {
pjp.proceed(new Object[] {age*2});
}
......
......@@ -68,7 +68,7 @@ public final class MethodInvocationTests {
Method m = Object.class.getMethod("hashCode", (Class[]) null);
Object proxy = new Object();
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
// in the inner class above.
......
......@@ -41,7 +41,7 @@ package org.springframework.beans.factory.aspectj;
* @since 3.0.0
*/
public abstract aspect GenericInterfaceDrivenDependencyInjectionAspect<I> extends AbstractInterfaceDrivenDependencyInjectionAspect {
declare parents: I implements ConfigurableObject;
declare parents: I implements ConfigurableObject;
public pointcut inConfigurableBean() : within(I+);
......
......@@ -9,14 +9,14 @@ import org.springframework.dao.DataAccessException;
import org.springframework.orm.jpa.EntityManagerFactoryUtils;
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() {
DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(re);
if (dex != null) {
throw dex;
} else {
throw re;
}
}
}
\ No newline at end of file
after() throwing(RuntimeException re): entityManagerCall() {
DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(re);
if (dex != null) {
throw dex;
} else {
throw re;
}
}
}
......@@ -66,7 +66,7 @@ public abstract aspect AbstractTransactionAspect extends TransactionAspectSuppor
@SuppressAjWarnings("adviceDidNotMatch")
after(Object txObject) throwing(Throwable t) : transactionalMethodExecution(txObject) {
try {
completeTransactionAfterThrowing(TransactionAspectSupport.currentTransactionInfo(), t);
completeTransactionAfterThrowing(TransactionAspectSupport.currentTransactionInfo(), t);
}
catch (Throwable t2) {
logger.error("Failed to close transaction after throwing in a transactional method", t2);
......
......@@ -18,83 +18,83 @@ package org.springframework.mock.staticmock;
privileged aspect Person_Roo_Entity {
@javax.persistence.PersistenceContext
transient javax.persistence.EntityManager Person.entityManager;
@javax.persistence.Id
@javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
@javax.persistence.Column(name = "id")
private java.lang.Long Person.id;
@javax.persistence.Version
@javax.persistence.Column(name = "version")
private java.lang.Integer Person.version;
public java.lang.Long Person.getId() {
return this.id;
}
public void Person.setId(java.lang.Long id) {
this.id = id;
}
public java.lang.Integer Person.getVersion() {
return this.version;
}
public void Person.setVersion(java.lang.Integer version) {
this.version = version;
}
@org.springframework.transaction.annotation.Transactional
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?)");
this.entityManager.persist(this);
}
@org.springframework.transaction.annotation.Transactional
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?)");
this.entityManager.remove(this);
}
@org.springframework.transaction.annotation.Transactional
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?)");
this.entityManager.flush();
}
@org.springframework.transaction.annotation.Transactional
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?)");
Person merged = this.entityManager.merge(this);
this.entityManager.flush();
this.id = merged.getId();
}
public static long Person.countPeople() {
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?)");
return (Long) em.createQuery("select count(o) from Person o").getSingleResult();
}
public static java.util.List<Person> Person.findAllPeople() {
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?)");
return em.createQuery("select o from Person o").getResultList();
}
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");
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?)");
return em.find(Person.class, id);
}
public static java.util.List<Person> Person.findPersonEntries(int firstResult, int maxResults) {
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?)");
return em.createQuery("select o from Person o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
}
@javax.persistence.PersistenceContext
transient javax.persistence.EntityManager Person.entityManager;
@javax.persistence.Id
@javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
@javax.persistence.Column(name = "id")
private java.lang.Long Person.id;
@javax.persistence.Version
@javax.persistence.Column(name = "version")
private java.lang.Integer Person.version;
public java.lang.Long Person.getId() {
return this.id;
}
public void Person.setId(java.lang.Long id) {
this.id = id;
}
public java.lang.Integer Person.getVersion() {
return this.version;
}
public void Person.setVersion(java.lang.Integer version) {
this.version = version;
}
@org.springframework.transaction.annotation.Transactional
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?)");
this.entityManager.persist(this);
}
@org.springframework.transaction.annotation.Transactional
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?)");
this.entityManager.remove(this);
}
@org.springframework.transaction.annotation.Transactional
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?)");
this.entityManager.flush();
}
@org.springframework.transaction.annotation.Transactional
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?)");
Person merged = this.entityManager.merge(this);
this.entityManager.flush();
this.id = merged.getId();
}
public static long Person.countPeople() {
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?)");
return (Long) em.createQuery("select count(o) from Person o").getSingleResult();
}
public static java.util.List<Person> Person.findAllPeople() {
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?)");
return em.createQuery("select o from Person o").getResultList();
}
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");
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?)");
return em.find(Person.class, id);
}
public static java.util.List<Person> Person.findPersonEntries(int firstResult, int maxResults) {
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?)");
return em.createQuery("select o from Person o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
}
}
......@@ -103,7 +103,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
}
// Redefined with public visibility.
// Redefined with public visibility.
@Override
public Class getPropertyType(String propertyPath) {
return null;
......
......@@ -738,7 +738,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
}
else {
value = readMethod.invoke(object, (Object[]) null);
value = readMethod.invoke(object, (Object[]) null);
}
if (tokens.keys != null) {
......
......@@ -64,7 +64,7 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
if (fieldMap.containsKey(field.getName())) {
// ignore superclass declarations of fields already found in a subclass
}
else {
else {
fieldMap.put(field.getName(), field);
}
}
......
......@@ -191,7 +191,7 @@ public interface PropertyAccessor {
* @see #setPropertyValues(PropertyValues, boolean, boolean)
*/
void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown)
throws BeansException;
throws BeansException;
/**
* Perform a batch update with full control over behavior.
......@@ -213,6 +213,6 @@ public interface PropertyAccessor {
* successfully updated.
*/
void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid)
throws BeansException;
throws BeansException;
}
......@@ -159,7 +159,7 @@ public class FieldRetrievingFactoryBean
if (this.targetClass == null && this.targetObject == null) {
if (this.targetField != null) {
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.
......
......@@ -76,9 +76,9 @@ public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigu
*/
public void afterPropertiesSet() {
this.systemPrefs = (this.systemTreePath != null) ?
Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot();
Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot();
this.userPrefs = (this.userTreePath != null) ?
Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot();
Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot();
}
/**
......
......@@ -162,15 +162,15 @@ public class PropertyPathFactoryBean implements FactoryBean<Object>, BeanNameAwa
if (this.targetBeanWrapper == null && this.targetBeanName == null) {
if (this.propertyPath != null) {
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.
int dotIndex = this.beanName.indexOf('.');
if (dotIndex == -1) {
throw new IllegalArgumentException(
"Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " +
"bean name '" + this.beanName + "' does not follow 'beanName.property' syntax");
"Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " +
"bean name '" + this.beanName + "' does not follow 'beanName.property' syntax");
}
this.targetBeanName = this.beanName.substring(0, dotIndex);
this.propertyPath = this.beanName.substring(dotIndex + 1);
......
......@@ -80,7 +80,7 @@ class BeanDefinitionResource extends AbstractResource {
@Override
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof BeanDefinitionResource &&
(obj instanceof BeanDefinitionResource &&
((BeanDefinitionResource) obj).beanDefinition.equals(this.beanDefinition)));
}
......
......@@ -339,7 +339,7 @@ class BeanDefinitionValueResolver {
Object resolved = Array.newInstance(elementType, ml.size());
for (int i = 0; i < ml.size(); i++) {
Array.set(resolved, i,
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
}
return resolved;
}
......@@ -351,7 +351,7 @@ class BeanDefinitionValueResolver {
List<Object> resolved = new ArrayList<Object>(ml.size());
for (int i = 0; i < ml.size(); i++) {
resolved.add(
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
}
return resolved;
}
......
......@@ -744,7 +744,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter());
return (descriptor.getField() != null ?
converter.convertIfNecessary(value, type, descriptor.getField()) :
converter.convertIfNecessary(value, type, descriptor.getMethodParameter()));
converter.convertIfNecessary(value, type, descriptor.getMethodParameter()));
}
if (type.isArray()) {
......
......@@ -85,8 +85,8 @@ public class CustomNumberEditor extends PropertyEditorSupport {
* @see java.text.NumberFormat#parse
* @see java.text.NumberFormat#format
*/
public CustomNumberEditor(Class<? extends Number> numberClass, NumberFormat numberFormat, boolean allowEmpty)
throws IllegalArgumentException {
public CustomNumberEditor(Class<? extends Number> numberClass,
NumberFormat numberFormat, boolean allowEmpty) throws IllegalArgumentException {
if (numberClass == null || !Number.class.isAssignableFrom(numberClass)) {
throw new IllegalArgumentException("Property class must be a subclass of Number");
......
......@@ -159,7 +159,8 @@ public class MutableSortDefinition implements SortDefinition, Serializable {
}
SortDefinition otherSd = (SortDefinition) other;
return (getProperty().equals(otherSd.getProperty()) &&
isAscending() == otherSd.isAscending() && isIgnoreCase() == otherSd.isIgnoreCase());
isAscending() == otherSd.isAscending() &&
isIgnoreCase() == otherSd.isIgnoreCase());
}
@Override
......
......@@ -250,17 +250,17 @@ public final class BeanUtilsTests {
}
@Test
public void testSPR6063() {
PropertyDescriptor[] descrs = BeanUtils.getPropertyDescriptors(Bean.class);
PropertyDescriptor keyDescr = BeanUtils.getPropertyDescriptor(Bean.class, "value");
assertEquals(String.class, keyDescr.getPropertyType());
for (PropertyDescriptor propertyDescriptor : descrs) {
if (propertyDescriptor.getName().equals(keyDescr.getName())) {
assertEquals(propertyDescriptor.getName() + " has unexpected type", keyDescr.getPropertyType(), propertyDescriptor.getPropertyType());
}
}
}
public void testSPR6063() {
PropertyDescriptor[] descrs = BeanUtils.getPropertyDescriptors(Bean.class);
PropertyDescriptor keyDescr = BeanUtils.getPropertyDescriptor(Bean.class, "value");
assertEquals(String.class, keyDescr.getPropertyType());
for (PropertyDescriptor propertyDescriptor : descrs) {
if (propertyDescriptor.getName().equals(keyDescr.getName())) {
assertEquals(propertyDescriptor.getName() + " has unexpected type", keyDescr.getPropertyType(), propertyDescriptor.getPropertyType());
}
}
}
private void assertSignatureEquals(Method desiredMethod, String signature) {
assertEquals(desiredMethod, BeanUtils.resolveSignature(signature, MethodSignatureBean.class));
......
......@@ -27,20 +27,20 @@ import org.springframework.core.io.ClassPathResource;
*/
public class TestResourceUtils {
/**
* Loads a {@link ClassPathResource} qualified by the simple name of clazz,
* and relative to the package for clazz.
*
* <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
*
* <p>Intended for use loading context configuration XML files within JUnit tests.
*
* @param clazz
* @param resourceSuffix
*/
public static ClassPathResource qualifiedResource(Class<?> clazz, String resourceSuffix) {
return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz);
}
/**
* Loads a {@link ClassPathResource} qualified by the simple name of clazz,
* and relative to the package for clazz.
*
* <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
*
* <p>Intended for use loading context configuration XML files within JUnit tests.
*
* @param clazz
* @param resourceSuffix
*/
public static ClassPathResource qualifiedResource(Class<?> clazz, String resourceSuffix) {
return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz);
}
}
......@@ -241,7 +241,7 @@ public class MimeMessageHelper {
* @see #MimeMessageHelper(javax.mail.internet.MimeMessage, int, String)
*/
public MimeMessageHelper(MimeMessage mimeMessage, boolean multipart, String encoding)
throws MessagingException {
throws MessagingException {
this(mimeMessage, (multipart ? MULTIPART_MODE_MIXED_RELATED : MULTIPART_MODE_NO), encoding);
}
......@@ -283,7 +283,7 @@ public class MimeMessageHelper {
* @see #MULTIPART_MODE_MIXED_RELATED
*/
public MimeMessageHelper(MimeMessage mimeMessage, int multipartMode, String encoding)
throws MessagingException {
throws MessagingException {
this.mimeMessage = mimeMessage;
createMimeMultiparts(mimeMessage, multipartMode);
......@@ -380,8 +380,8 @@ public class MimeMessageHelper {
private void checkMultipart() throws IllegalStateException {
if (!isMultipart()) {
throw new IllegalStateException("Not in multipart mode - " +
"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.");
"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.");
}
}
......@@ -546,7 +546,7 @@ public class MimeMessageHelper {
public void setFrom(String from, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(from, "From address must not be 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 {
......@@ -608,8 +608,8 @@ public class MimeMessageHelper {
public void addTo(String to, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(to, "To address must not be null");
addTo(getEncoding() != null ?
new InternetAddress(to, personal, getEncoding()) :
new InternetAddress(to, personal));
new InternetAddress(to, personal, getEncoding()) :
new InternetAddress(to, personal));
}
......@@ -653,8 +653,8 @@ public class MimeMessageHelper {
public void addCc(String cc, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(cc, "Cc address must not be null");
addCc(getEncoding() != null ?
new InternetAddress(cc, personal, getEncoding()) :
new InternetAddress(cc, personal));
new InternetAddress(cc, personal, getEncoding()) :
new InternetAddress(cc, personal));
}
......@@ -698,8 +698,8 @@ public class MimeMessageHelper {
public void addBcc(String bcc, String personal) throws MessagingException, UnsupportedEncodingException {
Assert.notNull(bcc, "Bcc address must not be null");
addBcc(getEncoding() != null ?
new InternetAddress(bcc, personal, getEncoding()) :
new InternetAddress(bcc, personal));
new InternetAddress(bcc, personal, getEncoding()) :
new InternetAddress(bcc, personal));
}
private InternetAddress parseAddress(String address) throws MessagingException {
......@@ -960,7 +960,7 @@ public class MimeMessageHelper {
* @see #addInline(String, javax.activation.DataSource)
*/
public void addInline(String contentId, InputStreamSource inputStreamSource, String contentType)
throws MessagingException {
throws MessagingException {
Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
if (inputStreamSource instanceof Resource && ((Resource) inputStreamSource).isOpen()) {
......@@ -1035,7 +1035,7 @@ public class MimeMessageHelper {
* @see org.springframework.core.io.Resource
*/
public void addAttachment(String attachmentFilename, InputStreamSource inputStreamSource)
throws MessagingException {
throws MessagingException {
String contentType = getFileTypeMap().getContentType(attachmentFilename);
addAttachment(attachmentFilename, inputStreamSource, contentType);
......@@ -1059,7 +1059,7 @@ public class MimeMessageHelper {
*/
public void addAttachment(
String attachmentFilename, InputStreamSource inputStreamSource, String contentType)
throws MessagingException {
throws MessagingException {
Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
if (inputStreamSource instanceof Resource && ((Resource) inputStreamSource).isOpen()) {
......@@ -1079,7 +1079,7 @@ public class MimeMessageHelper {
* @return the Activation Framework DataSource
*/
protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) {
final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() {
public InputStream getInputStream() throws IOException {
......
......@@ -83,14 +83,14 @@ public class LocalDataSourceJobStore extends JobStoreCMT {
@Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
throws SchedulerConfigException {
throws SchedulerConfigException {
// Absolutely needs thread-bound DataSource to initialize.
this.dataSource = SchedulerFactoryBean.getConfigTimeDataSource();
if (this.dataSource == null) {
throw new SchedulerConfigException(
"No local DataSource found for configuration - " +
"'dataSource' property must be set on SchedulerFactoryBean");
"No local DataSource found for configuration - " +
"'dataSource' property must be set on SchedulerFactoryBean");
}
// Configure transactional connection settings for Quartz.
......
......@@ -52,8 +52,8 @@ public class LocalTaskExecutorThreadPool implements ThreadPool {
this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor();
if (this.taskExecutor == null) {
throw new SchedulerConfigException(
"No local TaskExecutor found for configuration - " +
"'taskExecutor' property must be set on SchedulerFactoryBean");
"No local TaskExecutor found for configuration - " +
"'taskExecutor' property must be set on SchedulerFactoryBean");
}
}
......
......@@ -77,8 +77,8 @@ public class ResourceLoaderClassLoadHelper implements ClassLoadHelper {
@SuppressWarnings("unchecked")
public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws ClassNotFoundException {
return loadClass(name);
}
return loadClass(name);
}
public URL getResource(String name) {
Resource resource = this.resourceLoader.getResource(name);
......
......@@ -32,7 +32,7 @@ public class CronTriggerBeanTests {
@Test
public void testStartTime() throws Exception {
CronTriggerBean bean = createTriggerBean();
CronTriggerBean bean = createTriggerBean();
Date startTime = new Date(System.currentTimeMillis() + 1234L);
bean.setStartTime(startTime);
bean.afterPropertiesSet();
......
......@@ -1257,7 +1257,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/
protected MessageSource getInternalParentMessageSource() {
return (getParent() instanceof AbstractApplicationContext) ?
((AbstractApplicationContext) getParent()).messageSource : getParent();
((AbstractApplicationContext) getParent()).messageSource : getParent();
}
......
......@@ -93,7 +93,7 @@ public class LocalSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor
}
catch (IllegalAccessException ex) {
throw new EjbAccessException("Could not access method [" + invocation.getMethod().getName() +
"] of local EJB [" + getJndiName() + "]", ex);
"] of local EJB [" + getJndiName() + "]", ex);
}
finally {
if (ejb instanceof EJBLocalObject) {
......
......@@ -106,7 +106,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke
if (targetEx instanceof RemoteException) {
RemoteException rex = (RemoteException) targetEx;
throw RmiClientInterceptorUtils.convertRmiAccessException(
invocation.getMethod(), rex, isConnectFailure(rex), getJndiName());
invocation.getMethod(), rex, isConnectFailure(rex), getJndiName());
}
else if (targetEx instanceof CreateException) {
throw RmiClientInterceptorUtils.convertRmiAccessException(
......
......@@ -190,8 +190,8 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
else if (getServiceInterface() != null) {
boolean isImpl = getServiceInterface().isInstance(remoteObj);
logger.debug("Using service interface [" + getServiceInterface().getName() +
"] for JNDI RMI object [" + getJndiName() + "] - " +
(!isImpl ? "not " : "") + "directly implemented");
"] for JNDI RMI object [" + getJndiName() + "] - " +
(!isImpl ? "not " : "") + "directly implemented");
}
}
if (this.cacheStub) {
......@@ -426,7 +426,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
* @see org.springframework.remoting.support.RemoteInvocation
*/
protected Object doInvoke(MethodInvocation methodInvocation, RmiInvocationHandler invocationHandler)
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
return "RMI invoker proxy for service URL [" + getJndiName() + "]";
......
......@@ -152,8 +152,8 @@ public class RmiClientInterceptor extends RemoteInvocationBasedAccessor
else if (getServiceInterface() != null) {
boolean isImpl = getServiceInterface().isInstance(remoteObj);
logger.debug("Using service interface [" + getServiceInterface().getName() +
"] for RMI stub [" + getServiceUrl() + "] - " +
(!isImpl ? "not " : "") + "directly implemented");
"] for RMI stub [" + getServiceUrl() + "] - " +
(!isImpl ? "not " : "") + "directly implemented");
}
}
if (this.cacheStub) {
......
......@@ -54,6 +54,6 @@ public interface RmiInvocationHandler extends Remote {
* @throws InvocationTargetException if the method invocation resulted in an exception
*/
public Object invoke(RemoteInvocation invocation)
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
}
......@@ -67,7 +67,7 @@ class RmiInvocationWrapper implements RmiInvocationHandler {
* @see RmiBasedExporter#invoke(org.springframework.remoting.support.RemoteInvocation, Object)
*/
public Object invoke(RemoteInvocation invocation)
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return this.rmiExporter.invoke(invocation, this.wrappedObject);
}
......
......@@ -678,8 +678,8 @@ public final class ProxyFactoryBeanTests {
public void testFrozenFactoryBean() {
BeanFactory bf = new XmlBeanFactory(new ClassPathResource(FROZEN_CONTEXT, CLASS));
Advised advised = (Advised)bf.getBean("frozen");
assertTrue("The proxy should be frozen", advised.isFrozen());
Advised advised = (Advised)bf.getBean("frozen");
assertTrue("The proxy should be frozen", advised.isFrozen());
}
@Test
......
......@@ -46,7 +46,7 @@ public class AutowiredConfigurationTests {
@Test
public void testAutowiredConfigurationDependencies() {
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("testBean", TestBean.class).getName(), equalTo(Colour.RED.toString()));
......@@ -100,7 +100,7 @@ public class AutowiredConfigurationTests {
@Test
public void testValueInjection() {
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext(
"ValueInjectionTests.xml", AutowiredConfigurationTests.class);
"ValueInjectionTests.xml", AutowiredConfigurationTests.class);
System.clearProperty("myProp");
......@@ -155,7 +155,7 @@ public class AutowiredConfigurationTests {
@Test
public void testCustomProperties() {
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext(
"AutowiredConfigurationTests-custom.xml", AutowiredConfigurationTests.class);
"AutowiredConfigurationTests-custom.xml", AutowiredConfigurationTests.class);
TestBean testBean = factory.getBean("testBean", TestBean.class);
assertThat(testBean.getName(), equalTo("localhost"));
......
......@@ -42,140 +42,140 @@ import org.springframework.context.annotation.ImportResource;
* @author Juergen Hoeller
*/
public class ImportResourceTests {
@Test
public void testImportXml() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlConfig.class);
assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean"));
assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
@Test
public void testImportXml() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlConfig.class);
assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean"));
assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class);
assertEquals("myName", tb.getName());
}
}
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class ImportXmlConfig {
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class ImportXmlConfig {
@Value("${name}")
private String name;
public @Bean TestBean javaDeclaredBean() {
return new TestBean(this.name);
}
}
@Ignore // TODO: SPR-6310
@Test
public void testImportXmlWithRelativePath() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithRelativePathConfig.class);
assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean"));
assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
public @Bean TestBean javaDeclaredBean() {
return new TestBean(this.name);
}
}
@Ignore // TODO: SPR-6310
@Test
public void testImportXmlWithRelativePath() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithRelativePathConfig.class);
assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean"));
assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class);
assertEquals("myName", tb.getName());
}
@Configuration
@ImportResource("ImportXmlConfig-context.xml")
static class ImportXmlWithRelativePathConfig {
public @Bean TestBean javaDeclaredBean() {
return new TestBean("java.declared");
}
}
@Ignore // TODO: SPR-6310
@Test
public void testImportXmlByConvention() {
ApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlByConventionConfig.class);
assertTrue("context does not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
}
@Configuration
//@ImportXml
static class ImportXmlByConventionConfig {
}
@Test
public void testImportXmlIsInheritedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FirstLevelSubConfig.class);
assertTrue(ctx.containsBean("xmlDeclaredBean"));
}
@Test
public void testImportXmlIsMergedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SecondLevelSubConfig.class);
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"));
}
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class BaseConfig {
}
@Configuration
static class FirstLevelSubConfig extends BaseConfig {
}
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/SecondLevelSubConfig-context.xml")
static class SecondLevelSubConfig extends BaseConfig {
}
@Test
public void testImportXmlWithNamespaceConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithAopNamespaceConfig.class);
Object bean = ctx.getBean("proxiedXmlBean");
assertTrue(AopUtils.isAopProxy(bean));
}
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml")
static class ImportXmlWithAopNamespaceConfig {
}
@Aspect
static class AnAspect {
@Before("execution(* test.beans.TestBean.*(..))")
public void advice() { }
}
@Test
public void testImportXmlWithAutowiredConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlAutowiredConfig.class);
String name = ctx.getBean("xmlBeanName", String.class);
assertThat(name, equalTo("xml.declared"));
}
@Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class ImportXmlAutowiredConfig {
@Autowired TestBean xmlDeclaredBean;
public @Bean String xmlBeanName() {
return xmlDeclaredBean.getName();
}
}
@Test
public void testImportNonXmlResource() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportNonXmlResourceConfig.class);
assertTrue(ctx.containsBean("propertiesDeclaredBean"));
}
@Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties",
reader=PropertiesBeanDefinitionReader.class)
static class ImportNonXmlResourceConfig {
}
@Ignore // TODO: SPR-6327
@Test
public void testImportDifferentResourceTypes() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SubResourceConfig.class);
assertTrue(ctx.containsBean("propertiesDeclaredBean"));
assertTrue(ctx.containsBean("xmlDeclaredBean"));
}
@Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml",
reader=XmlBeanDefinitionReader.class)
static class SubResourceConfig extends ImportNonXmlResourceConfig {
}
}
\ No newline at end of file
}
@Configuration
@ImportResource("ImportXmlConfig-context.xml")
static class ImportXmlWithRelativePathConfig {
public @Bean TestBean javaDeclaredBean() {
return new TestBean("java.declared");
}
}
@Ignore // TODO: SPR-6310
@Test
public void testImportXmlByConvention() {
ApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlByConventionConfig.class);
assertTrue("context does not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean"));
}
@Configuration
//@ImportXml
static class ImportXmlByConventionConfig {
}
@Test
public void testImportXmlIsInheritedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FirstLevelSubConfig.class);
assertTrue(ctx.containsBean("xmlDeclaredBean"));
}
@Test
public void testImportXmlIsMergedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SecondLevelSubConfig.class);
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"));
}
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class BaseConfig {
}
@Configuration
static class FirstLevelSubConfig extends BaseConfig {
}
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/SecondLevelSubConfig-context.xml")
static class SecondLevelSubConfig extends BaseConfig {
}
@Test
public void testImportXmlWithNamespaceConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithAopNamespaceConfig.class);
Object bean = ctx.getBean("proxiedXmlBean");
assertTrue(AopUtils.isAopProxy(bean));
}
@Configuration
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml")
static class ImportXmlWithAopNamespaceConfig {
}
@Aspect
static class AnAspect {
@Before("execution(* test.beans.TestBean.*(..))")
public void advice() { }
}
@Test
public void testImportXmlWithAutowiredConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlAutowiredConfig.class);
String name = ctx.getBean("xmlBeanName", String.class);
assertThat(name, equalTo("xml.declared"));
}
@Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml")
static class ImportXmlAutowiredConfig {
@Autowired TestBean xmlDeclaredBean;
public @Bean String xmlBeanName() {
return xmlDeclaredBean.getName();
}
}
@Test
public void testImportNonXmlResource() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportNonXmlResourceConfig.class);
assertTrue(ctx.containsBean("propertiesDeclaredBean"));
}
@Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties",
reader=PropertiesBeanDefinitionReader.class)
static class ImportNonXmlResourceConfig {
}
@Ignore // TODO: SPR-6327
@Test
public void testImportDifferentResourceTypes() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SubResourceConfig.class);
assertTrue(ctx.containsBean("propertiesDeclaredBean"));
assertTrue(ctx.containsBean("xmlDeclaredBean"));
}
@Configuration
@ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml",
reader=XmlBeanDefinitionReader.class)
static class SubResourceConfig extends ImportNonXmlResourceConfig {
}
}
......@@ -319,8 +319,7 @@ public final class ClassPathXmlApplicationContextTests {
@Test
public void testResourceAndInputStream() throws IOException {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(RESOURCE_CONTEXT) {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(RESOURCE_CONTEXT) {
public Resource getResource(String location) {
if (TEST_PROPERTIES.equals(location)) {
return new ClassPathResource(TEST_PROPERTIES, ClassPathXmlApplicationContextTests.class);
......
......@@ -26,7 +26,7 @@ import org.springframework.aop.ThrowsAdvice;
public class NoOpAdvice implements ThrowsAdvice {
public void afterThrowing(Exception ex) throws Throwable {
// no-op
// no-op
}
}
......@@ -27,22 +27,22 @@ import org.junit.Test;
*/
public class Spr7283Tests {
@Test
public void testListWithInconsistentElementType() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass());
@Test
public void testListWithInconsistentElementType() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass());
List list = ctx.getBean("list", List.class);
assertEquals(2, list.size());
assertTrue(list.get(0) instanceof A);
assertTrue(list.get(1) instanceof B);
}
}
public static class A {
public A() {}
}
public static class A {
public A() {}
}
public static class B {
public B() {}
}
public static class B {
public B() {}
}
}
......@@ -13,17 +13,17 @@ public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice {
public void before(Method method, Object[] objects, Object o) throws Throwable {
countBefore++;
System.out.println("Method:"+method.getName());
}
System.out.println("Method:"+method.getName());
}
public void afterThrowing(Exception e) throws Throwable {
countThrows++;
System.out.println("***********************************************************************************");
System.out.println("Exception caught:");
System.out.println("***********************************************************************************");
e.printStackTrace();
throw e;
}
System.out.println("***********************************************************************************");
System.out.println("Exception caught:");
System.out.println("***********************************************************************************");
e.printStackTrace();
throw e;
}
public int getCountBefore() {
return countBefore;
......
......@@ -319,17 +319,17 @@ public class Constants {
* @see #toCodeForProperty
*/
public String propertyToConstantNamePrefix(String propertyName) {
StringBuilder parsedPrefix = new StringBuilder();
for(int i = 0; i < propertyName.length(); i++) {
char c = propertyName.charAt(i);
if (Character.isUpperCase(c)) {
parsedPrefix.append("_");
parsedPrefix.append(c);
}
else {
parsedPrefix.append(Character.toUpperCase(c));
}
}
StringBuilder parsedPrefix = new StringBuilder();
for (int i = 0; i < propertyName.length(); i++) {
char c = propertyName.charAt(i);
if (Character.isUpperCase(c)) {
parsedPrefix.append("_");
parsedPrefix.append(c);
}
else {
parsedPrefix.append(Character.toUpperCase(c));
}
}
return parsedPrefix.toString();
}
......
......@@ -94,23 +94,23 @@ public interface GenericConverter {
return this.targetType;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || obj.getClass() != ConvertiblePair.class) {
if (obj == null || obj.getClass() != ConvertiblePair.class) {
return false;
}
ConvertiblePair other = (ConvertiblePair) obj;
return this.sourceType.equals(other.sourceType) && this.targetType.equals(other.targetType);
ConvertiblePair other = (ConvertiblePair) obj;
return this.sourceType.equals(other.sourceType) && this.targetType.equals(other.targetType);
}
}
@Override
public int hashCode() {
return this.sourceType.hashCode() * 31 + this.targetType.hashCode();
}
}
@Override
public int hashCode() {
return this.sourceType.hashCode() * 31 + this.targetType.hashCode();
}
}
}
......@@ -194,7 +194,7 @@ public abstract class AbstractResource implements Resource {
@Override
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof Resource && ((Resource) obj).getDescription().equals(getDescription())));
(obj instanceof Resource && ((Resource) obj).getDescription().equals(getDescription())));
}
/**
......
......@@ -112,7 +112,7 @@ public class ByteArrayResource extends AbstractResource {
@Override
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof ByteArrayResource && Arrays.equals(((ByteArrayResource) obj).byteArray, this.byteArray)));
(obj instanceof ByteArrayResource && Arrays.equals(((ByteArrayResource) obj).byteArray, this.byteArray)));
}
/**
......
......@@ -70,7 +70,7 @@ public class DescriptiveResource extends AbstractResource {
@Override
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof DescriptiveResource && ((DescriptiveResource) obj).description.equals(this.description)));
(obj instanceof DescriptiveResource && ((DescriptiveResource) obj).description.equals(this.description)));
}
/**
......
......@@ -204,7 +204,7 @@ public class FileSystemResource extends AbstractResource implements WritableReso
@Override
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof FileSystemResource && this.path.equals(((FileSystemResource) obj).path)));
(obj instanceof FileSystemResource && this.path.equals(((FileSystemResource) obj).path)));
}
/**
......
......@@ -111,7 +111,7 @@ public class InputStreamResource extends AbstractResource {
@Override
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof InputStreamResource && ((InputStreamResource) obj).inputStream.equals(this.inputStream)));
(obj instanceof InputStreamResource && ((InputStreamResource) obj).inputStream.equals(this.inputStream)));
}
/**
......
......@@ -207,7 +207,7 @@ public class UrlResource extends AbstractFileResolvingResource {
@Override
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof UrlResource && this.cleanedUrl.equals(((UrlResource) obj).cleanedUrl)));
(obj instanceof UrlResource && this.cleanedUrl.equals(((UrlResource) obj).cleanedUrl)));
}
/**
......
......@@ -61,7 +61,7 @@ public abstract class FileCopyUtils {
Assert.notNull(in, "No input File specified");
Assert.notNull(out, "No output File specified");
return copy(new BufferedInputStream(new FileInputStream(in)),
new BufferedOutputStream(new FileOutputStream(out)));
new BufferedOutputStream(new FileOutputStream(out)));
}
/**
......
......@@ -28,78 +28,78 @@ import static org.junit.Assert.*;
*/
public class ExceptionDepthComparatorTests {
@Test
public void targetBeforeSameDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, SameDepthException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void sameDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(SameDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void lowestDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void targetBeforeLowestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, LowestDepthException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void noDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void noDepthBeforeHighestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, HighestDepthException.class);
assertEquals(HighestDepthException.class, foundClass);
}
@Test
public void highestDepthBeforeNoDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, NoDepthException.class);
assertEquals(HighestDepthException.class, foundClass);
}
@Test
public void highestDepthBeforeLowestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, LowestDepthException.class);
assertEquals(LowestDepthException.class, foundClass);
}
@Test
public void lowestDepthBeforeHighestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, HighestDepthException.class);
assertEquals(LowestDepthException.class, foundClass);
}
private Class<? extends Throwable> findClosestMatch(Class<? extends Throwable>... classes) {
return ExceptionDepthComparator.findClosestMatch(Arrays.asList(classes), new TargetException());
}
public class HighestDepthException extends Throwable {
}
public class LowestDepthException extends HighestDepthException {
}
public class TargetException extends LowestDepthException {
}
public class SameDepthException extends LowestDepthException {
}
public class NoDepthException extends TargetException {
}
@Test
public void targetBeforeSameDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, SameDepthException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void sameDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(SameDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void lowestDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void targetBeforeLowestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, LowestDepthException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void noDepthBeforeTarget() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, TargetException.class);
assertEquals(TargetException.class, foundClass);
}
@Test
public void noDepthBeforeHighestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, HighestDepthException.class);
assertEquals(HighestDepthException.class, foundClass);
}
@Test
public void highestDepthBeforeNoDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, NoDepthException.class);
assertEquals(HighestDepthException.class, foundClass);
}
@Test
public void highestDepthBeforeLowestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, LowestDepthException.class);
assertEquals(LowestDepthException.class, foundClass);
}
@Test
public void lowestDepthBeforeHighestDepth() throws Exception {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, HighestDepthException.class);
assertEquals(LowestDepthException.class, foundClass);
}
private Class<? extends Throwable> findClosestMatch(
Class<? extends Throwable>... classes) {
return ExceptionDepthComparator.findClosestMatch(Arrays.asList(classes), new TargetException());
}
public class HighestDepthException extends Throwable {
}
public class LowestDepthException extends HighestDepthException {
}
public class TargetException extends LowestDepthException {
}
public class SameDepthException extends LowestDepthException {
}
public class NoDepthException extends TargetException {
}
}
......@@ -130,26 +130,26 @@ public class GenericTypeResolverTests {
assertEquals(Object.class, resolveReturnTypeForGenericMethod(extractMagicValue, new Object[] { map }));
}
/**
* @since 3.2
*/
@Test
public void testResolveType() {
Method intMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerInputMessage", MyInterfaceType.class);
MethodParameter intMessageMethodParam = new MethodParameter(intMessageMethod, 0);
assertEquals(MyInterfaceType.class,
resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method intArrMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerArrayInputMessage", MyInterfaceType[].class);
MethodParameter intArrMessageMethodParam = new MethodParameter(intArrMessageMethod, 0);
assertEquals(MyInterfaceType[].class,
resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method genericArrMessageMethod = findMethod(MySimpleTypeWithMethods.class, "readGenericArrayInputMessage", Object[].class);
MethodParameter genericArrMessageMethodParam = new MethodParameter(genericArrMessageMethod, 0);
Map<TypeVariable, Type> varMap = getTypeVariableMap(MySimpleTypeWithMethods.class);
assertEquals(Integer[].class, resolveType(genericArrMessageMethodParam.getGenericParameterType(), varMap));
}
/**
* @since 3.2
*/
@Test
public void testResolveType() {
Method intMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerInputMessage", MyInterfaceType.class);
MethodParameter intMessageMethodParam = new MethodParameter(intMessageMethod, 0);
assertEquals(MyInterfaceType.class,
resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method intArrMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerArrayInputMessage", MyInterfaceType[].class);
MethodParameter intArrMessageMethodParam = new MethodParameter(intArrMessageMethod, 0);
assertEquals(MyInterfaceType[].class,
resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method genericArrMessageMethod = findMethod(MySimpleTypeWithMethods.class, "readGenericArrayInputMessage", Object[].class);
MethodParameter genericArrMessageMethodParam = new MethodParameter(genericArrMessageMethod, 0);
Map<TypeVariable, Type> varMap = getTypeVariableMap(MySimpleTypeWithMethods.class);
assertEquals(Integer[].class, resolveType(genericArrMessageMethodParam.getGenericParameterType(), varMap));
}
public interface MyInterfaceType<T> {
......@@ -234,14 +234,14 @@ public class GenericTypeResolverTests {
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> {
......
......@@ -124,7 +124,7 @@ public class ReflectionHelper {
Class paramTypeClazz = paramType.getType();
if (paramTypeClazz.isPrimitive()) {
paramTypeClazz = Object.class;
}
}
Class superClass = argType.getClass().getSuperclass();
while (superClass != null) {
if (paramType.equals(superClass)) {
......
......@@ -192,7 +192,7 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
@Test
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(2,'a').stringscount()", 3, Integer.class);
evaluate("new org.springframework.expression.spel.testresources.Fruit(4).stringscount()", 4, Integer.class);
......
......@@ -435,8 +435,8 @@ public class SpelDocumentationTests extends ExpressionTestCase {
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext context = new StandardEvaluationContext();
context.registerFunction("reverseString",
StringUtils.class.getDeclaredMethod("reverseString", new Class[] { String.class }));
context.registerFunction("reverseString", StringUtils.class.getDeclaredMethod(
"reverseString", new Class[] { String.class }));
String helloWorldReversed = parser.parseExpression("#reverseString('hello world')").getValue(context, String.class);
Assert.assertEquals("dlrow olleh",helloWorldReversed);
......@@ -456,8 +456,8 @@ public class SpelDocumentationTests extends ExpressionTestCase {
parser.parseExpression("Name").setValue(societyContext, "IEEE");
societyContext.setVariable("queryName", "Nikola Tesla");
String expression = "isMember(#queryName)? #queryName + ' is a member of the ' " +
"+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'";
String expression = "isMember(#queryName)? #queryName + ' is a member of the ' "
+ "+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'";
String queryResultString = parser.parseExpression(expression).getValue(societyContext, String.class);
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 {
public String getExpressionPrefix() {
return "${";
}
public String getExpressionPrefix() {
return "${";
}
public String getExpressionSuffix() {
return "}";
}
public String getExpressionSuffix() {
return "}";
}
public boolean isTemplate() {
return true;
}
public boolean isTemplate() {
return true;
}
}
static class StringUtils {
public static String reverseString(String input) {
StringBuilder backwards = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
backwards.append(input.charAt(input.length() - 1 - i));
}
return backwards.toString();
}
public static String reverseString(String input) {
StringBuilder backwards = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
backwards.append(input.charAt(input.length() - 1 - i));
}
return backwards.toString();
}
}
}
......
......@@ -364,7 +364,7 @@ public interface JdbcOperations {
* @see java.sql.Types
*/
<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
......@@ -422,7 +422,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails
*/
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
......@@ -437,7 +437,7 @@ public interface JdbcOperations {
* @see java.sql.Types
*/
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
......@@ -510,7 +510,7 @@ public interface JdbcOperations {
* @see java.sql.Types
*/
<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
......@@ -614,7 +614,7 @@ public interface JdbcOperations {
* @see java.sql.Types
*/
<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
......
......@@ -177,7 +177,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
DataSourceTransactionObject txObject = new DataSourceTransactionObject();
txObject.setSavepointAllowed(isNestedTransactionAllowed());
ConnectionHolder conHolder =
(ConnectionHolder) TransactionSynchronizationManager.getResource(this.dataSource);
(ConnectionHolder) TransactionSynchronizationManager.getResource(this.dataSource);
txObject.setConnectionHolder(conHolder, false);
return txObject;
}
......
......@@ -58,7 +58,7 @@ public abstract class LobCreatorUtils {
if (TransactionSynchronizationManager.isSynchronizationActive()) {
logger.debug("Registering Spring transaction synchronization for LobCreator");
TransactionSynchronizationManager.registerSynchronization(
new SpringLobCreatorSynchronization(lobCreator));
new SpringLobCreatorSynchronization(lobCreator));
}
else {
if (jtaTransactionManager != null) {
......@@ -77,7 +77,7 @@ public abstract class LobCreatorUtils {
}
}
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");
}
}
......
......@@ -414,7 +414,7 @@ public class OracleLobHandler extends AbstractLobHandler {
}
public void setClobAsString(PreparedStatement ps, int paramIndex, final String content)
throws SQLException {
throws SQLException {
if (content != null) {
Clob clob = (Clob) createLob(ps, true, new LobCallback() {
......@@ -437,7 +437,7 @@ public class OracleLobHandler extends AbstractLobHandler {
public void setClobAsAsciiStream(
PreparedStatement ps, int paramIndex, final InputStream asciiStream, int contentLength)
throws SQLException {
throws SQLException {
if (asciiStream != null) {
Clob clob = (Clob) createLob(ps, true, new LobCallback() {
......@@ -460,7 +460,7 @@ public class OracleLobHandler extends AbstractLobHandler {
public void setClobAsCharacterStream(
PreparedStatement ps, int paramIndex, final Reader characterStream, int contentLength)
throws SQLException {
throws SQLException {
if (characterStream != null) {
Clob clob = (Clob) createLob(ps, true, new LobCallback() {
......
......@@ -94,11 +94,11 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
this.wrappedStatementClass = getClass().getClassLoader().loadClass(prefix + "WrappedStatement");
this.wrappedResultSetClass = getClass().getClassLoader().loadClass(prefix + "WrappedResultSet");
this.getUnderlyingConnectionMethod =
this.wrappedConnectionClass.getMethod("getUnderlyingConnection", (Class[]) null);
this.wrappedConnectionClass.getMethod("getUnderlyingConnection", (Class[]) null);
this.getUnderlyingStatementMethod =
this.wrappedStatementClass.getMethod("getUnderlyingStatement", (Class[]) null);
this.wrappedStatementClass.getMethod("getUnderlyingStatement", (Class[]) null);
this.getUnderlyingResultSetMethod =
this.wrappedResultSetClass.getMethod("getUnderlyingResultSet", (Class[]) null);
this.wrappedResultSetClass.getMethod("getUnderlyingResultSet", (Class[]) null);
}
catch (Exception ex) {
throw new IllegalStateException(
......
......@@ -160,7 +160,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked
*/
void convertAndSend(Object message, MessagePostProcessor postProcessor)
throws JmsException;
throws JmsException;
/**
* 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
*/
void convertAndSend(Destination destination, Object message, MessagePostProcessor postProcessor)
throws JmsException;
throws JmsException;
/**
* 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
*/
void convertAndSend(String destinationName, Object message, MessagePostProcessor postProcessor)
throws JmsException;
throws JmsException;
//-------------------------------------------------------------------------
......
......@@ -648,7 +648,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
public void convertAndSend(
String destinationName, final Object message, final MessagePostProcessor postProcessor)
throws JmsException {
throws JmsException {
send(destinationName, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
......
......@@ -366,7 +366,7 @@ public class JmsTemplate102Tests extends TestCase {
template.execute(new ProducerCallback() {
public Object doInJms(Session session, MessageProducer producer)
throws JMSException {
throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
return null;
......@@ -627,7 +627,7 @@ public class JmsTemplate102Tests extends TestCase {
else {
template.send("testQueue", new MessageCreator() {
public Message createMessage(Session session)
throws JMSException {
throws JMSException {
return session.createTextMessage("just testing");
}
});
......@@ -690,7 +690,7 @@ public class JmsTemplate102Tests extends TestCase {
if (explicitTopic) {
template.send(mockTopic, new MessageCreator() {
public Message createMessage(Session session)
throws JMSException {
throws JMSException {
return session.createTextMessage("just testing");
}
});
......@@ -698,7 +698,7 @@ public class JmsTemplate102Tests extends TestCase {
else {
template.send("testTopic", new MessageCreator() {
public Message createMessage(Session session)
throws JMSException {
throws JMSException {
return session.createTextMessage("just testing");
}
});
......
......@@ -660,7 +660,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
@Override
public void flush() {
try {
this.sessionHolder.getSession().flush();
this.sessionHolder.getSession().flush();
}
catch (HibernateException ex) {
throw convertHibernateAccessException(ex);
......
......@@ -888,7 +888,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
public void flush() {
try {
this.sessionHolder.getSession().flush();
this.sessionHolder.getSession().flush();
}
catch (HibernateException ex) {
throw convertHibernateAccessException(ex);
......
......@@ -41,7 +41,7 @@ public class LocalCacheProviderProxy implements CacheProvider {
// absolutely needs thread-bound CacheProvider to initialize
if (cp == null) {
throw new IllegalStateException("No Hibernate CacheProvider found - " +
"'cacheProvider' property must be set on LocalSessionFactoryBean");
"'cacheProvider' property must be set on LocalSessionFactoryBean");
}
this.cacheProvider = cp;
}
......
......@@ -49,7 +49,7 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
// absolutely needs thread-bound DataSource to initialize
if (this.dataSource == null) {
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);
}
......
......@@ -56,7 +56,7 @@ public class LocalRegionFactoryProxy implements RegionFactory {
// absolutely needs thread-bound RegionFactory to initialize
if (rf == null) {
throw new IllegalStateException("No Hibernate RegionFactory found - " +
"'cacheRegionFactory' property must be set on LocalSessionFactoryBean");
"'cacheRegionFactory' property must be set on LocalSessionFactoryBean");
}
this.regionFactory = rf;
}
......
......@@ -53,7 +53,7 @@ public class LocalTransactionManagerLookup implements TransactionManagerLookup {
// absolutely needs thread-bound TransactionManager to initialize
if (tm == null) {
throw new IllegalStateException("No JTA TransactionManager found - " +
"'jtaTransactionManager' property must be set on LocalSessionFactoryBean");
"'jtaTransactionManager' property must be set on LocalSessionFactoryBean");
}
this.transactionManager = tm;
}
......
......@@ -354,7 +354,7 @@ public abstract class SessionFactoryUtils {
if (!allowCreate && !isSessionTransactional(session, sessionFactory)) {
closeSession(session);
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;
......@@ -371,8 +371,8 @@ public abstract class SessionFactoryUtils {
* @throws DataAccessResourceFailureException if the Session couldn't be created
*/
private static Session getJtaSynchronizedSession(
SessionHolder sessionHolder, SessionFactory sessionFactory,
SQLExceptionTranslator jdbcExceptionTranslator) throws DataAccessResourceFailureException {
SessionHolder sessionHolder, SessionFactory sessionFactory,
SQLExceptionTranslator jdbcExceptionTranslator) throws DataAccessResourceFailureException {
// JTA synchronization is only possible with a javax.transaction.TransactionManager.
// 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) {
Assert.notNull(criteria, "No Criteria object specified");
SessionHolder sessionHolder =
(SessionHolder) TransactionSynchronizationManager.getResource(sessionFactory);
(SessionHolder) TransactionSynchronizationManager.getResource(sessionFactory);
if (sessionHolder != null && sessionHolder.hasTimeout()) {
criteria.setTimeout(sessionHolder.getTimeToLiveInSeconds());
}
......
......@@ -76,7 +76,7 @@ public abstract class AbstractLobType implements UserType {
*/
protected AbstractLobType() {
this(LocalSessionFactoryBean.getConfigTimeLobHandler(),
LocalSessionFactoryBean.getConfigTimeTransactionManager());
LocalSessionFactoryBean.getConfigTimeTransactionManager());
}
/**
......@@ -150,7 +150,7 @@ public abstract class AbstractLobType implements UserType {
if (this.lobHandler == null) {
throw new IllegalStateException("No LobHandler found for configuration - " +
"lobHandler property must be set on LocalSessionFactoryBean");
"lobHandler property must be set on LocalSessionFactoryBean");
}
try {
......@@ -172,7 +172,7 @@ public abstract class AbstractLobType implements UserType {
if (this.lobHandler == null) {
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();
......@@ -211,7 +211,7 @@ public abstract class AbstractLobType implements UserType {
* @throws HibernateException in case of any other exceptions
*/
protected abstract void nullSafeSetInternal(
PreparedStatement ps, int index, Object value, LobCreator lobCreator)
PreparedStatement ps, int index, Object value, LobCreator lobCreator)
throws SQLException, IOException, HibernateException;
}
......@@ -138,7 +138,7 @@ public abstract class HibernateDaoSupport extends DaoSupport {
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession(SessionFactory, boolean)
*/
protected final Session getSession()
throws DataAccessResourceFailureException, IllegalStateException {
throws DataAccessResourceFailureException, IllegalStateException {
return getSession(this.hibernateTemplate.isAllowCreate());
}
......@@ -163,10 +163,10 @@ public abstract class HibernateDaoSupport extends DaoSupport {
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession(SessionFactory, boolean)
*/
protected final Session getSession(boolean allowCreate)
throws DataAccessResourceFailureException, IllegalStateException {
throws DataAccessResourceFailureException, IllegalStateException {
return (!allowCreate ?
SessionFactoryUtils.getSession(getSessionFactory(), false) :
SessionFactoryUtils.getSession(getSessionFactory(), false) :
SessionFactoryUtils.getSession(
getSessionFactory(),
this.hibernateTemplate.getEntityInterceptor(),
......
......@@ -156,7 +156,7 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
}
if ((isSingleSession() && TransactionSynchronizationManager.hasResource(getSessionFactory())) ||
SessionFactoryUtils.isDeferredCloseActive(getSessionFactory())) {
SessionFactoryUtils.isDeferredCloseActive(getSessionFactory())) {
// Do not modify the Session: just mark the request accordingly.
Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
int newCount = (count != null ? count + 1 : 1);
......
......@@ -79,7 +79,7 @@ public abstract class AbstractLobTypeHandler extends BaseTypeHandler {
protected AbstractLobTypeHandler(LobHandler lobHandler) {
if (lobHandler == null) {
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;
}
......
......@@ -201,9 +201,9 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
Assert.notNull(action, "Callback object must not be null");
PersistenceManager pm = PersistenceManagerFactoryUtils.getPersistenceManager(
getPersistenceManagerFactory(), isAllowCreate());
getPersistenceManagerFactory(), isAllowCreate());
boolean existingTransaction =
TransactionSynchronizationManager.hasResource(getPersistenceManagerFactory());
TransactionSynchronizationManager.hasResource(getPersistenceManagerFactory());
try {
PersistenceManager pmToExpose = (exposeNativePersistenceManager ? pm : createPersistenceManagerProxy(pm));
T result = action.doInJdo(pmToExpose);
......
......@@ -281,7 +281,7 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
public Class<? extends PersistenceManagerFactory> getObjectType() {
return (this.persistenceManagerFactory != null ?
this.persistenceManagerFactory.getClass() : PersistenceManagerFactory.class);
this.persistenceManagerFactory.getClass() : PersistenceManagerFactory.class);
}
public boolean isSingleton() {
......
......@@ -106,7 +106,7 @@ public abstract class PersistenceManagerFactoryUtils {
* @see JdoTransactionManager
*/
public static PersistenceManager getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate)
throws DataAccessResourceFailureException, IllegalStateException {
throws DataAccessResourceFailureException, IllegalStateException {
try {
return doGetPersistenceManager(pmf, allowCreate);
......@@ -133,7 +133,7 @@ public abstract class PersistenceManagerFactoryUtils {
* @see JdoTransactionManager
*/
public static PersistenceManager doGetPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate)
throws JDOException, IllegalStateException {
throws JDOException, IllegalStateException {
Assert.notNull(pmf, "No PersistenceManagerFactory specified");
......@@ -204,7 +204,7 @@ public abstract class PersistenceManagerFactoryUtils {
Assert.notNull(query, "No Query object specified");
PersistenceManagerHolder pmHolder =
(PersistenceManagerHolder) TransactionSynchronizationManager.getResource(pmf);
(PersistenceManagerHolder) TransactionSynchronizationManager.getResource(pmf);
if (pmHolder != null && pmHolder.hasTimeout()) {
jdoDialect.applyQueryTimeout(query, pmHolder.getTimeToLiveInSeconds());
}
......
......@@ -144,7 +144,7 @@ public abstract class JdoDaoSupport extends DaoSupport {
* @see org.springframework.orm.jdo.PersistenceManagerFactoryUtils#getPersistenceManager
*/
protected final PersistenceManager getPersistenceManager(boolean allowCreate)
throws DataAccessResourceFailureException, IllegalStateException {
throws DataAccessResourceFailureException, IllegalStateException {
return PersistenceManagerFactoryUtils.getPersistenceManager(getPersistenceManagerFactory(), allowCreate);
}
......
......@@ -659,7 +659,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
public void flush() {
try {
this.entityManagerHolder.getEntityManager().flush();
this.entityManagerHolder.getEntityManager().flush();
}
catch (RuntimeException ex) {
throw DataAccessUtils.translateIfNecessary(ex, getJpaDialect());
......
......@@ -436,7 +436,7 @@ public class OpenSessionInViewTests {
final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(sf2));
filter.doFilter(servletRequest, servletResponse, filterChain);
}
......@@ -665,7 +665,7 @@ public class OpenSessionInViewTests {
final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
throws IOException, ServletException {
HibernateTransactionManager tm = new HibernateTransactionManager(sf2);
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
......@@ -767,7 +767,7 @@ public class OpenSessionInViewTests {
FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
throws IOException, ServletException {
filter.doFilter(servletRequest, servletResponse, filterChain);
}
};
......
......@@ -154,7 +154,7 @@ public class OpenPersistenceManagerInViewTests extends TestCase {
final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(pmf2));
filter.doFilter(servletRequest, servletResponse, filterChain);
}
......
......@@ -265,7 +265,7 @@ public class OpenEntityManagerInViewTests extends TestCase {
final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(factory2));
filter.doFilter(servletRequest, servletResponse, filterChain);
}
......@@ -334,7 +334,7 @@ public class OpenEntityManagerInViewTests extends TestCase {
final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(factory2));
filter.doFilter(servletRequest, servletResponse, filterChain);
count2.incrementAndGet();
......
......@@ -30,9 +30,9 @@ public abstract class XmlMappingException extends NestedRuntimeException {
* Construct an <code>XmlMappingException</code> with the specified detail message.
* @param msg the detail message
*/
public XmlMappingException(String msg) {
super(msg);
}
public XmlMappingException(String msg) {
super(msg);
}
/**
* 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 cause the nested exception
*/
public XmlMappingException(String msg, Throwable cause) {
super(msg, cause);
}
public XmlMappingException(String msg, Throwable cause) {
super(msg, cause);
}
}
......@@ -425,12 +425,12 @@ public class XStreamMarshaller extends AbstractMarshaller implements Initializin
@Override
protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException {
if (this.streamDriver != null) {
marshal(graph, this.streamDriver.createWriter(outputStream));
}
else {
marshalWriter(graph, new OutputStreamWriter(outputStream, this.encoding));
}
if (this.streamDriver != null) {
marshal(graph, this.streamDriver.createWriter(outputStream));
}
else {
marshalWriter(graph, new OutputStreamWriter(outputStream, this.encoding));
}
}
@Override
......
......@@ -24,34 +24,34 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(namespace = "http://springframework.org/spring-ws")
public class BinaryObject {
@XmlElement(namespace = "http://springframework.org/spring-ws")
private byte[] bytes;
@XmlElement(namespace = "http://springframework.org/spring-ws")
private byte[] bytes;
@XmlElement(namespace = "http://springframework.org/spring-ws")
private DataHandler dataHandler;
@XmlElement(namespace = "http://springframework.org/spring-ws")
private DataHandler dataHandler;
@XmlElement(namespace = "http://springframework.org/spring-ws")
@XmlAttachmentRef
private DataHandler swaDataHandler;
@XmlElement(namespace = "http://springframework.org/spring-ws")
@XmlAttachmentRef
private DataHandler swaDataHandler;
public BinaryObject() {
}
public BinaryObject() {
}
public BinaryObject(byte[] bytes, DataHandler dataHandler) {
this.bytes = bytes;
this.dataHandler = dataHandler;
swaDataHandler = dataHandler;
}
public BinaryObject(byte[] bytes, DataHandler dataHandler) {
this.bytes = bytes;
this.dataHandler = dataHandler;
swaDataHandler = dataHandler;
}
public byte[] getBytes() {
return bytes;
}
public byte[] getBytes() {
return bytes;
}
public DataHandler getDataHandler() {
return dataHandler;
}
public DataHandler getDataHandler() {
return dataHandler;
}
public DataHandler getSwaDataHandler() {
return swaDataHandler;
}
public DataHandler getSwaDataHandler() {
return swaDataHandler;
}
}
......@@ -20,17 +20,17 @@ import java.util.ArrayList;
public class Flights {
protected ArrayList flightList = new ArrayList();
protected ArrayList flightList = new ArrayList();
public void addFlight(FlightType flight) {
flightList.add(flight);
}
public void addFlight(FlightType flight) {
flightList.add(flight);
}
public FlightType getFlight(int index) {
return (FlightType) flightList.get(index);
}
public FlightType getFlight(int index) {
return (FlightType) flightList.get(index);
}
public int sizeFlightList() {
return flightList.size();
}
public int sizeFlightList() {
return flightList.size();
}
}
......@@ -27,15 +27,15 @@ import org.junit.Test;
*/
public class XmlOptionsFactoryBeanTests {
private XmlOptionsFactoryBean factoryBean = new XmlOptionsFactoryBean();
private XmlOptionsFactoryBean factoryBean = new XmlOptionsFactoryBean();
@Test
@Test
public void xmlOptionsFactoryBean() throws Exception {
factoryBean.setOptions(Collections.singletonMap(XmlOptions.SAVE_PRETTY_PRINT, Boolean.TRUE));
XmlOptions xmlOptions = factoryBean.getObject();
assertNotNull("No XmlOptions returned", xmlOptions);
assertTrue("Option not set", xmlOptions.hasOption(XmlOptions.SAVE_PRETTY_PRINT));
assertFalse("Invalid option set", xmlOptions.hasOption(XmlOptions.LOAD_LINE_NUMBERS));
}
factoryBean.setOptions(Collections.singletonMap(XmlOptions.SAVE_PRETTY_PRINT, Boolean.TRUE));
XmlOptions xmlOptions = factoryBean.getObject();
assertNotNull("No XmlOptions returned", xmlOptions);
assertTrue("Option not set", xmlOptions.hasOption(XmlOptions.SAVE_PRETTY_PRINT));
assertFalse("Invalid option set", xmlOptions.hasOption(XmlOptions.LOAD_LINE_NUMBERS));
}
}
......@@ -21,14 +21,14 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("flight")
public class Flight {
@XStreamAlias("number")
private long flightNumber;
@XStreamAlias("number")
private long flightNumber;
public long getFlightNumber() {
return flightNumber;
}
public long getFlightNumber() {
return flightNumber;
}
public void setFlightNumber(long number) {
this.flightNumber = number;
}
}
\ No newline at end of file
public void setFlightNumber(long number) {
this.flightNumber = number;
}
}
......@@ -69,7 +69,7 @@ public abstract class ComponentControllerSupport extends ControllerSupport {
public final void perform(
ComponentContext componentContext, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext)
throws ServletException, IOException {
throws ServletException, IOException {
try {
execute(componentContext, request, response, servletContext);
......@@ -97,7 +97,7 @@ public abstract class ComponentControllerSupport extends ControllerSupport {
public final void execute(
ComponentContext componentContext, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext)
throws Exception {
throws Exception {
synchronized (this) {
if (this.webApplicationContext == null) {
......
......@@ -138,7 +138,7 @@ public class TilesView extends InternalResourceView {
* @return the component definition
*/
protected ComponentDefinition getComponentDefinition(DefinitionsFactory factory, HttpServletRequest request)
throws Exception {
throws Exception {
return factory.getDefinition(getUrl(), request, getServletContext());
}
......
......@@ -340,7 +340,7 @@ public class ContextLoaderPlugIn implements PlugIn {
wac.setNamespace(getNamespace());
if (getContextConfigLocation() != null) {
wac.setConfigLocations(
StringUtils.tokenizeToStringArray(
StringUtils.tokenizeToStringArray(
getContextConfigLocation(), ConfigurableWebApplicationContext.CONFIG_LOCATION_DELIMITERS));
}
wac.addBeanFactoryPostProcessor(
......
......@@ -37,7 +37,7 @@ public abstract class MatcherAssertionErrors {
private MatcherAssertionErrors() {
}
}
/**
* Asserts that the given matcher matches the actual value.
......@@ -65,8 +65,8 @@ public abstract class MatcherAssertionErrors {
description.appendText("\nExpected: ");
description.appendDescriptionOf(matcher);
if (describeMismatchMethod != null) {
description.appendText("\n but: ");
matcher.describeMismatch(actual, description);
description.appendText("\n but: ");
matcher.describeMismatch(actual, description);
}
else {
description.appendText("\n got: ");
......
......@@ -22,6 +22,6 @@ public interface RequestBuilder {
* @param servletContext the {@link ServletContext} to use to create the request
* @return the request
*/
MockHttpServletRequest buildRequest(ServletContext servletContext);
MockHttpServletRequest buildRequest(ServletContext servletContext);
}
......@@ -62,7 +62,7 @@ final class PatternMappingFilterProxy implements Filter {
Assert.notNull(delegate, "A delegate Filter is required");
this.delegate = delegate;
for(String urlPattern : urlPatterns) {
addUrlPattern(urlPattern);
addUrlPattern(urlPattern);
}
}
......@@ -127,4 +127,4 @@ final class PatternMappingFilterProxy implements Filter {
this.delegate.destroy();
}
}
\ No newline at end of file
}
......@@ -228,9 +228,9 @@ public class MockHttpServletRequestBuilderTests {
assertEquals("bar=baz", request.getParameter("foo"));
}
@Test
public void acceptHeader() throws Exception {
this.builder.accept(MediaType.TEXT_HTML, MediaType.APPLICATION_XML);
@Test
public void acceptHeader() throws Exception {
this.builder.accept(MediaType.TEXT_HTML, MediaType.APPLICATION_XML);
MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);
List<String> accept = Collections.list(request.getHeaders("Accept"));
......
......@@ -40,7 +40,7 @@ public class ExceptionHandlerTests {
standaloneSetup(new PersonController()).build()
.perform(get("/person/Clyde"))
.andExpect(status().isOk())
.andExpect(forwardedUrl("errorView"));
.andExpect(forwardedUrl("errorView"));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册