]
Emmanuel Bernard resolved ANN-608.
----------------------------------
Resolution: Fixed
Fix Version/s: 3.3.1
Fixed, thanks.
NullPointerException from AnnotationConfiguration with specific order
of calling addResource and addPackage when package-info.java present
------------------------------------------------------------------------------------------------------------------------------------------
Key: ANN-608
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-608
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Hibernate 3.2.3
Reporter: Steve Gilbert
Fix For: 3.3.1
Attachments: Main.java, orm.xml, package-info.java
There is a bug in AnnotationConfiguration that causes a NullPointerException.
I have attached several files: orm.xml, Main.java, package-info.java.
The problem is caused by the order of the addResource and addPackage calls in combination
with having a package-info.java file with some contents. If the addPackage is called
before the addResource, or if the GenericGenerator annotation in the package info file is
removed, there is no problem.
I cannot change the order of those calls for my production code, however, because Spring
is being used to create the SessionFactory and it calls the methods in that order:
resource followed by package.
There appears to be a problem with initializing
org.hibernate.cfg.annotations.reflection.EJB3OverridenAnnotationReader. When this call is
made on line 360:
annotationsMap.put( ann.annotationType(), ann );
the map is null. Inserting a creation for the map, (borrowed from elsewhere in the
method) on line 359, before the "for" statement:
annotationsMap = new HashMap<Class, Annotation>( annotations.length + 5 );
resolves the problem.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: