Skip to content

Commit 288408e

Browse files
committed
fixed assertion message
1 parent 53a244d commit 288408e

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

org.springframework.transaction/src/main/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessor.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,25 +35,28 @@
3535
import org.springframework.util.ClassUtils;
3636

3737
/**
38-
* Bean post-processor that automatically applies persistence exception
39-
* translation to any bean that carries the
40-
* {@link org.springframework.stereotype.Repository} annotation,
41-
* adding a corresponding {@link PersistenceExceptionTranslationAdvisor}
42-
* to the exposed proxy (either an existing AOP proxy or a newly generated
43-
* proxy that implements all of the target's interfaces).
38+
* Bean post-processor that automatically applies persistence exception translation to any
39+
* bean marked with Spring's @{@link org.springframework.stereotype.Repository Repository}
40+
* annotation, adding a corresponding {@link PersistenceExceptionTranslationAdvisor} to
41+
* the exposed proxy (either an existing AOP proxy or a newly generated proxy that
42+
* implements all of the target's interfaces).
4443
*
4544
* <p>Translates native resource exceptions to Spring's
46-
* {@link org.springframework.dao.DataAccessException} hierarchy.
45+
* {@link org.springframework.dao.DataAccessException DataAccessException} hierarchy.
4746
* Autodetects beans that implement the
48-
* {@link org.springframework.dao.support.PersistenceExceptionTranslator}
49-
* interface, which are subsequently asked to translate candidate exceptions.
47+
* {@link org.springframework.dao.support.PersistenceExceptionTranslator
48+
* PersistenceExceptionTranslator} interface, which are subsequently asked to translate
49+
* candidate exceptions.
5050
*
51-
* <p>All of Spring's applicable resource factories implement the
52-
* <code>PersistenceExceptionTranslator</code> interface out of the box.
53-
* As a consequence, all that is usually needed to enable automatic exception
54-
* translation is marking all affected beans (such as DAOs) with the
55-
* <code>Repository</code> annotation, along with defining this post-processor
56-
* as bean in the application context.
51+
52+
* <p>All of Spring's applicable resource factories (e.g. {@link
53+
* org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean},
54+
* {@link org.springframework.orm.jpa.LocalEntityManagerFactoryBean
55+
* LocalEntityManagerFactoryBean}) implement the {@code PersistenceExceptionTranslator}
56+
* interface out of the box. As a consequence, all that is usually needed to enable
57+
* automatic exception translation is marking all affected beans (such as Repositories or
58+
* DAOs) with the {@code @Repository} annotation, along with defining this post-processor
59+
* as a bean in the application context.
5760
*
5861
* @author Rod Johnson
5962
* @author Juergen Hoeller
@@ -82,7 +85,7 @@ public class PersistenceExceptionTranslationPostProcessor extends ProxyConfig
8285
* @param repositoryAnnotationType the desired annotation type
8386
*/
8487
public void setRepositoryAnnotationType(Class<? extends Annotation> repositoryAnnotationType) {
85-
Assert.notNull(repositoryAnnotationType, "'requiredAnnotationType' must not be null");
88+
Assert.notNull(repositoryAnnotationType, "'repositoryAnnotationType' must not be null");
8689
this.repositoryAnnotationType = repositoryAnnotationType;
8790
}
8891

@@ -115,7 +118,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {
115118
// Ignore AOP infrastructure such as scoped proxies.
116119
return bean;
117120
}
118-
Class targetClass = AopUtils.getTargetClass(bean);
121+
Class<?> targetClass = AopUtils.getTargetClass(bean);
119122
if (AopUtils.canApply(this.persistenceExceptionTranslationAdvisor, targetClass)) {
120123
if (bean instanceof Advised) {
121124
((Advised) bean).addAdvisor(this.persistenceExceptionTranslationAdvisor);

0 commit comments

Comments
 (0)