[hibernate-issues] [Hibernate-JIRA] Created: (ANN-834) Misplaced try-catch in org.hibernate.cfg.AnnotationConfiguration

Ed Gow (JIRA) noreply at atlassian.com
Fri May 15 20:47:13 EDT 2009


Misplaced try-catch in org.hibernate.cfg.AnnotationConfiguration
----------------------------------------------------------------

                 Key: ANN-834
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-834
             Project: Hibernate Annotations
          Issue Type: Bug
          Components: binder
    Affects Versions: 3.4.0.GA
            Reporter: Ed Gow




	/**
	 * Read a mapping from the class annotation metadata (JSR 175).
	 *
	 * @param persistentClass the mapped class
	 * @return the configuration object
	 */
The code is reproduced below.

A MappingException can be thrown from the toXClass() call, but never from the annotatedClasses.add() call as that is only a simple ArrayList.  I believe that I'm experiencing a problem of lost exceptions due to this bug. I don't have a test case to reproduce it, but the bug is obvious from static analysis of the code even w/o a test case. 

>From org.hibernate.cfg.AnnotationConfiguration:

	public AnnotationConfiguration addAnnotatedClass(Class persistentClass) throws MappingException {
		XClass persistentXClass = reflectionManager.toXClass( persistentClass );
		try {
			annotatedClasses.add( persistentXClass );
			return this;
		}
		catch (MappingException me) {
			log.error( "Could not compile the mapping annotations", me );
			throw me;
		}
	}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list