bugfixes mainly...
[mir.git] / source / mircoders / storage / DatabaseLanguage.java
index 221ffff..4b5fa84 100755 (executable)
@@ -16,9 +16,9 @@ import java.util.*;
 
 import freemarker.template.*;
 
-import webdb.storage.*;
-import webdb.entity.*;
-import webdb.misc.*;
+import mir.storage.*;
+import mir.entity.*;
+import mir.misc.*;
 
 
 public class DatabaseLanguage extends Database implements StorageObject{
@@ -26,7 +26,11 @@ public class DatabaseLanguage extends Database implements StorageObject{
        private static DatabaseLanguage instance;
        private static SimpleList languagePopupData;
 
-       public static DatabaseLanguage getInstance() throws StorageObjectException
+       // the following *has* to be sychronized cause this static method
+       // could get preemted and we could end up with 2 instances of DatabaseFoo..
+       // see the "Singletons with needles and thread" article at JavaWorld -mh
+       public synchronized static DatabaseLanguage getInstance() 
+         throws StorageObjectException
        {
                if (instance == null) {
                        instance = new DatabaseLanguage();
@@ -40,11 +44,15 @@ public class DatabaseLanguage extends Database implements StorageObject{
                super();
                this.hasTimestamp = false;
                this.theTable="language";
-               try { this.theEntityClass = Class.forName("mir.entity.EntityLanguage"); }
-               catch (Exception e) { throw new StorageObjectException(e.toString());   }
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",false); }
+       public SimpleList getPopupData() throws StorageObjectException { 
+      SimpleList pData = null;
+      try {
+      pData = getPopupData("name",false);
+      } catch (StorageObjectException e) {System.err.println("FF");}
+      return pData;
+    }
 
 
 }