proper handling of exceptions all around. especially for the media stuff.
authormh <mh>
Thu, 31 Jan 2002 12:06:00 +0000 (12:06 +0000)
committermh <mh>
Thu, 31 Jan 2002 12:06:00 +0000 (12:06 +0000)
there's still a little more left to do..

52 files changed:
doc/TODO.txt
source/mir/media/MediaHandlerGeneric.java
source/mir/media/MediaHandlerImages.java
source/mir/media/MediaHandlerImagesGif.java
source/mir/media/MediaHandlerImagesJpeg.java
source/mir/media/MediaHandlerMp3.java
source/mir/media/MediaHandlerRealAudio.java
source/mir/media/MediaHandlerRealVideo.java
source/mir/media/MirMedia.java
source/mir/misc/FileUtil.java
source/mir/misc/MirConfig.java
source/mir/storage/Database.java
source/mir/storage/StorageObject.java
source/mircoders/entity/EntityContent.java
source/mircoders/entity/EntityImages.java
source/mircoders/entity/EntityMedia.java
source/mircoders/entity/EntityVideo.java
source/mircoders/module/ModuleComment.java
source/mircoders/module/ModuleFeature.java
source/mircoders/module/ModuleImages.java
source/mircoders/module/ModuleMediafolder.java
source/mircoders/module/ModuleSchwerpunkt.java
source/mircoders/module/ModuleTopics.java
source/mircoders/module/ModuleUploadedMedia.java
source/mircoders/module/ModuleUsers.java
source/mircoders/producer/Producer.java
source/mircoders/producer/ProducerContent.java
source/mircoders/producer/ProducerList.java
source/mircoders/producer/ProducerStartPage.java
source/mircoders/producer/ProducerTopics.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleImages.java
source/mircoders/servlet/ServletModuleOpenIndy.java
source/mircoders/storage/DatabaseArticleType.java
source/mircoders/storage/DatabaseComment.java
source/mircoders/storage/DatabaseContent.java
source/mircoders/storage/DatabaseContentToMedia.java
source/mircoders/storage/DatabaseContentToTopics.java
source/mircoders/storage/DatabaseFeature.java
source/mircoders/storage/DatabaseImageColor.java
source/mircoders/storage/DatabaseImageFormat.java
source/mircoders/storage/DatabaseImageLayout.java
source/mircoders/storage/DatabaseImageType.java
source/mircoders/storage/DatabaseImages.java
source/mircoders/storage/DatabaseLanguage.java
source/mircoders/storage/DatabaseLinksImcs.java
source/mircoders/storage/DatabaseMedia.java
source/mircoders/storage/DatabaseMediafolder.java
source/mircoders/storage/DatabaseRights.java
source/mircoders/storage/DatabaseTopics.java
source/mircoders/storage/DatabaseUsers.java
source/mircoders/storage/DatabaseVideos.java

index 8bd1fac..c2ebf73 100755 (executable)
@@ -1,4 +1,4 @@
-[Updated 26.10.2001. -mh]
+[Updated 29.01.2002. -mh]
 
 Version 1.0: 
 
@@ -11,16 +11,16 @@ templates) and "external"-templates (producer-templates)
 b) code-cleaning 
 - the variable-names for the freemarker should be better: the same name for the same thing
 c) We have to make sure that all errors are handled intelligently. e.g. if an 
-article is corrupt, do we just ignore it, etc..
+article is corrupt, do we just ignore it, etc.. (almost there, mh)
 d) Admin interface needs to be made aware of media handlers (mj)
-e) insposting() in ServletModuleOpenIndy should not insert article text if any associated media upload is wrong. (mh)
+e) insposting() in ServletModuleOpenIndy should not insert article text if any associated media upload is wrong. (done, mh)
 
 c) documentation 
 - it lacks a documentation for creating the producer-templates
-d) new layout Mir/OpenMir (gilad) 
-e) translating the templates/code-comments to english 
+d) new layout Mir/OpenMir (gilad, indy de team??
+e) translating the templates/code-comments to english (underway, mir-coders)
 f) mission-statement and licensing 
-g) there are no memory-leaks 
+g) there are no memory-leaks (done, confirmed by indy NL)
 
 
 New Features: 
index c06141e..a466a98 100755 (executable)
@@ -38,7 +38,9 @@ public class MediaHandlerGeneric implements MirMedia
     protected String imageHost = MirConfig.getProp("Producer.Image.Host");
     protected String imageRoot = MirConfig.getProp("Producer.ImageRoot");
     protected Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home")+"log/media.log");
-    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+        throws MirMediaException {
+
         String ext = mediaTypeEnt.getValue("name");
         String dir = MirConfig.getProp("Producer.Media.Path");
         String mediaHost = MirConfig.getProp("Producer.Media.Host");
@@ -46,40 +48,42 @@ public class MediaHandlerGeneric implements MirMedia
         String date = ent.getValue("date");
         String datePath = StringUtil.webdbDate2path(date);
         Integer size = new Integer(uploadedData.length);
-        if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
-        //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) {
+        try {
+            FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+            //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) {
             //were done with the data, dereference.
             uploadedData=null;
             
-            try {
-                ent.setValueForProperty("is_produced", "1");
-                ent.setValueForProperty("icon_is_produced", "1");
-                ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
-                //ent.setValueForProperty("publish_path", mediaFname);
-                ent.setValueForProperty("publish_server", mediaHost);
-                ent.setValueForProperty("size", size.toString());
-                ent.update();
-            } catch (StorageObjectException e) {
-                theLog.printError("StorageObjectException: "+e.toString()); 
-                return false;
-            }
-        } else {
-            theLog.printError("could not write FILE!"); 
-            return false;
+            ent.setValueForProperty("is_produced", "1");
+            ent.setValueForProperty("icon_is_produced", "1");
+            ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
+            //ent.setValueForProperty("publish_path", mediaFname);
+            ent.setValueForProperty("publish_server", mediaHost);
+            ent.setValueForProperty("size", size.toString());
+            ent.update();
+        } catch (Exception e) {
+            theLog.printError(e.toString()); 
+            throw new MirMediaException(e.toString());
         }
 
         return true;
     }
 
     //a class that will probably never get used..
-    private byte[] getFile (String fileName) {
+    private byte[] getFile (String fileName)
+        throws MirMediaException {
+
         long size = FileUtil.getSize(fileName);
         if (size < 0) return null;
 
         byte[] container = new byte[(int)size];
             
-        if(!FileUtil.read(fileName, container))
-            return null;
+        try {
+            FileUtil.read(fileName, container);
+        } catch (Exception e) {
+            theLog.printError(e.toString()); 
+            throw new MirMediaException(e.toString());
+        }
 
         return container;
     }
@@ -89,8 +93,7 @@ public class MediaHandlerGeneric implements MirMedia
     }
 
     public byte[] getIcon (Entity ent) {
-        String name = "/path/to/some/generic/icon";
-        return getFile(name);
+        return null;
     }
 
     public String getStoragePath()
index b85904a..0ee930a 100755 (executable)
@@ -36,7 +36,7 @@ public class MediaHandlerImages
     protected String imageType="0";
     private Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home")+"log/media.log");
 
-       public byte[] get(Entity ent, Entity mediaTypeEnt)
+       public byte[] get(Entity ent, Entity mediaTypeEnt) throws MirMediaException
        {
         byte[] image_data = null;
 
@@ -45,10 +45,13 @@ public class MediaHandlerImages
             image_data = (byte[])method.invoke(ent, null);
         } catch ( NoSuchMethodException e) {
             theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); 
+            throw new MirMediaException(e.toString());
         } catch ( IllegalAccessException e) {
             theLog.printDebugInfo("method illegal: "+e.toString()); 
+            throw new MirMediaException(e.toString());
         } catch ( InvocationTargetException e) {
             theLog.printDebugInfo("get: invocation target illegal: "+e.toString()); 
+            throw new MirMediaException(e.toString());
         }
 
 
@@ -56,7 +59,8 @@ public class MediaHandlerImages
        }
 
        protected boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt)
-       {
+           throws MirMediaException {
+
         try {
             Class[] params = {byte[].class, String.class};
             theLog.printDebugInfo("NAME: "+ent.getClass().getName()+" "+
@@ -66,13 +70,13 @@ public class MediaHandlerImages
             method.invoke(ent, new Object[] {uploadData, imageType});
         } catch ( NoSuchMethodException e) {
             theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); 
-            return false;
+            throw new MirMediaException(e.toString());
         } catch ( IllegalAccessException e) {
             theLog.printDebugInfo("method illegal: "+e.toString()); 
-            return false;
+            throw new MirMediaException(e.toString());
         } catch ( InvocationTargetException e) {
             theLog.printDebugInfo("set: invocation target illegal: "+e.toString()); 
-            return false;
+            throw new MirMediaException(e.toString());
         }
         //deref. -mh
         uploadData=null;
@@ -80,7 +84,7 @@ public class MediaHandlerImages
         return true;
        }
 
-       public byte[] getIcon(Entity ent)
+       public byte[] getIcon(Entity ent) throws MirMediaException
        {
         byte[] icon_data = null;
 
@@ -89,10 +93,13 @@ public class MediaHandlerImages
             icon_data = (byte[])method.invoke(ent, null);
         } catch ( NoSuchMethodException e) {
             theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); 
+            throw new MirMediaException(e.toString());
         } catch ( IllegalAccessException e) {
             theLog.printDebugInfo("method illegal: "+e.toString()); 
+            throw new MirMediaException(e.toString());
         } catch ( InvocationTargetException e) {
             theLog.printDebugInfo("getIcon: invocation target illegal: "+e.toString()); 
+            throw new MirMediaException(e.toString());
         }
 
         return icon_data;
index 0b22412..5b940c4 100755 (executable)
@@ -23,8 +23,13 @@ public class MediaHandlerImagesGif extends MediaHandlerImages implements MirMedi
 {
 
        public boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt)
-       {
+           throws MirMediaException {
+
         imageType = WEBDB_GIF;
-        return super.set(uploadData, ent, mediaTypeEnt);
+        try {
+            return super.set(uploadData, ent, mediaTypeEnt);
+        } catch (Exception e) {
+            throw new MirMediaException(e.toString());
+        }
     }
 }
index ff01abc..39faaf0 100755 (executable)
@@ -22,8 +22,13 @@ import mir.entity.*;
 public class MediaHandlerImagesJpeg extends MediaHandlerImages implements MirMedia
 {
        public boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt)
-       {
+           throws MirMediaException {
+
         imageType = WEBDB_JPG;
-        return super.set(uploadData, ent, mediaTypeEnt);
+        try {
+            return super.set(uploadData, ent, mediaTypeEnt);
+        } catch (Exception e) {
+            throw new MirMediaException(e.toString());
+        }
     }
 }
