[hibernate-issues] [Hibernate-JIRA] Created: (HBX-1141) IndexOutOfBoundsException in DocExporter.generatePackageSummary when there is no package
Julien Kronegg (JIRA)
noreply at atlassian.com
Tue Sep 1 07:49:15 EDT 2009
IndexOutOfBoundsException in DocExporter.generatePackageSummary when there is no package
----------------------------------------------------------------------------------------
Key: HBX-1141
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1141
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2doc
Affects Versions: 3.2.4 Beta1
Environment: http://anonsvn.jboss.org/repos/hibernate/branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java
Reporter: Julien Kronegg
Attachments: patch.txt
When generating the documentation with the Ant task <hbm2doc>, the org.hibernate.tool.hbm2x.DocExporter.generatePackageSummary() method raises a java.lang.IndexOutOfBoundsException if there is no package. This can occur if the reveng.xml parameters results in having no entity. For example:
<table-filter match-name="dummy_table_name_not_existing_in_db" package="foo.bar"/>
The stack trace is:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.remove(ArrayList.java:538)
at org.hibernate.tool.hbm2x.DocExporter.generatePackageSummary(DocExporter.java:386)
...
This is the corresponding code snippet:
384 List list = docHelper.getPackages();
385 //Remove All Classes
386 list.remove(0);
...
451 List list = docHelper.getPackages();
452 //Remove All Classes
453 list.remove(0);
...
505 List packageList = docHelper.getPackages();
506 packageList.remove(0);
This code makes the assumption that at least one package is present, which is not the case. Lines 386, 453 and 506 should be replaced by:
if (list.size()>0) list.remove(0); // for line 506, packageList instead of list
The patch implements these changes.
--
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