bugfixes mainly...
[mir.git] / source / mircoders / storage / DatabaseComment.java
index 7787a58..5420449 100755 (executable)
@@ -7,9 +7,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.*;
 
 /**
  * <b>This class implements the access to the comment-table for the
@@ -22,7 +22,11 @@ public class DatabaseComment extends Database implements StorageObject{
 
        private static DatabaseComment instance;
 
-       public static DatabaseComment 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 DatabaseComment getInstance() 
+         throws StorageObjectException {
                if (instance == null) {
                        instance = new DatabaseComment();
                        instance.myselfDatabase = instance;
@@ -34,15 +38,16 @@ public class DatabaseComment extends Database implements StorageObject{
        {
                super();
                this.hasTimestamp = false;
-               this.cache = new HashMap();
+               ////this.cache = new HashMap();
                this.theTable="comment";
                try {
-                       this.theEntityClass = Class.forName("mir.entity.EntityComment");
+                       this.theEntityClass = Class.forName("mircoders.entity.EntityComment");
                }
                catch (Exception e) { throw new StorageObjectException(e.toString());   }
        }
 
-       public SimpleList getPopupData() { return getPopupData("title",true); }
+       public SimpleList getPopupData()
+        throws StorageObjectException { return getPopupData("title",true); }
 
        public boolean deleteByContentId(String id)
                throws StorageObjectException {