index 747ef37..0357a02 100755 (executable)
@@ -42,7 +42,9 @@ import mir.storage.*;
 public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
 {
 
-    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+        throws MirMediaException {
+
         String ext = mediaTypeEnt.getValue("name");
         String dir = MirConfig.getProp("Producer.Media.Path");
         String mediaHost = MirConfig.getProp("Producer.Media.Host");
@@ -54,31 +56,27 @@ public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
         String mpegURLFile = baseName+".m3u"; 
         String playlistFile = baseName+".pls"; 
         Integer size = new Integer(uploadedData.length);
-        if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
-        //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) {
+        try {
+            FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+            //FileUtil.write(dir+"/"+mediaFname, uploadedData);
             //were done with the data, dereference.
             uploadedData=null;
             
-            try {
-                //write the "meta" files
-                //first the .m3u since it only contains one line
-                FileUtil.write(dir+"/"+datePath+"/"+mpegURLFile,mp3Pointer.getBytes());
-                //now the .pls file
-                FileUtil.write(dir+"/"+datePath+"/"+playlistFile,mp3Pointer.getBytes());
-                ent.setValueForProperty("is_produced", "1");
-                ent.setValueForProperty("icon_is_produced", "1");
-                ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
-                //ent.setValueForProperty("publish_path", mediaFname);
-                ent.setValueForProperty("publish_server", mediaHost);
-                ent.setValueForProperty("size", size.toString());
-                ent.update();
-            } catch (StorageObjectException e) {
-                theLog.printError("StorageObjectException: "+e.toString()); 
-                return false;
-            }
-        } else {
-            theLog.printError("could not write FILE!"); 
-            return false;
+            //write the "meta" files
+            //first the .m3u since it only contains one line
+            FileUtil.write(dir+"/"+datePath+"/"+mpegURLFile,mp3Pointer.getBytes());
+            //now the .pls file
+            FileUtil.write(dir+"/"+datePath+"/"+playlistFile,mp3Pointer.getBytes());
+            ent.setValueForProperty("is_produced", "1");
+            ent.setValueForProperty("icon_is_produced", "1");
+            ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
+            //ent.setValueForProperty("publish_path", mediaFname);
+            ent.setValueForProperty("publish_server", mediaHost);
+            ent.setValueForProperty("size", size.toString());
+            ent.update();
+        } catch (Exception e) {
+            theLog.printError(e.toString());
+            throw new MirMediaException(e.toString());
         }
 
         return true;
index 5a1c7c1..e9f99a2 100755 (executable)
@@ -26,7 +26,8 @@ import mir.storage.*;
 public class MediaHandlerRealAudio extends MediaHandlerAudio implements MirMedia
 {
 
-    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+        throws MirMediaException {
         String ext = mediaTypeEnt.getValue("name");
         String dir = MirConfig.getProp("Producer.Media.Path");
         String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
@@ -39,28 +40,24 @@ public class MediaHandlerRealAudio extends MediaHandlerAudio implements MirMedia
            String realMediaPointer = rtspMediaHost+datePath+mediaFname;
            String realMediaFile = ent.getId()+".ram";
         Integer size = new Integer(uploadedData.length);
-        if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
-        //if(FileUtil.write(rtspDir+"/"+mediaFname, uploadedData)) {
+        try {
+            FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+            //FileUtil.write(rtspDir+"/"+mediaFname, uploadedData);
             //were done with the data, dereference.
             uploadedData=null;
             
-            try {
-                //write a ram file
-                FileUtil.write(dir+"/"+datePath+"/"+realMediaFile,realMediaPointer.getBytes());
-                ent.setValueForProperty("is_produced", "1");
-                ent.setValueForProperty("icon_is_produced", "1");
-                ent.setValueForProperty("publish_path",datePath+"/"+realMediaFile);
-                //ent.setValueForProperty("publish_path", realMediaFile);
-                ent.setValueForProperty("publish_server", mediaHost);
-                ent.setValueForProperty("size", size.toString());
-                ent.update();
-            } catch (StorageObjectException e) {
-                theLog.printError("StorageObjectException: "+e.toString()); 
-                return false;
-            }
-        } else {
-            theLog.printError("could not write FILE!"); 
-            return false;
+            //write a ram file
+            FileUtil.write(dir+"/"+datePath+"/"+realMediaFile,realMediaPointer.getBytes());
+            ent.setValueForProperty("is_produced", "1");
+            ent.setValueForProperty("icon_is_produced", "1");
+            ent.setValueForProperty("publish_path",datePath+"/"+realMediaFile);
+            //ent.setValueForProperty("publish_path", realMediaFile);
+            ent.setValueForProperty("publish_server", mediaHost);
+            ent.setValueForProperty("size", size.toString());
+            ent.update();
+        } catch (Exception e) {
+            theLog.printError(e.toString()); 
+            throw new MirMediaException(e.toString());
         }
 
         return true;
index 264d1bd..f47e996 100755 (executable)
@@ -29,7 +29,10 @@ public class MediaHandlerRealVideo extends MediaHandlerGeneric implements MirMed
     private String imageHost = MirConfig.getProp("Producer.Image.Host");
     private static String imageRoot = MirConfig.getProp("Producer.ImageRoot");
     private Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home")+"log/media.log");
-    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+
+    public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+        throws MirMediaException {
+
         String ext = mediaTypeEnt.getValue("name");
         String dir = MirConfig.getProp("Producer.Media.Path");
         String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
@@ -37,34 +40,29 @@ public class MediaHandlerRealVideo extends MediaHandlerGeneric implements MirMed
         String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host");
 
         String mediaFname = ent.getId()+"."+ext;
-       String RealMediaPointer = rtspMediaHost+mediaFname;
-       String RealMediaFile = ent.getId()+".ram";
+        String RealMediaPointer = rtspMediaHost+mediaFname;
+        String RealMediaFile = ent.getId()+".ram";
         String date = ent.getValue("date");
         String datePath = StringUtil.webdbDate2path(date);
         Integer size = new Integer(uploadedData.length);
-        if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
-        //if(FileUtil.write(rtspDir+"/"+mediaFname, uploadedData)) {
+        try {
+            FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+            //FileUtil.write(rtspDir+"/"+mediaFname, uploadedData);
             //were done with the data, dereference.
             uploadedData=null;
-            
-            try {
-//write an rm file
-FileUtil.write(dir+"/"+RealMediaFile,RealMediaPointer.getBytes());
-
-                ent.setValueForProperty("is_produced", "1");
-                ent.setValueForProperty("icon_is_produced", "1");
-                ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
-                //ent.setValueForProperty("publish_path", RealMediaFile);
-                ent.setValueForProperty("publish_server", mediaHost);
-                ent.setValueForProperty("size", size.toString());
-                ent.update();
-            } catch (StorageObjectException e) {
-                theLog.printError("StorageObjectException: "+e.toString()); 
-                return false;
-            }
-        } else {
-            theLog.printError("could not write FILE!"); 
-            return false;
+                
+            //write an rm file
+            FileUtil.write(dir+"/"+RealMediaFile,RealMediaPointer.getBytes());
+            ent.setValueForProperty("is_produced", "1");
+            ent.setValueForProperty("icon_is_produced", "1");
+            ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
+            //ent.setValueForProperty("publish_path", RealMediaFile);
+            ent.setValueForProperty("publish_server", mediaHost);
+            ent.setValueForProperty("size", size.toString());
+            ent.update();
+        } catch (Exception e) {
+            theLog.printError(e.toString());
+            throw new MirMediaException(e.toString());
         }
 
         return true;
@@ -95,25 +93,25 @@ FileUtil.write(dir+"/"+RealMediaFile,RealMediaPointer.getBytes());
     private static String tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
     private static String bigIcon = MirConfig.getProp("Producer.Icon.BigVideo");
 
-  public String getTinyIcon()
-  {
-    return tinyIcon;
-  }
-
-  public String getBigIcon()
-  {
-    return bigIcon;
-  }
-
-  public String getIconAlt()
-  {
-    return "Video";
-  }
-
-  public boolean isVideo()
-  {
-    return true;
-  }
+    public String getTinyIcon()
+    {
+        return tinyIcon;
+    }
+
+    public String getBigIcon()
+    {
+        return bigIcon;
+    }
+
+    public String getIconAlt()
+    {
+        return "Video";
+    }
+
+    public boolean isVideo()
+    {
+        return true;
+    }
 
 }
         
index 2a3a9b6..3597a1f 100755 (executable)
@@ -72,7 +72,7 @@ public interface  MirMedia{
    * @return boolean, success/fail
    * @see mir.entity.Entity
    */
-       public abstract boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt );
+       public abstract boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) throws MirMediaException;
 
   /**
    * Get's the media data from storage and returns it as a byte array
@@ -84,7 +84,8 @@ public interface  MirMedia{
    * @return byte[]
    * @see mir.entity.Entity
    */
-       public abstract byte[] get (Entity ent, Entity mediaTypeEnt);
+       public abstract byte[] get (Entity ent, Entity mediaTypeEnt)
+        throws MirMediaException;
 
   /**
    * Pretty much like get() above. But get's the specific Icon
@@ -93,7 +94,7 @@ public interface  MirMedia{
    * @return byte[]
    * @see mir.entity.Entity
    */
-       public abstract byte[] getIcon (Entity ent);
+       public abstract byte[] getIcon (Entity ent) throws MirMediaException;
 
        /**
    * gets the final content representation for the media
@@ -108,7 +109,8 @@ public interface  MirMedia{
    * @see mir.entity.Entity
    * @see mir.misc.StringUtil
    */
-  public abstract String getURL (Entity ent, Entity mediaTypeEnt);
+  public abstract String getURL (Entity ent, Entity mediaTypeEnt)
+    throws MirMediaException;
 
        /**
    * gets the summary representation for the media
@@ -123,7 +125,8 @@ public interface  MirMedia{
    * @see mir.entity.Entity
    * @see mir.misc.StringUtil
    */
-  public abstract String getListView (Entity ent, Entity mediaTypeEnt);
+  public abstract String getListView (Entity ent, Entity mediaTypeEnt)
+    throws MirMediaException;
 
        /**
    * Returns the absolute filesystem path to where the media
@@ -133,7 +136,7 @@ public interface  MirMedia{
    * @return String, the path.
    * @see mir.misc.MirConfig
    */
-  public abstract String getStoragePath ();
+  public abstract String getStoragePath () throws MirMediaException;
 
        /**
    * Returns the *relative* filesystem path to where the media
@@ -145,7 +148,7 @@ public interface  MirMedia{
    * @return String, the path.
    * @see mir.misc.MirConfig
    */
-       public abstract String getIconStoragePath ();
+       public abstract String getIconStoragePath () throws MirMediaException;
 
        /**
    * Returns the base URL to that the media is accessible from
@@ -153,12 +156,12 @@ public interface  MirMedia{
    * This is used in the Metadata stored in the DB and later on
    * ,the templates use it.
    * It is usually defined
-   * in the configuration wich is accessible through the MirConfig
+   * in the configuration witch is accessible through the MirConfig
    * class.
    * @return String, the base URL to the host.
    * @see mir.misc.MirConfig
    */
-       public abstract String getPublishHost ();
+       public abstract String getPublishHost () throws MirMediaException;
 
        /**
    * Returns the file name of the Icon representing the media type.
index 5a68e31..f9b3e7e 100755 (executable)
@@ -30,7 +30,6 @@ public final class FileUtil {
 
     static {
       System.setProperty("content.types.user.table", MirConfig.getProp("Home")+"content-types.properties");
-      System.err.println("DDD: "+MirConfig.getProp("Home")+"content-types.properties");                             
       fileNameMap = sun.net.www.MimeTable.loadTable();
       producerStorageRoot = MirConfig.getProp("Producer.StorageRoot");
     }
@@ -41,7 +40,8 @@ public final class FileUtil {
   private FileUtil () {
   }
        
-  public static boolean write(String filename, byte[] in) {
+  public static boolean write(String filename, byte[] in)
+    throws IOException {
 
                boolean retVal = false;
 
@@ -57,12 +57,15 @@ public final class FileUtil {
                                outStream.write(in);
                                outStream.close();
                                retVal = true;
-                       } catch(IOException exception) {}
+                       } catch(IOException e) {
+                throw new IOException(e.toString());
+            }
         }
                return retVal;
        }
 
-  public static boolean read(String filename, byte out[]) {
+  public static boolean read(String filename, byte out[])
+    throws IOException {
 
         File f = null;
         f = new File(filename);
@@ -75,8 +78,8 @@ public final class FileUtil {
                                inStream = new FileInputStream(f);
                                inStream.read(out);
                                inStream.close();
-                       } catch(IOException exception) {
-                return false;
+                       } catch(IOException e) {
+                throw new IOException(e.toString());
             }
         } else {
             return false;
@@ -117,9 +120,8 @@ public final class FileUtil {
     public static String guessContentTypeFromName(String fname) {
         String contentType = null;
                     
-        System.err.println("NAME: "+fname);                             
         contentType = getFileNameMap().getContentTypeFor(fname);
-        System.err.println("TYPE: "+contentType);                             
+                                    
         return contentType;
     }
 
index d6cd485..4eb5b8f 100755 (executable)
@@ -79,7 +79,7 @@ public class MirConfig extends Configuration {
            (String)configHash.get(propName);
   }
 
-  public static void addBroker(String driver, String URL){
+  public static void addBroker(String driver, String URL) throws Exception {
 
     String username,passwd,min,max,log,reset;
 
@@ -107,6 +107,7 @@ public class MirConfig extends Configuration {
         }
       } catch(Exception e){
         System.err.println("Der ConnectionBroker konnte nicht initializiert werden"+ e.toString());e.printStackTrace();
+        throw new Exception(e.toString());
       }
     } // end if
   }
index 3c75365..9fc15d0 100755 (executable)
@@ -7,7 +7,8 @@ import  java.sql.*;
 import  java.lang.*;
 import  java.io.*;
 import  java.util.*;
-import  freemarker.template.*;
+import  freemarker.template.SimpleList;
+import  freemarker.template.SimpleHash;
 import  com.javaexchange.dbConnectionBroker.*;
 import  mir.storage.StorageObject;
 import  mir.entity.*;
@@ -59,25 +60,25 @@ public class Database implements StorageObject {
    *
    * @param   String confFilename Dateiname der Konfigurationsdatei
    */
-  public Database() {
-    //theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Database.Logfile"));
-    theLog = Logfile.getInstance(this.getClass().getName());
-    String database_username=DatabaseConfig.getProp("Database.Username");
-    String database_password=DatabaseConfig.getProp("Database.Password");
-    String database_host=DatabaseConfig.getProp("Database.Host");
-    String theAdaptorName=DatabaseConfig.getProp("Database.Adaptor");
+  public Database() throws StorageObjectException {
+    theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Database.Logfile"));
+    String database_username=MirConfig.getProp("Database.Username");
+    String database_password=MirConfig.getProp("Database.Password");
+    String database_host=MirConfig.getProp("Database.Host");
+    String theAdaptorName=MirConfig.getProp("Database.Adaptor");
     try {
       theEntityClass = Class.forName("mir.entity.GenericEntity");
       theAdaptor = (DatabaseAdaptor)Class.forName(theAdaptorName).newInstance();
-      defaultLimit = Integer.parseInt(DatabaseConfig.getProp("Database.Limit"));
+      defaultLimit = Integer.parseInt(MirConfig.getProp("Database.Limit"));
       database_driver=theAdaptor.getDriver();
       database_url=theAdaptor.getURL(database_username,database_password,database_host);
       theLog.printDebugInfo("adding Broker with: " +database_driver+":"+database_url  );
-      DatabaseConfig.addBroker(database_driver,database_url);
-      myBroker=DatabaseConfig.getBroker();
+      MirConfig.addBroker(database_driver,database_url);
+      myBroker=MirConfig.getBroker();
     }
     catch (Exception e){
       theLog.printError("Bei Konstruktion von Database() with " + theAdaptorName + " -- " +e.toString());
+      throw new StorageObjectException(e.toString());
     }
   }
 
@@ -753,7 +754,7 @@ public class Database implements StorageObject {
    * eine SimpleList mit Standard-Popupdaten erzeugt werden koennen soll.
    * @return null
    */
-  public SimpleList getPopupData () {
+  public SimpleList getPopupData () throws StorageObjectException {
     return  null;
   }
 
@@ -763,7 +764,8 @@ public class Database implements StorageObject {
    *  @param hasNullValue  Wenn true wird eine leerer  Eintrag fuer die Popups erzeugt.
    *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.
    */
-  public SimpleList getPopupData (String name, boolean hasNullValue) {
+  public SimpleList getPopupData (String name, boolean hasNullValue) 
+    throws StorageObjectException {
     return  getPopupData(name, hasNullValue, null);
   }
 
@@ -774,8 +776,8 @@ public class Database implements StorageObject {
    *  @param where  Schraenkt die Selektion der Datensaetze ein.
    *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.
    */
-  public SimpleList getPopupData (String name, boolean hasNullValue, String where) {
-    return  getPopupData(name, hasNullValue, where, null);
+  public SimpleList getPopupData (String name, boolean hasNullValue, String where) throws StorageObjectException {
+   return  getPopupData(name, hasNullValue, where, null);
   }
 
   /**
@@ -786,8 +788,7 @@ public class Database implements StorageObject {
    *  @param order  Gibt ein Feld als Sortierkriterium an.
    *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.
    */
-  public SimpleList getPopupData (String name, boolean hasNullValue, String where,
-      String order) {
+  public SimpleList getPopupData (String name, boolean hasNullValue, String where, String order) throws StorageObjectException {
     // caching
     if (hasPopupCache && popupCache != null)
       return  popupCache;
@@ -829,6 +830,7 @@ public class Database implements StorageObject {
       }
     } catch (Exception e) {
       theLog.printDebugInfo(e.toString());
+      throw new StorageObjectException(e.toString());
     } finally {
       freeConnection(con, stmt);
     }
@@ -968,7 +970,10 @@ public class Database implements StorageObject {
       pstmt = con.prepareStatement(sql);
       result = pstmt.executeUpdate();
     }
-    catch (Exception e) {theLog.printDebugInfo("settimage :: setImage gescheitert: "+e.toString());}
+    catch (Exception e) {
+      theLog.printDebugInfo("settimage :: setImage gescheitert: "+e.toString());
+      throw new StorageObjectException("executeUpdate failed: "+e.toString());
+    }
     finally { freeConnection(con,pstmt); }
     theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + sql);
     return result;
@@ -1032,11 +1037,11 @@ public class Database implements StorageObject {
   /**
    * Datenbankverbindung wird geschlossen
    */
-  public void disconnectPool () {
+  public void disconnectPool () throws StorageObjectException {
     try {
       myBroker.destroy(100);
     } catch (SQLException sqe) {
-      ;
+      throwSQLException(sqe, "disconnectPool");
     }
   }
 
@@ -1060,17 +1065,21 @@ public class Database implements StorageObject {
    * @param con Connection zur Datenbank
    * @param stmt Statement-Objekt
    */
-  public void freeConnection (Connection con, Statement stmt) {
+  public void freeConnection (Connection con, Statement stmt)
+    throws StorageObjectException {
     try {
       if (stmt != null)
         stmt.close();
     } catch (SQLException e1) {
       theLog.printDebugInfo(e1.toString());
+      throw new StorageObjectException("DB, in freeConnection: "+e1.toString());
     }
     if (con != null)
       myBroker.freeConnection(con);
-    else
+    else {
       theLog.printDebugInfo("Con was null!");
+      throw new StorageObjectException("Con was null!");
+    }
   }
 
   /**
index 1677903..d489d2d 100755 (executable)
@@ -204,7 +204,8 @@ public interface StorageObject {
         * @param con
         * @param stmt
         */
-               abstract public void freeConnection(Connection con,  Statement stmt);
+               abstract public void freeConnection(Connection con,  Statement stmt)
+            throws StorageObjectException;
 
 
 
@@ -212,7 +213,7 @@ public interface StorageObject {
         * Dokumentation siehe Database.java
         * @return
         */
-       abstract public SimpleList getPopupData ();
+       abstract public SimpleList getPopupData () throws StorageObjectException;
 
        abstract public int executeUpdate(Statement a, String sql) throws StorageObjectException, SQLException ;
        abstract public int executeUpdate(String sql) throws StorageObjectException, SQLException ;
index 693afd8..485f609 100755 (executable)
@@ -55,7 +55,7 @@ public class EntityContent extends AbstractEntity implements Entity
        * set is_produced flag for the article
        */
 
-       public void setProduced(boolean yesno)
+       public void setProduced(boolean yesno) throws StorageObjectException
        {
                Connection con=null;Statement stmt=null;
                String value = (yesno) ? "1":"0";
@@ -96,7 +96,7 @@ public class EntityContent extends AbstractEntity implements Entity
        * dettach from media
        */
 
-       public void dettach(String cid,String mid)
+       public void dettach(String cid,String mid) throws StorageObjectException
        {
                if (mid!=null){
                        try{
@@ -113,7 +113,7 @@ public class EntityContent extends AbstractEntity implements Entity
        * attach to media
        */
 
-       public void attach(String mid)
+       public void attach(String mid) throws StorageObjectException
        {
                if (mid!=null) {
                        //write media-id mid and content-id in table content_x_media
index f098b68..c9c1a31 100755 (executable)
@@ -37,7 +37,7 @@ public class EntityImages extends AbstractEntity implements Entity
 
 
 
-       public byte[] getImage()
+       public byte[] getImage() throws StorageObjectException
        {
                theLog.printDebugInfo("--getimage started");
                Connection con=null;Statement stmt=null;
@@ -64,7 +64,7 @@ public class EntityImages extends AbstractEntity implements Entity
        }
 
        public void setImage(byte[] uploadData, String imageType)
-       {
+           throws StorageObjectException {
         int type = 0;
 
         //hack -mh
@@ -129,7 +129,7 @@ public class EntityImages extends AbstractEntity implements Entity
                super.setValues(theStringValues);
        }
 
-       public byte[] getIcon()
+       public byte[] getIcon() throws StorageObjectException
        {
                Connection con=null;Statement stmt=null;
                byte[] img_data=null;
index d43fdec..a1c4f63 100755 (executable)
@@ -38,8 +38,13 @@ public class EntityMedia extends AbstractEntity implements Entity
         *
         * @return mir.entity.Entity
         */
-       public Entity getMediaType() {
-               return ((DatabaseMedia)theStorageObject).getMediaType(this);
+       public Entity getMediaType() throws StorageObjectException {
+        try {
+            return ((DatabaseMedia)theStorageObject).getMediaType(this);
+        } catch (StorageObjectException e) {
+            throw new StorageObjectException("getMediaType(): "+e.toString());
+        }
+
        }
 
   public void finalize() {
index 2adf427..ae08955 100755 (executable)
@@ -35,7 +35,7 @@ public class EntityVideo extends AbstractEntity implements Entity
        //
        // methods
 
-       public byte[] getVideoData()
+       public byte[] getVideoData() throws StorageObjectException
        {
 
                Connection con=null;Statement stmt=null;
@@ -61,7 +61,7 @@ public class EntityVideo extends AbstractEntity implements Entity
                return video_data;
        }
 
-       public void setVideoData(byte[] uploadData)
+       public void setVideoData(byte[] uploadData) throws StorageObjectException
        {
                if (uploadData!=null) {
                        Connection con=null;PreparedStatement pstmt=null;
index 1903721..169e418 100755 (executable)
@@ -31,14 +31,18 @@ public class ModuleComment extends AbstractModule
   // Contructor
   public ModuleComment(StorageObject theStorage)
   {
-    //if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Comment.Logfile"));
-    //if (theStorage == null) theLog.printWarning("StorageObject was null!");
+    if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Comment.Logfile"));
+    if (theStorage == null) theLog.printWarning("StorageObject was null!");
     this.theStorage = theStorage;
   }
 
   // Methoden
-  public SimpleList getCommentAsSimpleList() {
-    return ((DatabaseComment)theStorage).getPopupData();
+  public SimpleList getCommentAsSimpleList() throws ModuleException {
+    try {
+      return ((DatabaseComment)theStorage).getPopupData();
+    } catch (StorageObjectException e) {
+      throw new ModuleException(e.toString());
+    }
   }
   
   /**
index 9639ed1..5f42664 100755 (executable)
@@ -32,12 +32,17 @@ public class ModuleFeature extends AbstractModule
                        this.theStorage = theStorage;
 
        if (theLog == null)
-       theLog = Logfile.getInstance(this.getClass().getName());
+       theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Feature.Logfile"));
 
                }
 
-               public SimpleList getSchwerpunktAsSimpleList() {
-                       return ((DatabaseFeature)theStorage).getPopupData();
+               public SimpleList getSchwerpunktAsSimpleList()
+      throws ModuleException {
+      try {
+                         return ((DatabaseFeature)theStorage).getPopupData();
+      } catch (StorageObjectException e) {
+        throw new ModuleException(e.toString());
+      }
                }
 }
 
index e5c37a5..01e8e5f 100755 (executable)
@@ -24,7 +24,7 @@ public class ModuleImages extends AbstractModule {
 
        public ModuleImages(StorageObject theStorage) {
 
-               if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
+               if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home")+MirConfig.getProp("Module.Bilder.Logfile"));
                if (theStorage == null) theLog.printWarning("StorageObject was null!");
                this.theStorage = theStorage;
 
@@ -32,10 +32,15 @@ public class ModuleImages extends AbstractModule {
 
        // Methoden
 
-               public SimpleList getBilderAsSimpleList() {
+               public SimpleList getBilderAsSimpleList()
+      throws ModuleException {
 
                //  String sql = "select id, name from Bilder order by name";
-                       return ((DatabaseImages)theStorage).getPopupData();
+      try {
+                         return ((DatabaseImages)theStorage).getPopupData();
+      } catch  (StorageObjectException e) {
+        throw new ModuleException(e.toString());
+      }
                }
 
 }
index eb82576..4609e06 100755 (executable)
@@ -35,15 +35,19 @@ public class ModuleMediafolder extends AbstractModule
 
        public ModuleMediafolder(StorageObject theStorage)
        {
-               if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
+               if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Mediafolder.Logfile"));
                if (theStorage == null) theLog.printWarning("StorageObject was null!");
                this.theStorage = theStorage;
        }
 
        // Methoden
 
-               public SimpleList getPopupData() {
-                       return ((DatabaseMediafolder)theStorage).getPopupData();
+               public SimpleList getPopupData() throws ModuleException {
+      try {
+                         return ((DatabaseMediafolder)theStorage).getPopupData();
+      } catch (Exception e) {
+        throw new ModuleException(e.toString());
+      }
                }
 
 
index a0c1cd2..3cab0fe 100755 (executable)
@@ -33,12 +33,17 @@ public class ModuleSchwerpunkt extends AbstractModule
                        this.theStorage = theStorage;
 
        if (theLog == null)
-       theLog = Logfile.getInstance(this.getClass().getName());
+       theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Schwerpunkt.Logfile"));
 
                }
 
-               public SimpleList getSchwerpunktAsSimpleList() {
-                       return ((DatabaseFeature)theStorage).getPopupData();
+               public SimpleList getSchwerpunktAsSimpleList()
+      throws ModuleException {
+      try {
+                         return ((DatabaseFeature)theStorage).getPopupData();
+      } catch (StorageObjectException e) {
+        throw new ModuleException(e.toString());
+      }
                }
 }
 
index 4a132e3..546473f 100755 (executable)
@@ -32,11 +32,15 @@ public class ModuleTopics extends AbstractModule
     public ModuleTopics(StorageObject theStorage) {
            this.theStorage = theStorage;
            if (theLog == null)
-             theLog = Logfile.getInstance(this.getClass().getName());
+             theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
     }
 
-    public SimpleList getTopicsAsSimpleList() {
-           return ((DatabaseTopics)theStorage).getPopupData();
+    public SimpleList getTopicsAsSimpleList() throws ModuleException {
+      try {
+             return ((DatabaseTopics)theStorage).getPopupData();
+      } catch(StorageObjectException e) {
+        throw new ModuleException(e.toString());
+      }
     }
 
 }
index 76a1cec..e3446e8 100755 (executable)
@@ -32,11 +32,16 @@ public class ModuleUploadedMedia extends AbstractModule
     public ModuleUploadedMedia(StorageObject theStorage) {
            this.theStorage = theStorage;
            if (theLog == null)
-             theLog = Logfile.getInstance(this.getClass().getName());
+             theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
     }
 
-    public SimpleList getUploadedMediaAsSimpleList() {
-           return ((DatabaseUploadedMedia)theStorage).getPopupData();
+    public SimpleList getUploadedMediaAsSimpleList()
+      throws ModuleException {
+      try {
+             return ((DatabaseUploadedMedia)theStorage).getPopupData();
+      } catch (StorageObjectException e) {
+        throw new ModuleException(e.toString());
+      }
     }
 
 }
index 779dc2c..13c07c5 100755 (executable)
@@ -35,7 +35,7 @@ public class ModuleUsers extends AbstractModule
        public ModuleUsers(StorageObject theStorage)
        {
 
-               if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
+               if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Users.Logfile"));
                if (theStorage == null) theLog.printWarning("StorageObject was null!");
                this.theStorage = theStorage;
 
@@ -67,9 +67,13 @@ public class ModuleUsers extends AbstractModule
                }
        }
 
-       public SimpleList getUsersAsSimpleList() {
+       public SimpleList getUsersAsSimpleList() throws ModuleException {
                //  String sql = "select id, name from Users order by name";
-               return ((DatabaseUsers)theStorage).getPopupData();
+    try {
+                 return ((DatabaseUsers)theStorage).getPopupData();
+    } catch(StorageObjectException e) {
+      throw new ModuleException(e.toString());
+    }
        }
 
 }
index d3e0553..f62dcba 100755 (executable)
@@ -18,7 +18,7 @@ abstract public class Producer {
   protected static String producerStorageRoot = MirConfig.getProp("Producer.StorageRoot");
        protected static String producerProductionHost = MirConfig.getProp("Producer.ProductionHost");
        protected static String producerOpenAction = MirConfig.getProp("Producer.OpenAction");;
-       protected static Logfile theLog = Logfile.getInstance("Producer");
+       protected static Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Producer.Logfile"));
        protected static ModuleTopics         topicsModule;
   protected static ModuleLinksImcs      linksImcsModule;
        protected static ModuleSchwerpunkt    schwerpunktModule;
@@ -32,7 +32,7 @@ abstract public class Producer {
     try {
                        contentModule = new ModuleContent(DatabaseContent.getInstance());
                        topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
-      linksImcsModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
+            linksImcsModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
                        schwerpunktModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
                        featureModule = new ModuleFeature(DatabaseFeature.getInstance());
                        imageModule = new ModuleImages(DatabaseImages.getInstance());
index c198f82..c7cf7bc 100755 (executable)
@@ -102,105 +102,106 @@ public class ProducerContent extends Producer {
     while (batchEntityList != null) {
       for(int i=0;i<batchEntityList.size();i++) {
         currentContent = (EntityContent)batchEntityList.elementAt(i);
-        currentContentValues = currentContent.getValues();
-
-        //because of postgres 7.1.* not needed anymore
-        //currentContentValues.put("content_data",currentContent.getContentData());
-        String date = (String)currentContentValues.get("date");
-        String year = date.substring(0,4);
-        String month = date.substring(4,6);
-
-        htmlFileName =  producerDocRoot
-          + "/" + year + "/" + month + "/" +  currentContentValues.get("id") + ".shtml";
-
-        currentContentValues.put("content_data",StringUtil.deleteForbiddenTags((String)currentContentValues.get("content_data")));
-        currentContentValues.put("description",StringUtil.deleteForbiddenTags((String)currentContentValues.get("description")));
-
-
-        //create http-links and email-links
-        if (currentContentValues.get("is_html").equals("0")) {
-          String temp = (String)currentContentValues.get("content_data");
-          if(temp!=null && temp.length()>0){
-            temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
-            temp = StringUtil.decodeHTMLinTags(temp);
-            currentContentValues.put("content_data",temp);
-          }
-          temp = (String)currentContentValues.get("description");
-          if(temp!=null && temp.length()>0){
-            temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
-            temp = StringUtil.decodeHTMLinTags(temp);
-            currentContentValues.put("description",temp);
-          }
-        } else {
-          String temp = (String)currentContentValues.get("content_data");
-          if(temp!=null && temp.length()>0){
-            temp = StringUtil.decodeHTMLinTags(temp);
-            currentContentValues.put("content_data",temp);
-          }
-          temp = (String)currentContentValues.get("description");
-          if(temp!=null && temp.length()>0){
-            temp = StringUtil.decodeHTMLinTags(temp);
-            currentContentValues.put("description",temp);
-          }
-        }
-
-        //create the freemarker-model
-        SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(currentContentValues);
-
-        // get the uploaded media
-        EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-        if (currentMediaList!=null && currentMediaList.getCount()>=1) {
-          SimpleList mediaList = new SimpleList();
-          for (int n=0; n < currentMediaList.size();n++) {
-            upMedia = currentMediaList.elementAt(n);
-            upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
-            mediaType = ((EntityMedia)upMedia).getMediaType();
-            //in case it's a non-existant to_media_type entry..
-            if (mediaType != null) {
-              try {
-                mediaHandlerName = mediaType.getValue("classname");
-                mediaStorageName = mediaType.getValue("tablename");
-                mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
-                mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
-                mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
-                Method m = mediaStorageClass.getMethod("getInstance", null);
-                mediaStorage = (Database)m.invoke(null, null);
-                //we most likely need further info
-                upMedia = mediaStorage.selectById(upMedia.getId());
-              } catch (Exception e) {
-                theLog.printError("ProducerStartpage:problem in reflection: "+mediaHandlerName);
-              } //end catch
-              upMediaSimpleHash.put("url", mediaHandler.getURL(upMedia, mediaType));
-             upMediaSimpleHash.put("type",mediaType.getValue("classname"));
-              mediaList.add(upMediaSimpleHash);
-            } //end if media_type != null
-          } //end for
-          mergeData.put("to_media", mediaList);
-        } //end if currentMediaList != null
-
-        // get the comments for the article
-        // and html-ize them
-        SimpleList commentList = currentContent.getComments();
-        try{
-          if(commentList.isEmpty()==false){
-            while(commentList.hasNext()){
-              SimpleHash comment = (SimpleHash)commentList.next();
-              SimpleScalar commentText = (SimpleScalar)comment.get("description");
-              comment.put("description",new SimpleScalar(StringUtil.createHTML(commentText.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName)));
+        try {
+            currentContentValues = currentContent.getValues();
+
+            //because of postgres 7.1.* not needed anymore
+            //currentContentValues.put("content_data",currentContent.getContentData());
+            String date = (String)currentContentValues.get("date");
+            String year = date.substring(0,4);
+            String month = date.substring(4,6);
+
+            htmlFileName =  producerDocRoot
+              + "/" + year + "/" + month + "/" +  currentContentValues.get("id") + ".shtml";
+
+            currentContentValues.put("content_data",StringUtil.deleteForbiddenTags((String)currentContentValues.get("content_data")));
+            currentContentValues.put("description",StringUtil.deleteForbiddenTags((String)currentContentValues.get("description")));
+
+
+            //create http-links and email-links
+            if (currentContentValues.get("is_html").equals("0")) {
+              String temp = (String)currentContentValues.get("content_data");
+              if(temp!=null && temp.length()>0){
+                temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
+                temp = StringUtil.decodeHTMLinTags(temp);
+                currentContentValues.put("content_data",temp);
+              }
+              temp = (String)currentContentValues.get("description");
+              if(temp!=null && temp.length()>0){
+                temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
+                temp = StringUtil.decodeHTMLinTags(temp);
+                currentContentValues.put("description",temp);
+              }
+            } else {
+              String temp = (String)currentContentValues.get("content_data");
+              if(temp!=null && temp.length()>0){
+                temp = StringUtil.decodeHTMLinTags(temp);
+                currentContentValues.put("content_data",temp);
+              }
+              temp = (String)currentContentValues.get("description");
+              if(temp!=null && temp.length()>0){
+                temp = StringUtil.decodeHTMLinTags(temp);
+                currentContentValues.put("description",temp);
+              }
             }
-          }
-        } catch(Exception e){}
-        mergeData.put("comments", commentList);
-
-        // get the topics of this article
-        mergeData.put("topics",HTMLTemplateProcessor.makeSimpleList(DatabaseContentToTopics.getInstance().getTopics(currentContent)));
 
-        //produce html
-        boolean retVal = produce(contentTemplate, htmlFileName, mergeData, htmlout);
-        sessionConnectTime = new java.util.Date().getTime() - startTime;
-        if (retVal == true && !"1".equals(currentContent.getValue("is_produced")))
-            currentContent.setProduced(true);
-      }//while
+            //create the freemarker-model
+            SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(currentContentValues);
+
+            // get the uploaded media
+            EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+            if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+              SimpleList mediaList = new SimpleList();
+              for (int n=0; n < currentMediaList.size();n++) {
+                upMedia = currentMediaList.elementAt(n);
+                upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+                mediaType = ((EntityMedia)upMedia).getMediaType();
+                //must be a non-existant to_media_type entry..
+                if (mediaType != null) {
+                  mediaHandlerName = mediaType.getValue("classname");
+                  mediaStorageName = mediaType.getValue("tablename");
+                  mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+                  mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+                  mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+                  Method m = mediaStorageClass.getMethod("getInstance", null);
+                  mediaStorage = (Database)m.invoke(null, null);
+                  //we most likely need further info
+                  upMedia = mediaStorage.selectById(upMedia.getId());
+                  upMediaSimpleHash.put("url", mediaHandler.getURL(upMedia, mediaType));
+                  upMediaSimpleHash.put("type",mediaType.getValue("classname"));
+                  mediaList.add(upMediaSimpleHash);
+                } //end if media_type != null
+              } //end for
+              mergeData.put("to_media", mediaList);
+            } //end if currentMediaList != null
+
+            // get the comments for the article
+            // and html-ize them
+            SimpleList commentList = currentContent.getComments();
+            if(commentList.isEmpty()==false){
+              while(commentList.hasNext()){
+                SimpleHash comment = (SimpleHash)commentList.next();
+                SimpleScalar commentText = (SimpleScalar)comment.get("description");
+                comment.put("description",new SimpleScalar(StringUtil.createHTML(commentText.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName)));
+              }
+            }
+            mergeData.put("comments", commentList);
+
+            // get the topics of this article
+            mergeData.put("topics",HTMLTemplateProcessor.makeSimpleList(DatabaseContentToTopics.getInstance().getTopics(currentContent)));
+
+            //produce html
+            boolean retVal = produce(contentTemplate, htmlFileName, mergeData, htmlout);
+            sessionConnectTime = new java.util.Date().getTime() - startTime;
+            if (retVal == true && !"1".equals(currentContent.getValue("is_produced")))
+                currentContent.setProduced(true);
+        } catch(Exception e) {
+          logHTML(htmlout, "Producer.Content ERROR while producing content ID: " + currentContent.getId()+",skipping it :: "+e.toString());
+          theLog.printError("Producer.Content ERROR while producing content ID: " + currentContent.getId() +",skipping it :: "+e.toString());
+        }
+          
+          
+      }//for
 
       if (batchEntityList.hasNextBatch()){
         batchEntityList = contentModule.getContent(whereClause, orderBy, batchEntityList.getNextBatch(),contentBatchsize, userEntity);
@@ -209,7 +210,7 @@ public class ProducerContent extends Producer {
       }
     }
 
-    // timing an message to browser
+    // timing and message to browser
     sessionConnectTime = new java.util.Date().getTime() - startTime;
     logHTML(htmlout, "Producer.Content finished: " + sessionConnectTime + " ms.");
   }
index 7989c2b..55adfcd 100755 (executable)
@@ -96,79 +96,78 @@ abstract public class ProducerList extends Producer {
       //now produce the pages
       if (list!=null || force==true) {
         SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(list);
-        //first we try to get the images
+        //first we try to get the media
 
         if(list!=null){
           for (int k=0; k < list.size();k++) {
             currentContent = (EntityContent)list.elementAt(k);
-            //images to content
-            EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-            if (currentMediaList!=null && currentMediaList.getCount()>=1) {
-              SimpleList mediaListAudio = new SimpleList();
-              SimpleList mediaListImages = new SimpleList();
-              SimpleList mediaListVideo = new SimpleList();
-              SimpleList mediaListOther = new SimpleList();
-              //SimpleHash allMediaSimpleHash = new SimpleHash();
-              for (int n=0; n < currentMediaList.size();n++) {
-                upMedia = currentMediaList.elementAt(n);
-                upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
-                mediaType = ((EntityMedia)upMedia).getMediaType();
-                //must be a non-existant to_media_type entry..
-                if (mediaType != null) {
-                  try {
-                    mediaHandlerName = mediaType.getValue("classname");
-                    mediaStorageName = mediaType.getValue("tablename");
-                    mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
-                    mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
-                    mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
-                    Method m = mediaStorageClass.getMethod("getInstance", null);
-                    mediaStorage = (Database)m.invoke(null, null);
-                    //we most likely need further info
-                    upMedia = mediaStorage.selectById(upMedia.getId());
-                  } catch (Exception e) {
-                    theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
-                  } //end catch
-                  upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
-                  if (upMedia.getValue("is_published") == "1") {
-                      if (mediaHandler.isImage()) {
-                        mediaListImages.add(upMediaSimpleHash);
-                      } else if (mediaHandler.isAudio()) {
-                        mediaListAudio.add(upMediaSimpleHash);
-                      } else if (mediaHandler.isVideo()) {
-                        mediaListVideo.add(upMediaSimpleHash);
-                      } else {
-                        mediaListOther.add(upMediaSimpleHash);
-                      }
-                  } //end if is_published
-                } //end if media_type != null
-              } //end for
-              try{
-                SimpleList contentList = (SimpleList)mergeData.get("contentlist");
-                SimpleHash contentHash = (SimpleHash)contentList.get(k);
-                contentHash.put("to_media_audio", mediaListAudio);
-                contentHash.put("to_media_images", mediaListImages);
-                contentHash.put("to_media_video", mediaListVideo);
-                contentHash.put("to_media_other", mediaListOther);
-              } catch (Exception e){}
-            } //end if currentMediaList != null
-
-            //content to html
-            if(currentContent.getValue("is_html").equals("0")){
-              String temp = (String)currentContent.getValue("description");
-              if(temp!=null && temp.length()>0){
-                temp = StringUtil.createHTML(temp);
-                temp = StringUtil.decodeHTMLinTags(temp);
-                currentContent.setValueForProperty("description",temp);
-              }
-            } else {
-              String temp = (String)currentContent.getValue("description");
-              if(temp!=null && temp.length()>0){
-                temp = StringUtil.decodeHTMLinTags(temp);
-                currentContent.setValueForProperty("description",temp);
-              }
+            try {
+                //media to content
+                EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+                if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+                  SimpleList mediaListAudio = new SimpleList();
+                  SimpleList mediaListImages = new SimpleList();
+                  SimpleList mediaListVideo = new SimpleList();
+                  SimpleList mediaListOther = new SimpleList();
+                  //SimpleHash allMediaSimpleHash = new SimpleHash();
+                  for (int n=0; n < currentMediaList.size();n++) {
+                    upMedia = currentMediaList.elementAt(n);
+                    upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+                    mediaType = ((EntityMedia)upMedia).getMediaType();
+                    //must be a non-existant to_media_type entry..
+                    if (mediaType != null) {
+                      mediaHandlerName = mediaType.getValue("classname");
+                      mediaStorageName = mediaType.getValue("tablename");
+                      mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+                      mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+                      mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+                      Method m = mediaStorageClass.getMethod("getInstance", null);
+                      mediaStorage = (Database)m.invoke(null, null);
+                      //we most likely need further info
+                      upMedia = mediaStorage.selectById(upMedia.getId());
+                      upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+                      if (upMedia.getValue("is_published") == "1") {
+                          if (mediaHandler.isImage()) {
+                            mediaListImages.add(upMediaSimpleHash);
+                          } else if (mediaHandler.isAudio()) {
+                            mediaListAudio.add(upMediaSimpleHash);
+                          } else if (mediaHandler.isVideo()) {
+                            mediaListVideo.add(upMediaSimpleHash);
+                          } else {
+                            mediaListOther.add(upMediaSimpleHash);
+                          }
+                      } //end if is_published
+                    } //end if media_type != null
+                  } //end for
+                  SimpleList contentList = (SimpleList)mergeData.get("contentlist");
+                  SimpleHash contentHash = (SimpleHash)contentList.get(k);
+                  contentHash.put("to_media_audio", mediaListAudio);
+                  contentHash.put("to_media_images", mediaListImages);
+                  contentHash.put("to_media_video", mediaListVideo);
+                  contentHash.put("to_media_other", mediaListOther);
+                } //end if currentMediaList != null
+
+                //content to html
+                if(currentContent.getValue("is_html").equals("0")){
+                  String temp = (String)currentContent.getValue("description");
+                  if(temp!=null && temp.length()>0){
+                    temp = StringUtil.createHTML(temp);
+                    temp = StringUtil.decodeHTMLinTags(temp);
+                    currentContent.setValueForProperty("description",temp);
+                  }
+                } else {
+                  String temp = (String)currentContent.getValue("description");
+                  if(temp!=null && temp.length()>0){
+                    temp = StringUtil.decodeHTMLinTags(temp);
+                    currentContent.setValueForProperty("description",temp);
+                  }
+                }
+            } catch (Exception e) {
+                logHTML(htmlout, "Producer.List id " +currentContent.getId()+ " seems corrupt, skipping it :: "+e.toString());
+                theLog.printError("Producer.List id " +currentContent.getId()+ " seems corrupt, skipping it :: "+e.toString());
             }
-          }
-        }
+          } //end for over each article
+        } //end if list != null
         SimpleList itemList = HTMLTemplateProcessor.makeSimpleList(list);
         //process hashmap additional and add to mergedata
         if (additional != null) {
index 22939fb..6092df1 100755 (executable)
@@ -77,7 +77,7 @@ public class ProducerStartPage extends Producer {
     Database            mediaStorage=null;
     String              tinyIcon;
     String              iconAlt;
-    Logfile theLog = Logfile.getInstance(this.getClass().getName());
+    Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Producer.Logfile"));
 
     SimpleList mediaList;
     SimpleHash contentHash;
@@ -99,70 +99,60 @@ public class ProducerStartPage extends Producer {
     SimpleList newsWireList = HTMLTemplateProcessor.makeSimpleList(entityList);
     for (int i=0; i < entityList.size();i++) {
       currentContent = (EntityContent)entityList.elementAt(i);
-      //fetching/setting the images
-      upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-      if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
-        tinyIcon = null;
-        iconAlt = null;
-        mediaHandler = null;
-        mediaHandlerName = null;
-        for (int n=0; n < upMediaEntityList.size();n++) {
-          uploadedMedia = (EntityMedia)upMediaEntityList.elementAt(n);
-          mediaType = uploadedMedia.getMediaType();
+      try {  
+          //fetching/setting the images
+          upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+          if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
+            tinyIcon = null;
+            iconAlt = null;
+            mediaHandler = null;
+            mediaHandlerName = null;
+            for (int n=0; n < upMediaEntityList.size();n++) {
+              uploadedMedia = (EntityMedia)upMediaEntityList.elementAt(n);
+              mediaType = uploadedMedia.getMediaType();
 
-          //must of had a non-existant to_media_type entry..
-          //let's save our ass.
-          if (mediaType != null) {
-              /*
-               * grrr. why doesn't getId return an int! if It
-               * did I could just compare the value of getId and
-               * pick the biggest one. or is there
-               * another way around this that I am missing?
-               * can we make getIdasInt() or can we just have
-               * another getId() that returns an Int and the VM
-               * will handle it transparantly? -mh
-               */
-              try {
-                mediaHandlerName = mediaType.getValue("classname");
-                mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
-                mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
-              } catch (Exception e) {
-                theLog.printError("ProducerStartpage:problem in reflection: "+mediaHandlerName);
-              }
+              //must of had a non-existant to_media_type entry..
+              //let's save our ass.
+              if (mediaType != null) {
+                  mediaHandlerName = mediaType.getValue("classname");
+                  mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+                  mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
 
-              //the "best" media type to show
-              if (mediaHandler.isVideo()) {
-                tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
-                iconAlt = "Video";
-                break;
-              } else if (mediaHandler.isAudio()) {
-                tinyIcon = MirConfig.getProp("Producer.Icon.TinyAudio");
-                iconAlt = "Audio";
-              } else if (tinyIcon == null && !mediaHandler.isImage()) {
-                tinyIcon = mediaHandler.getTinyIcon();
-                iconAlt = mediaHandler.getIconAlt();
+                  //the "best" media type to show
+                  if (mediaHandler.isVideo()) {
+                    tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
+                    iconAlt = "Video";
+                    break;
+                  } else if (mediaHandler.isAudio()) {
+                    tinyIcon = MirConfig.getProp("Producer.Icon.TinyAudio");
+                    iconAlt = "Audio";
+                  } else if (tinyIcon == null && !mediaHandler.isImage()) {
+                    tinyIcon = mediaHandler.getTinyIcon();
+                    iconAlt = mediaHandler.getIconAlt();
+                  }
               }
+            }
+            //it only has image(s)
+            if (tinyIcon == null) {
+              tinyIcon = MirConfig.getProp("Producer.Icon.TinyImage");
+              iconAlt = "Image";
+            }
+
+          // uploadedMedia Entity list is empty.
+          // we only have text
+          } else {
+            tinyIcon = MirConfig.getProp("Producer.Icon.TinyText");
+            iconAlt = "Text";
           }
-        }
-        //it only has image(s)
-        if (tinyIcon == null) {
-          tinyIcon = MirConfig.getProp("Producer.Icon.TinyImage");
-          iconAlt = "Image";
-        }
 
-      // uploadedMedia Entity list is empty.
-      // we only have text
-      } else {
-        tinyIcon = MirConfig.getProp("Producer.Icon.TinyText");
-        iconAlt = "Text";
+          //mediaList = HTMLTemplateProcessor.makeSimpleList(upMediaEntityList);
+          contentHash = (SimpleHash)newsWireList.get(i);
+          contentHash.put("tiny_icon", imageRoot+"/"+tinyIcon);
+          contentHash.put("icon_alt", iconAlt);
+      } catch (Exception e) {
+        logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
+        theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
       }
-
-      try{
-        //mediaList = HTMLTemplateProcessor.makeSimpleList(upMediaEntityList);
-        contentHash = (SimpleHash)newsWireList.get(i);
-        contentHash.put("tiny_icon", imageRoot+"/"+tinyIcon);
-        contentHash.put("icon_alt", iconAlt);
-      } catch (Exception e){}
     }
 
     // get the startarticle and the related images
@@ -176,54 +166,53 @@ public class ProducerStartPage extends Producer {
     SimpleList startItemList = HTMLTemplateProcessor.makeSimpleList(entityList);
     for (int k=0; k < entityList.size();k++) {
       currentContent = (EntityContent)entityList.elementAt(k);
-      //media to content
-      currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-      if (currentMediaList!=null && currentMediaList.getCount()>=1) {
-        SimpleList mediaListAudio = new SimpleList();
-        SimpleList mediaListImages = new SimpleList();
-        SimpleList mediaListVideo = new SimpleList();
-        SimpleList mediaListOther = new SimpleList();
-        for (int n=0; n < currentMediaList.size();n++) {
-          upMedia = currentMediaList.elementAt(n);
-          upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
-          mediaType = ((EntityMedia)upMedia).getMediaType();
-          //must be a non-existant to_media_type entry..
-          if (mediaType != null) {
-            try {
-              mediaHandlerName = mediaType.getValue("classname");
-              mediaStorageName = mediaType.getValue("tablename");
-              mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
-              mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
-              mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
-              Method m = mediaStorageClass.getMethod("getInstance", null);
-              mediaStorage = (Database)m.invoke(null, null);
-              //we most likely need further info
-              upMedia = mediaStorage.selectById(upMedia.getId());
-            } catch (Exception e) {
-              theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
-            } //end catch
-            upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
-            if (upMedia.getValue("is_published") == "1") {
-              if (mediaHandler.isImage()) {
-                mediaListImages.add(upMediaSimpleHash);
-              } else if (mediaHandler.isAudio()) {
-                mediaListAudio.add(upMediaSimpleHash);
-              } else if (mediaHandler.isVideo()) {
-                mediaListVideo.add(upMediaSimpleHash);
-              } else {
-                mediaListOther.add(upMediaSimpleHash);
-              }
-            } //end if is_published
-          } //end if media_type != null
-        } //end for
-        try{
-          contentHash = (SimpleHash)startItemList.get(k);
-          contentHash.put("to_media_audio", mediaListAudio);
-          contentHash.put("to_media_images", mediaListImages);
-          contentHash.put("to_media_video", mediaListVideo);
-          contentHash.put("to_media_other", mediaListOther);
-        } catch (Exception e){}
-      } //end if currentMediaList != null
+      try {
+          //media to content
+          currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+          if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+            SimpleList mediaListAudio = new SimpleList();
+            SimpleList mediaListImages = new SimpleList();
+            SimpleList mediaListVideo = new SimpleList();
+            SimpleList mediaListOther = new SimpleList();
+            for (int n=0; n < currentMediaList.size();n++) {
+              upMedia = currentMediaList.elementAt(n);
+              upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+              mediaType = ((EntityMedia)upMedia).getMediaType();
+              //must be a non-existant to_media_type entry..
+              if (mediaType != null) {
+                mediaHandlerName = mediaType.getValue("classname");
+                mediaStorageName = mediaType.getValue("tablename");
+                mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+                mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+                mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+                Method m = mediaStorageClass.getMethod("getInstance", null);
+                mediaStorage = (Database)m.invoke(null, null);
+                //we most likely need further info
+                upMedia = mediaStorage.selectById(upMedia.getId());
+                upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+                if (upMedia.getValue("is_published") == "1") {
+                  if (mediaHandler.isImage()) {
+                    mediaListImages.add(upMediaSimpleHash);
+                  } else if (mediaHandler.isAudio()) {
+                    mediaListAudio.add(upMediaSimpleHash);
+                  } else if (mediaHandler.isVideo()) {
+                    mediaListVideo.add(upMediaSimpleHash);
+                  } else {
+                    mediaListOther.add(upMediaSimpleHash);
+                  }
+                } //end if is_published
+              } //end if media_type != null
+            } //end for
+            contentHash = (SimpleHash)startItemList.get(k);
+            contentHash.put("to_media_audio", mediaListAudio);
+            contentHash.put("to_media_images", mediaListImages);
+            contentHash.put("to_media_video", mediaListVideo);
+            contentHash.put("to_media_other", mediaListOther);
+          } //end if currentMediaList != null
+      } catch (Exception e) {
+        logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
+        theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
+      }
     } //enf for featurueList.size..
 
     // get the breaking news
@@ -240,54 +229,53 @@ public class ProducerStartPage extends Producer {
     SimpleList featureList = HTMLTemplateProcessor.makeSimpleList(entityList);
     for (int k=0; k < entityList.size();k++) {
       currentContent = (EntityContent)entityList.elementAt(k);
-      //media to content
-      currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-      if (currentMediaList!=null && currentMediaList.getCount()>=1) {
-        SimpleList mediaListAudio = new SimpleList();
-        SimpleList mediaListImages = new SimpleList();
-        SimpleList mediaListVideo = new SimpleList();
-        SimpleList mediaListOther = new SimpleList();
-        for (int n=0; n < currentMediaList.size();n++) {
-          upMedia = currentMediaList.elementAt(n);
-          upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
-          mediaType = ((EntityMedia)upMedia).getMediaType();
-          //must be a non-existant to_media_type entry..
-          if (mediaType != null) {
-            try {
-              mediaHandlerName = mediaType.getValue("classname");
-              mediaStorageName = mediaType.getValue("tablename");
-              mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
-              mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
-              mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
-              Method m = mediaStorageClass.getMethod("getInstance", null);
-              mediaStorage = (Database)m.invoke(null, null);
-              //we most likely need further info
-              upMedia = mediaStorage.selectById(upMedia.getId());
-            } catch (Exception e) {
-              theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
-            } //end catch
-            upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
-            if (upMedia.getValue("is_published") == "1") {
-              if (mediaHandler.isImage()) {
-                mediaListImages.add(upMediaSimpleHash);
-              } else if (mediaHandler.isAudio()) {
-                mediaListAudio.add(upMediaSimpleHash);
-              } else if (mediaHandler.isVideo()) {
-                mediaListVideo.add(upMediaSimpleHash);
-              } else {
-                mediaListOther.add(upMediaSimpleHash);
-              }
-            } //end if is_published
-          } //end if media_type != null
-        } //end for
-        try{
-          contentHash = (SimpleHash)featureList.get(k);
-          contentHash.put("to_media_audio", mediaListAudio);
-          contentHash.put("to_media_images", mediaListImages);
-          contentHash.put("to_media_video", mediaListVideo);
-          contentHash.put("to_media_other", mediaListOther);
-        } catch (Exception e){}
-      } //end if currentMediaList != null
+      try {
+          //media to content
+          currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+          if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+            SimpleList mediaListAudio = new SimpleList();
+            SimpleList mediaListImages = new SimpleList();
+            SimpleList mediaListVideo = new SimpleList();
+            SimpleList mediaListOther = new SimpleList();
+            for (int n=0; n < currentMediaList.size();n++) {
+              upMedia = currentMediaList.elementAt(n);
+              upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+              mediaType = ((EntityMedia)upMedia).getMediaType();
+              //must be a non-existant to_media_type entry..
+              if (mediaType != null) {
+                mediaHandlerName = mediaType.getValue("classname");
+                mediaStorageName = mediaType.getValue("tablename");
+                mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+                mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+                mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+                Method m = mediaStorageClass.getMethod("getInstance", null);
+                mediaStorage = (Database)m.invoke(null, null);
+                //we most likely need further info
+                upMedia = mediaStorage.selectById(upMedia.getId());
+                upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+                if (upMedia.getValue("is_published") == "1") {
+                  if (mediaHandler.isImage()) {
+                    mediaListImages.add(upMediaSimpleHash);
+                  } else if (mediaHandler.isAudio()) {
+                    mediaListAudio.add(upMediaSimpleHash);
+                  } else if (mediaHandler.isVideo()) {
+                    mediaListVideo.add(upMediaSimpleHash);
+                  } else {
+                    mediaListOther.add(upMediaSimpleHash);
+                  }
+                } //end if is_published
+              } //end if media_type != null
+            } //end for
+            contentHash = (SimpleHash)featureList.get(k);
+            contentHash.put("to_media_audio", mediaListAudio);
+            contentHash.put("to_media_images", mediaListImages);
+            contentHash.put("to_media_video", mediaListVideo);
+            contentHash.put("to_media_other", mediaListOther);
+          } //end if currentMediaList != null
+      } catch (Exception e) {
+        logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
+        theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
+      }
     } //enf for featurueList.size..
 
     // Zusaetzlich Informationen
index 6b3d418..0c5aa37 100755 (executable)
@@ -101,55 +101,53 @@ public class ProducerTopics extends ProducerList {
         EntityContent currentContent;
         if(entityList != null && entityList.size()==1){
           currentContent = (EntityContent)entityList.elementAt(0);
-          SimpleHash specialHash = HTMLTemplateProcessor.makeSimpleHash(currentContent);
-
-          currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-          if (currentMediaList!=null && currentMediaList.getCount()>=1) {
-            SimpleList mediaListAudio = new SimpleList();
-            SimpleList mediaListImages = new SimpleList();
-            SimpleList mediaListVideo = new SimpleList();
-            SimpleList mediaListOther = new SimpleList();
-            for (int n=0; n < currentMediaList.size();n++) {
-              upMedia = currentMediaList.elementAt(n);
-              upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
-              mediaType = ((EntityMedia)upMedia).getMediaType();
-              //must be a non-existant to_media_type entry..
-              if (mediaType != null) {
-                try {
-                  mediaHandlerName = mediaType.getValue("classname");
-                  mediaStorageName = mediaType.getValue("tablename");
-                  mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
-                  mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
-                  mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
-                  Method m = mediaStorageClass.getMethod("getInstance", null);
-                  mediaStorage = (Database)m.invoke(null, null);
-                  //we most likely need further info
-                  upMedia = mediaStorage.selectById(upMedia.getId());
-                } catch (Exception e) {
-                  theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
-                } //end catch
-                upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
-                if (upMedia.getValue("is_published") == "1") {
-                  if (mediaHandler.isImage()) {
-                    mediaListImages.add(upMediaSimpleHash);
-                  } else if (mediaHandler.isAudio()) {
-                    mediaListAudio.add(upMediaSimpleHash);
-                  } else if (mediaHandler.isVideo()) {
-                    mediaListVideo.add(upMediaSimpleHash);
-                  } else {
-                    mediaListOther.add(upMediaSimpleHash);
-                  }
-                } //end if is_published
-              } //end if media_type != null
-            } //end for
-            try{
-              specialHash.put("to_media_audio", mediaListAudio);
-              specialHash.put("to_media_images", mediaListImages);
-              specialHash.put("to_media_video", mediaListVideo);
-              specialHash.put("to_media_other", mediaListOther);
-            } catch (Exception e){}
-          } //end if currentMediaList != null
-          setAdditional("special",specialHash);
+          try { 
+              SimpleHash specialHash = HTMLTemplateProcessor.makeSimpleHash(currentContent);
+
+              currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+              if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+                SimpleList mediaListAudio = new SimpleList();
+                SimpleList mediaListImages = new SimpleList();
+                SimpleList mediaListVideo = new SimpleList();
+                SimpleList mediaListOther = new SimpleList();
+                for (int n=0; n < currentMediaList.size();n++) {
+                  upMedia = currentMediaList.elementAt(n);
+                  upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+                  mediaType = ((EntityMedia)upMedia).getMediaType();
+                  //must be a non-existant to_media_type entry..
+                  if (mediaType != null) {
+                    mediaHandlerName = mediaType.getValue("classname");
+                    mediaStorageName = mediaType.getValue("tablename");
+                    mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+                    mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+                    mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+                    Method m = mediaStorageClass.getMethod("getInstance", null);
+                    mediaStorage = (Database)m.invoke(null, null);
+                    //we most likely need further info
+                    upMedia = mediaStorage.selectById(upMedia.getId());
+                    upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+                    if (upMedia.getValue("is_published") == "1") {
+                      if (mediaHandler.isImage()) {
+                        mediaListImages.add(upMediaSimpleHash);
+                      } else if (mediaHandler.isAudio()) {
+                        mediaListAudio.add(upMediaSimpleHash);
+                      } else if (mediaHandler.isVideo()) {
+                        mediaListVideo.add(upMediaSimpleHash);
+                      } else {
+                        mediaListOther.add(upMediaSimpleHash);
+                      }
+                    } //end if is_published
+                  } //end if media_type != null
+                } //end for
+                specialHash.put("to_media_audio", mediaListAudio);
+                specialHash.put("to_media_images", mediaListImages);
+                specialHash.put("to_media_video", mediaListVideo);
+                specialHash.put("to_media_other", mediaListOther);
+              } //end if currentMediaList != null
+              setAdditional("special",specialHash);
+          } catch (Exception e) {
+            theLog.printError("ProducerTopics: problem with start special: "+currentContent.getId()+" "+e.toString());
+          }
         }
         
         //set the list of topics
index e26ef65..eef12af 100755 (executable)
@@ -45,7 +45,7 @@ public class ServletModuleContent extends ServletModule
 
   private ServletModuleContent() {
     try {
-      theLog = Logfile.getInstance(this.getClass().getName());
+      theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Content.Logfile"));
       templateListString = MirConfig.getProp("ServletModule.Content.ListTemplate");
       templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
       templateObjektString = MirConfig.getProp("ServletModule.Content.ObjektTemplate");
@@ -146,18 +146,27 @@ public class ServletModuleContent extends ServletModule
     mergeData.put("is_published", "1");
     String now = StringUtil.date2webdbDate(new GregorianCalendar());
     mergeData.put("date", new SimpleScalar(now));
-    mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
+    try {
+      mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
+    } catch (ModuleException e) {
+      theLog.printError("cannot get topics as simple list.");
+      throw new ServletModuleException(e.toString());
+    }
     try {
       mergeData.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
     } catch (Exception e) {
       theLog.printError("articletype could not be fetched.");
+      throw new ServletModuleException("articletype could not be fetched: "
+      +e.toString());
     }
     try {
       mergeData.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData());
+      mergeData.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
     } catch (Exception e) {
-      theLog.printError("language-popup could not be fetched.");
+      theLog.printError("language-popup or scwerpunk list could not be fetched.");
+      throw new ServletModuleException("language/schwerpunkt list could not be fetched.: "
+        +e.toString());
     }
-    mergeData.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
     mergeData.put("login_user", HTMLTemplateProcessor.makeSimpleHash(user));
     deliver(req, res, mergeData, templateObjektString);
   }
@@ -256,7 +265,7 @@ public class ServletModuleContent extends ServletModule
       EntityContent entContent = (EntityContent)mainModule.getById(idParam);
       entContent.attach(mediaIdParam);
     }
-    catch(ModuleException e) {
+    catch(Exception e) {
       theLog.printError("smod content :: attach :: could not get entityContent");
     }
     _showObject(idParam, req, res);
@@ -273,7 +282,7 @@ public class ServletModuleContent extends ServletModule
       EntityContent entContent = (EntityContent)mainModule.getById(cidParam);
       entContent.dettach(cidParam,midParam);
     }
-    catch(ModuleException e) {
+    catch(Exception e) {
       theLog.printError("smod content :: dettach :: could not get entityContent");
     }
     _showObject(cidParam, req, res);
index dbea216..970d777 100755 (executable)
@@ -368,6 +368,7 @@ public class ServletModuleImages extends mir.servlet.ServletModule
       }
       catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
       catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+      catch (StorageObjectException e) { throw new ServletModuleException("upload -- storageobjectexception " + e.toString());}
     }
     else // keine id
       throw new ServletModuleException("Keine id angegeben");
index 9c6d501..fe76052 100755 (executable)
@@ -158,14 +158,15 @@ public class ServletModuleOpenIndy extends ServletModule
     }
     mergeData.put("medianum",numOfMedia);
     mergeData.put("mediafields",mediaFields);
-    mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
     
     
     /** @todo popups missing */
     try{
       mergeData.put("languagePopUpData",DatabaseLanguage.getInstance().getPopupData());
+      mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
     } catch (Exception e) {
-      theLog.printError("languagePopUpData failed");
+      theLog.printError("languagePopUpData or getTopicslist failed");
+      throw new ServletModuleException("smod -- openindy -- getting language or topics failed: "+e.toString());
     }
     deliver(req, res, mergeData, postingFormTemplate);
   }
@@ -242,6 +243,8 @@ public class ServletModuleOpenIndy extends ServletModule
           theLog.printError("setting content_x_topic success");
         } catch (Exception e) {
           theLog.printError("setting content_x_topic failed");
+          contentModule.deleteById(cid);
+          throw new ServletModuleException("smod - openindy :: insposting: setting content_x_topic failed: "+e.toString());
         } //end try
       } //end if
         
@@ -329,42 +332,38 @@ public class ServletModuleOpenIndy extends ServletModule
           String MediaId;
           Entity mediaEnt = null;
           try {
-                Class mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
-                Method m = mediaStorageClass.getMethod("getInstance", null);
-                Database mediaStorage = (Database)m.invoke(null, null);
-                mediaEnt = (Entity)mediaStorage.getEntityClass().newInstance();
-                mediaEnt.setStorage(mediaStorage);
-                mediaEnt.setValues(mediaValues);
-                mediaId = mediaEnt.insert();
-
-                Class mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
-                MirMedia mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
-                //save and store the media data/metadata
-                mediaHandler.set(mpReq.getMedia(), mediaEnt,mediaTypesList.elementAt(0));
-
-                //were done with mpReq at this point, dereference it.
-                //as it contains mucho mem. -mh 01.10.2001
-                mpReq=null;
-              
-          } catch (Exception e) {
-                theLog.printError("setting uploaded_media failed: "+e.toString());
-          } //end try-catch
+            Class mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+            Method m = mediaStorageClass.getMethod("getInstance", null);
+            Database mediaStorage = (Database)m.invoke(null, null);
+            mediaEnt = (Entity)mediaStorage.getEntityClass().newInstance();
+            mediaEnt.setStorage(mediaStorage);
+            mediaEnt.setValues(mediaValues);
+            mediaId = mediaEnt.insert();
+
+            Class mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+            MirMedia mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+            //save and store the media data/metadata
+            mediaHandler.set(mpReq.getMedia(), mediaEnt,mediaTypesList.elementAt(0));
+
+            //were done with mpReq at this point, dereference it.
+            //as it contains mucho mem. -mh 01.10.2001
+            mpReq=null;
               
-          //we got this far, associate the media to the article
-          try{
-              theLog.printError("ID"+mediaId);
-              DatabaseContentToMedia.getInstance().addMedia(cid,mediaId);
-              mediaEnt.setValueForProperty("is_published","1");
-              mediaEnt.update();
-              new ProducerMedia().handle(null,null,false,false,mediaId);
-              theLog.printError("setting content_x_media success");
+            //we got this far, associate the media to the article
+            theLog.printError("ID"+mediaId);
+            mediaEnt.setValueForProperty("is_published","1");
+            mediaEnt.update();
+            new ProducerMedia().handle(null,null,false,false,mediaId);
+            DatabaseContentToMedia.getInstance().addMedia(cid,mediaId);
           } catch (Exception e) {
-              theLog.printError("setting content_x_media failed");
+            theLog.printError("setting media failed: "+e.toString());
+            contentModule.deleteById(cid);
+            throw new ServletModuleException("setting media failed: "+e.toString());
           }
 
         } else {
           contentModule.deleteById(cid);
-          theLog.printDebugInfo("Wrong file uploaded!: " + fileName);
+          theLog.printDebugInfo("Wrong file type uploaded!: " + fileName);
           throw new ServletModuleUserException("One or more files of unrecognized types");
         } // end if-else mediaTypesList.size() > 0
           
index 4320b33..ffd0ec2 100755 (executable)
@@ -42,7 +42,8 @@ public class DatabaseArticleType extends Database implements StorageObject{
                this.theTable="article_type";
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",false); }
+       public SimpleList getPopupData()
+        throws StorageObjectException { return getPopupData("name",false); }
 
 
 }
index 25ada19..869defa 100755 (executable)
@@ -42,7 +42,8 @@ public class DatabaseComment extends Database implements StorageObject{
                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 {
index 72286ff..5a76432 100755 (executable)
@@ -55,7 +55,7 @@ public class DatabaseContent extends Database implements StorageObject {
    * sets the database flag is_produced to unproduced
    */
 
-  public void setUnproduced(String where)
+  public void setUnproduced(String where) throws StorageObjectException
   {
     Connection con=null;Statement stmt=null;
     String sql = "update content set is_produced='0' where " + where;
index 8466e9e..1cf3708 100755 (executable)
@@ -105,7 +105,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
   }
 
 
-  public void setMedia(String contentId, String[] mediaId) {
+  public void setMedia(String contentId, String[] mediaId)
+    throws StorageObjectException {
     if (contentId == null){
       return;
     }
@@ -145,7 +146,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     }
   }
 
-  public void addMedia(String contentId, String mediaId) {
+  public void addMedia(String contentId, String mediaId)
+    throws StorageObjectException {
     if (contentId == null && mediaId == null) {
       return;
     }
@@ -167,7 +169,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     }
   }
   
-  public void setMedia(String contentId, String mediaId) {
+  public void setMedia(String contentId, String mediaId)
+    throws StorageObjectException {
     if (contentId == null && mediaId == null) {
       return;
     }
@@ -203,7 +206,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     }
   }
 
-  public void deleteByContentId(String contentId) {
+  public void deleteByContentId(String contentId)
+    throws StorageObjectException {
     if (contentId == null) {
       //theLog.printDebugInfo("-- delete topics failed -- no content id");
       return;
@@ -224,7 +228,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     }
   }
 
-  public void deleteByMediaId(String mediaId) {
+  public void deleteByMediaId(String mediaId)
+    throws StorageObjectException {
     if (mediaId == null) {
       //theLog.printDebugInfo("-- delete topics failed -- no topic id");
       return;
@@ -246,7 +251,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     }
   }
   
-  public void delete(String contentId, String mediaId) {
+  public void delete(String contentId, String mediaId)
+    throws StorageObjectException {
     if (mediaId == null || contentId==null) {
       theLog.printDebugInfo("-- delete media failed -- missing parameter");
       return;
@@ -269,7 +275,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
   }
 
 
-  public EntityList getContent(EntityMedia media) {
+  public EntityList getContent(EntityMedia media)
+    throws StorageObjectException {
     EntityList returnList=null;
     if (media != null) {
       String id = media.getId();
@@ -305,7 +312,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
  * Returns a EntityList with all content-objects having a relation to a media
  */
   
-public EntityList getContent() {
+public EntityList getContent()
+    throws StorageObjectException {
     EntityList returnList=null;
     
     String select = "select distinct content_id from " + theTable;
index d00fa86..944eff4 100755 (executable)
@@ -65,7 +65,8 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
    * Returns a ArrayList of Integer-Objects from a content-id.
    * @returns ArrayList
    */
-  public ArrayList getTopicsOfContent(String contentId) {
+  public ArrayList getTopicsOfContent(String contentId)
+    throws StorageObjectException {
     ArrayList returnList = new ArrayList();
     if (contentId != null) {
       String sql = "select topic_id from " + theTable + " where content_id=" + contentId;
@@ -93,7 +94,8 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
   /**
    * Set new topics
    */
-  public void setTopics(String contentId, String[] topicId) {
+  public void setTopics(String contentId, String[] topicId)
+    throws StorageObjectException {
     if (contentId == null){
       return;
     }
@@ -188,7 +190,8 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
     }
   }
 
-  public void deleteByContentId(String contentId) {
+  public void deleteByContentId(String contentId)
+    throws StorageObjectException {
     if (contentId == null) {
       //theLog.printDebugInfo("-- delete topics failed -- no content id");
       return;
@@ -209,7 +212,8 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
     }
   }
 
-  public void deleteByTopicId(String topicId) {
+  public void deleteByTopicId(String topicId)
+    throws StorageObjectException {
     if (topicId == null) {
       //theLog.printDebugInfo("-- delete topics failed -- no topic id");
       return;
@@ -231,7 +235,8 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
   }
 
 
-  public EntityList getContent(EntityTopics topic) {
+  public EntityList getContent(EntityTopics topic)
+    throws StorageObjectException {
     EntityList returnList=null;
     if (topic != null) {
       String id = topic.getId();
index 43293eb..2ae9d15 100755 (executable)
@@ -44,7 +44,7 @@ public class DatabaseFeature extends Database implements StorageObject{
                }
        }
 
-       public SimpleList getPopupData() {
+       public SimpleList getPopupData() throws StorageObjectException {
                return getPopupData("title",true);
        }
 
index 1cfb63d..ab798f1 100755 (executable)
@@ -38,7 +38,8 @@ public class DatabaseImageColor extends Database implements StorageObject{
                this.theTable="img_color";
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",true); }
+       public SimpleList getPopupData()
+        throws StorageObjectException { return getPopupData("name",true); }
 
 
 }
index 606d1c7..80eda36 100755 (executable)
@@ -38,7 +38,8 @@ public class DatabaseImageFormat extends Database implements StorageObject{
                this.theTable="img_format";
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",true); }
+       public SimpleList getPopupData()
+        throws StorageObjectException { return getPopupData("name",true); }
 
 
 }
index a4b5fb4..d67596c 100755 (executable)
@@ -38,7 +38,8 @@ public class DatabaseImageLayout extends Database implements StorageObject{
                this.theTable="img_layout";
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",true); }
+       public SimpleList getPopupData()
+        throws StorageObjectException { return getPopupData("name",true); }
 
 
 }
index 4cd78d4..2de500d 100755 (executable)
@@ -38,7 +38,8 @@ public class DatabaseImageType extends Database implements StorageObject{
                this.theTable="img_type";
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",true); }
+       public SimpleList getPopupData()
+        throws StorageObjectException { return getPopupData("name",true); }
 
 
 }
index f181f3d..ede4e15 100755 (executable)
@@ -43,7 +43,7 @@ public class DatabaseImages extends Database implements StorageObject{
                catch (Exception e) { throw new StorageObjectException(e.toString());   }
        }
 
-       public SimpleList getPopupData() {
+       public SimpleList getPopupData() throws StorageObjectException {
                return getPopupData("title",true);
        }
 
index 0f96648..6db1af0 100755 (executable)
@@ -42,7 +42,7 @@ public class DatabaseLanguage extends Database implements StorageObject{
                this.theTable="language";
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",false); }
+       public SimpleList getPopupData() throws StorageObjectException { return getPopupData("name",false); }
 
 
 }
index 63f6c68..06c75e6 100755 (executable)
@@ -206,7 +206,7 @@ public class DatabaseLinksImcs extends Database
     return  getHashData();
   }
 
-  public SimpleList getPopupData () {
+  public SimpleList getPopupData () throws StorageObjectException {
     return  getPopupData();
   }
 }
index 3094f76..c16f947 100755 (executable)
@@ -52,13 +52,14 @@ public class DatabaseMedia extends Database implements StorageObject{
    * returns the comments that belong to the article (via entityrelation)
    * where db-flag is_published is true
    */
-  public Entity getMediaType(Entity ent) {
+  public Entity getMediaType(Entity ent) throws StorageObjectException {
     Entity type=null;
     try {
       type = relationMediaType.getOne(ent);
     }
     catch (StorageObjectException e) {
       theLog.printError("DatabaseUploadedMedia :: failed to get media_type");
+      throw new StorageObjectException("DatabaseUploadedMedia :"+e.toString());
     }
     return type;
   }
index e2f81c6..2cf9bff 100755 (executable)
@@ -42,7 +42,7 @@ public class DatabaseMediafolder extends Database implements StorageObject{
                this.theTable="media_folder";
        }
 
-       public SimpleList getPopupData() {
+       public SimpleList getPopupData() throws StorageObjectException {
                return getPopupData("name",true);
        }
 
index fbdf010..71255cc 100755 (executable)
@@ -38,7 +38,8 @@ public class DatabaseRights extends Database implements StorageObject{
                this.theTable="rights";
        }
 
-       public SimpleList getPopupData() { return getPopupData("name",true); }
+       public SimpleList getPopupData() throws StorageObjectException
+    { return getPopupData("name",true); }
 
 
 }
index 5804b88..481b844 100755 (executable)
@@ -44,7 +44,7 @@ public class DatabaseTopics extends Database implements StorageObject{
 
        }
 
-       public SimpleList getPopupData() {
+       public SimpleList getPopupData() throws StorageObjectException {
                return getPopupData("title",true);
        }
 
index dd03a1b..8f8c211 100755 (executable)
@@ -42,7 +42,7 @@ public class DatabaseUsers extends Database implements StorageObject{
                }
        }
 
-       public SimpleList getPopupData() {
+       public SimpleList getPopupData() throws StorageObjectException {
                return getPopupData("login",true);
        }
 }
index 5c71b3e..a53c2c2 100755 (executable)
@@ -43,7 +43,7 @@ public class DatabaseVideos extends Database implements StorageObject{
                catch (Exception e) { throw new StorageObjectException(e.toString());   }
        }
 
-       public SimpleList getPopupData() {
+       public SimpleList getPopupData() throws StorageObjectException {
                return getPopupData("title",true);
        }