OSDN Git Service

Corrected problem where a null pointer exception would happen if the database did...
authorRandy Baumgarte <randy@fbn.cx>
Mon, 26 Jul 2010 15:45:56 +0000 (11:45 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Mon, 26 Jul 2010 15:45:56 +0000 (11:45 -0400)
src/cx/fbn/nevernote/sql/DatabaseConnection.java

index c046b2a..2c32abd 100644 (file)
@@ -83,16 +83,11 @@ public class DatabaseConnection {
                
                QJdbc.initialize();
                
+               setupTables();
+               
                File f = Global.getFileManager().getDbDirFile(Global.databaseName + ".h2.db");
                boolean dbExists = f.exists(); 
                
-               // If it doesn't exist and we are the main thread, then we need to create stuff.
-               if (!dbExists)  {
-                       createTables();
-                       Global.setAutomaticLogin(false);
-               }
-               setupTables();
-               
                logger.log(logger.HIGH, "Entering RDatabaseConnection.dbSetup");
                
 
@@ -109,9 +104,11 @@ public class DatabaseConnection {
                        return;
                }
                
-               logger.log(logger.HIGH, "Leaving RDatabaseConnection.dbSetup");
-               
-               
+               // If it doesn't exist and we are the main thread, then we need to create stuff.
+               if (!dbExists)  {
+                       createTables();
+                       Global.setAutomaticLogin(false);
+               }               
                
                logger.log(logger.HIGH, "Leaving DatabaseConnection.dbSetup" +id);
        }