#1264 NullPointerException on shutdownWithCatalog

current-release
closed-fixed
Fred Toussi
1
2012-11-01
2012-10-30
Michael Lindig
No

Exception in thread "main" java.lang.NullPointerException
at org.hsqldb.DatabaseManager.shutdownDatabases(Unknown Source)
at org.hsqldb.server.Server.shutdownWithCatalogs(Unknown Source)

I looked into org.hsqldb.DatabaseManager.shutdownDatabases(Unknown Source) and I think following is the problem:

public static void shutdownDatabases(Server server, int shutdownMode) {
HashSet databases = (HashSet) serverMap.get(server); //can be null
Database[] dbArray = new Database[databases.size()]; //if databases is null then we got an NullPointerException
// should be:
Database[] dbArray = new Database[databases == null ? 0 : databases.size()];

databases.toArray(dbArray);
//...
}

Discussion

  • Fred Toussi
    Fred Toussi
    2012-10-30

    • assigned_to: nobody --> fredt
    • status: open --> open-accepted
     
  • Fred Toussi
    Fred Toussi
    2012-10-30

    Thanks for reporting and suggesting a fix. Will include in the next snapshot jar.

     
  • Fred Toussi
    Fred Toussi
    2012-11-01

    • priority: 5 --> 1
    • status: open-accepted --> closed-fixed