fixing scaling images -> nullpointer, patch by yossarian
[mir.git] / source / mircoders / storage / DatabaseCommentToMedia.java
index 9f8807c..8d6f0a1 100755 (executable)
@@ -37,17 +37,9 @@ import java.util.ArrayList;
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.StorageObjectFailure;
+import mir.storage.DatabaseFailure;
 import mircoders.entity.EntityUploadedMedia;
 
-/**
- * <b>implements abstract DB connection to the comment_x_media SQL table
- *
- * @author RK, mir-coders group
- * @version $Id: DatabaseCommentToMedia.java,v 1.3.2.10 2005/02/10 16:22:22 rhindes Exp $
- *
- */
-
 public class DatabaseCommentToMedia extends Database {
 
   private static DatabaseCommentToMedia instance;
@@ -68,7 +60,7 @@ public class DatabaseCommentToMedia extends Database {
   }
 
   public void addMedia(String commentId, String mediaId) throws
-      StorageObjectFailure {
+      DatabaseFailure {
     if (commentId == null && mediaId == null) {
       return;
     }
@@ -87,7 +79,7 @@ public class DatabaseCommentToMedia extends Database {
     }
     catch (Exception e) {
       logger.error("-- add media failed -- insert");
-      throw new StorageObjectFailure("-- add media failed -- insert ", e);
+      throw new DatabaseFailure("-- add media failed -- insert ", e);
     }
     finally {
       freeConnection(con, stmt);
@@ -95,7 +87,7 @@ public class DatabaseCommentToMedia extends Database {
   }
 
   public void setMedia(String commentId, String mediaId) throws
-      StorageObjectFailure {
+      DatabaseFailure {
     if (commentId == null && mediaId == null) {
       return;
     }
@@ -112,7 +104,7 @@ public class DatabaseCommentToMedia extends Database {
     }
     catch (Exception e) {
       logger.error("-- set media failed -- delete");
-      throw new StorageObjectFailure("-- set media failed -- delete ", e);
+      throw new DatabaseFailure("-- set media failed -- delete ", e);
     }
     finally {
       freeConnection(con, stmt);
@@ -131,14 +123,14 @@ public class DatabaseCommentToMedia extends Database {
     }
     catch (Exception e) {
       logger.error("-- set media failed -- insert");
-      throw new StorageObjectFailure("-- set media failed -- insert ", e);
+      throw new DatabaseFailure("-- set media failed -- insert ", e);
     }
     finally {
       freeConnection(con, stmt);
     }
   }
 
-  public void deleteByCommentId(String commentId) throws StorageObjectFailure {
+  public void deleteByCommentId(String commentId) throws DatabaseFailure {
     if (commentId == null) {
       //theLog.printDebugInfo("-- delete topics failed -- no comment id");
       return;
@@ -156,7 +148,7 @@ public class DatabaseCommentToMedia extends Database {
     }
     catch (Exception e) {
       logger.error("-- delete by commentId failed  ");
-      throw new StorageObjectFailure(
+      throw new DatabaseFailure(
           "-- delete by comment id failed -- delete ", e);
     }
     finally {
@@ -164,7 +156,7 @@ public class DatabaseCommentToMedia extends Database {
     }
   }
 
-  public void deleteByMediaId(String mediaId) throws StorageObjectFailure {
+  public void deleteByMediaId(String mediaId) throws DatabaseFailure {
     if (mediaId == null) {
       //theLog.printDebugInfo("-- delete topics failed -- no topic id");
       return;
@@ -183,7 +175,7 @@ public class DatabaseCommentToMedia extends Database {
     }
     catch (Exception e) {
       logger.error("-- delete media failed ");
-      throw new StorageObjectFailure("-- delete by media id failed -- ", e);
+      throw new DatabaseFailure("-- delete by media id failed -- ", e);
     }
     finally {
       freeConnection(con, stmt);
@@ -191,7 +183,7 @@ public class DatabaseCommentToMedia extends Database {
   }
 
   public void delete(String commentId, String mediaId) throws
-      StorageObjectFailure {
+      DatabaseFailure {
     if (mediaId == null || commentId == null) {
       logger.debug("-- delete media failed -- missing parameter");
       return;
@@ -211,7 +203,7 @@ public class DatabaseCommentToMedia extends Database {
     }
     catch (Exception e) {
       logger.error("-- delete comment_x_media failed ");
-      throw new StorageObjectFailure("-- delete comment_x_media failed -- ", e);
+      throw new DatabaseFailure("-- delete comment_x_media failed -- ", e);
     }
     finally {
       freeConnection(con, stmt);
@@ -219,7 +211,7 @@ public class DatabaseCommentToMedia extends Database {
   }
 
   public EntityList getComment(EntityUploadedMedia media) throws
-      StorageObjectFailure {
+      DatabaseFailure {
 
     EntityList returnList = null;
     if (media != null) {
@@ -236,7 +228,7 @@ public class DatabaseCommentToMedia extends Database {
       }
       catch (Exception e) {
         logger.error("-- get comment failed");
-        throw new StorageObjectFailure("-- get comment failed -- ", e);
+        throw new DatabaseFailure("-- get comment failed -- ", e);
       }
     }
     return returnList;
@@ -247,7 +239,7 @@ public class DatabaseCommentToMedia extends Database {
    *  a relation to a media
    */
 
-  public EntityList getComment() throws StorageObjectFailure {
+  public EntityList getComment() throws DatabaseFailure {
     EntityList returnList = null;
 
     ArrayList extraTables = new ArrayList();
@@ -261,7 +253,7 @@ public class DatabaseCommentToMedia extends Database {
     }
     catch (Exception e) {
       logger.error("-- get comment failed");
-      throw new StorageObjectFailure("-- get comment failed -- ", e);
+      throw new DatabaseFailure("-- get comment failed -- ", e);
     }
     return returnList;