Permalink
Browse files

https://issues.jboss.org/browse/JBIDE-9175

Fix IndexOutOfBoundsExeption when empty DB is used for code gereration

Signed-off-by: Dmitry Geraskov <dgeraskov@exadel.com>
  • Loading branch information...
1 parent 8ec346c commit 9ecb3e8508b1a67f945ff0fca8dbe1efed8811bf Dmitry Geraskov committed with koentsje Aug 31, 2011
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/java/org/hibernate/tool/hbm2x/DocExporter.java
@@ -391,8 +391,10 @@ public void generatePackageSummary(boolean graphsGenerated){
parameters.put("docFile", docFile);
List list = docHelper.getPackages();
- //Remove All Classes
- list.remove(0);
+ if (list.size() > 0){
+ //Remove All Classes
+ list.remove(0);
+ }
parameters.put("packageList", list );
parameters.put( "graphsGenerated", Boolean.valueOf( graphsGenerated ) );
if(graphsGenerated) {
@@ -458,8 +460,10 @@ public void generateEntitiesAllPackagesList() {
Map parameters = new HashMap();
parameters.put("docFile", docFile);
List list = docHelper.getPackages();
- //Remove All Classes
- list.remove(0);
+ if (list.size() > 0){
+ //Remove All Classes
+ list.remove(0);
+ }
parameters.put("packageList", list );
processTemplate(parameters, FTL_ENTITIES_PACKAGE_LIST, file);
@@ -512,7 +516,10 @@ public void generateEntitiesPackageEntityList() {
*/
public void generateEntitiesPackageDetailedInfo() {
List packageList = docHelper.getPackages();
- packageList.remove(0);
+ if (packageList.size() > 0){
+ //Remove All Classes
+ packageList.remove(0);
+ }
Iterator packages = packageList.iterator();
while (packages.hasNext() ) {

0 comments on commit 9ecb3e8

Please sign in to comment.