From aa0e25363f8099782b07ad71a627da64ef65ba09 Mon Sep 17 00:00:00 2001 From: zapata Date: Sat, 3 May 2003 00:21:21 +0000 Subject: [PATCH] several fixes, mostly in the anti-abuse system --- etc/producer/producers.xml | 3 +- source/mir/entity/Entity.java | 52 ++++++---------------- source/mir/storage/Database.java | 33 +++++++------- source/mircoders/global/Abuse.java | 6 ++- .../localizer/MirAdminInterfaceLocalizer.java | 4 +- .../basic/MirBasicAdminInterfaceLocalizer.java | 18 +++++--- .../basic/MirBasicArticlePostingHandler.java | 2 + .../basic/MirBasicCommentPostingHandler.java | 2 + .../basic/MirBasicPostingSessionHandler.java | 38 ++++++++++------ source/mircoders/media/ImageProcessor.java | 7 --- source/mircoders/module/ModuleTopics.java | 14 +++--- .../mircoders/servlet/ServletModuleLocalizer.java | 8 +++- source/mircoders/storage/DatabaseArticleType.java | 15 +++---- source/mircoders/storage/DatabaseAudio.java | 18 ++++---- source/mircoders/storage/DatabaseBreaking.java | 18 ++++---- source/mircoders/storage/DatabaseComment.java | 23 ++++------ .../mircoders/storage/DatabaseCommentStatus.java | 23 ++++------ .../mircoders/storage/DatabaseCommentToMedia.java | 25 +++++------ source/mircoders/storage/DatabaseContent.java | 18 ++++---- .../mircoders/storage/DatabaseContentToMedia.java | 25 +++++------ .../mircoders/storage/DatabaseContentToTopics.java | 23 ++++------ source/mircoders/storage/DatabaseImageColor.java | 15 +++---- source/mircoders/storage/DatabaseImageFormat.java | 15 +++---- source/mircoders/storage/DatabaseImageLayout.java | 15 +++---- source/mircoders/storage/DatabaseImageType.java | 15 +++---- source/mircoders/storage/DatabaseImages.java | 15 +++---- source/mircoders/storage/DatabaseLanguage.java | 15 +++---- source/mircoders/storage/DatabaseMedia.java | 15 +++---- source/mircoders/storage/DatabaseMediaType.java | 15 +++---- source/mircoders/storage/DatabaseMediafolder.java | 15 +++---- source/mircoders/storage/DatabaseMessages.java | 15 +++---- source/mircoders/storage/DatabaseOther.java | 15 +++---- source/mircoders/storage/DatabaseRights.java | 18 ++++---- source/mircoders/storage/DatabaseTopics.java | 18 ++++---- .../mircoders/storage/DatabaseUploadedMedia.java | 23 ++++------ source/mircoders/storage/DatabaseUsers.java | 18 ++++---- source/mircoders/storage/DatabaseVideo.java | 15 +++---- 37 files changed, 285 insertions(+), 347 deletions(-) diff --git a/etc/producer/producers.xml b/etc/producer/producers.xml index 0027d3ec..13bb6cb5 100755 --- a/etc/producer/producers.xml +++ b/etc/producer/producers.xml @@ -56,6 +56,7 @@ + diff --git a/source/mir/entity/Entity.java b/source/mir/entity/Entity.java index 4cb42993..e4d89272 100755 --- a/source/mir/entity/Entity.java +++ b/source/mir/entity/Entity.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ package mir.entity; @@ -51,7 +51,7 @@ import freemarker.template.TemplateModelRoot; * an entity. Entities are used to represent rows of a database table.

* Interfacing TemplateHashModel and TemplateModelRoot to be freemarker compliant * - * @version $Id: Entity.java,v 1.20 2003/04/21 12:42:46 idfx Exp $ + * @version $Id: Entity.java,v 1.21 2003/05/03 00:21:22 zapata Exp $ * @author rk * */ @@ -60,7 +60,6 @@ public class Entity implements TemplateHashModel, TemplateModelRoot { protected static MirPropertiesConfiguration configuration; - private boolean changed; protected Map theValuesHash; // tablekey / value protected StorageObject theStorageObject; protected List streamedInput = null; @@ -77,8 +76,6 @@ public class Entity implements TemplateHashModel, TemplateModelRoot public Entity() { logger = new LoggerWrapper("Entity"); - - this.changed = false; } /** @@ -98,7 +95,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Sets the values of the Entity. + * Sets the values of the Entity. (Only to be called by the Storage Object) * @param theStringValues Map containing the new values of the Entity */ @@ -113,14 +110,6 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Returns whether the content of the Entity has changed. - * @return true wenn ja, sonst false - */ - public boolean changed() { - return changed; - } - - /** * Returns the primary key of the Entity. * @return String Id */ @@ -129,7 +118,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Defines the primary key of the Entity + * Defines the primary key of the Entity (only to be set by the StorageObject) * @param id */ public void setId(String id) { @@ -173,7 +162,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot public String insert() throws StorageObjectExc { logger.debug("Entity: trying to insert ..."); if (theStorageObject != null) { - return theStorageObject.insert( (Entity)this); + return theStorageObject.insert(this); } else throw new StorageObjectExc("theStorageObject == null!"); @@ -184,7 +173,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot * @exception StorageObjectException */ public void update() throws StorageObjectFailure { - theStorageObject.update( (Entity)this); + theStorageObject.update(this); } /** @@ -196,13 +185,11 @@ public class Entity implements TemplateHashModel, TemplateModelRoot */ public void setValueForProperty(String theProp, String theValue) throws StorageObjectFailure { - this.changed = true; if (isField(theProp)) theValuesHash.put(theProp, theValue); else { logger.warn("Entity.setValueForProperty: Property not found: " + theProp + " (" + theValue + ")"); } - } /** @@ -232,18 +219,6 @@ public class Entity implements TemplateHashModel, TemplateModelRoot return theStorageObject.getLabels(); } - /** - * Returns a Map with all values of the Entity. - * @return Map with field name as key and the corresponding values - * - * @deprecated This method is deprecated and will be deleted in the next release. - * Entity interfaces freemarker.template.TemplateHashModel now and can - * be used in the same way as SimpleHash. - */ - public Map getValues() { - logger.warn("using deprecated Entity.getValues() - a waste of resources"); - return theValuesHash; - } /** * Returns an ArrayList with all database fields that can @@ -270,8 +245,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot return theStorageObject.getFields().contains(fieldName); } - protected void throwStorageObjectFailure(Throwable e, String wo) throws - StorageObjectFailure { + protected void throwStorageObjectFailure(Throwable e, String wo) throws StorageObjectFailure { logger.error(e.toString() + " function: " + wo); e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); diff --git a/source/mir/storage/Database.java b/source/mir/storage/Database.java index eefa88b9..7c89df43 100755 --- a/source/mir/storage/Database.java +++ b/source/mir/storage/Database.java @@ -76,7 +76,7 @@ import mir.util.JDBCStringRoutines; * Treiber, Host, User und Passwort, ueber den der Zugriff auf die * Datenbank erfolgt. * - * @version $Id: Database.java,v 1.41 2003/05/02 01:02:45 zapata Exp $ + * @version $Id: Database.java,v 1.42 2003/05/03 00:21:22 zapata Exp $ * @author rk * */ @@ -109,7 +109,6 @@ public class Database implements StorageObject { protected ArrayList metadataNotNullFields; protected int[] metadataTypes; protected Class theEntityClass; - protected StorageObject myselfDatabase; protected SimpleList popupCache = null; protected boolean hasPopupCache = false; protected SimpleHash hashCache = null; @@ -725,7 +724,7 @@ public class Database implements StorageObject { if (theEntityClass != null) { returnEntity = (Entity) theEntityClass.newInstance(); returnEntity.setValues(theResultHash); - returnEntity.setStorage(myselfDatabase); + returnEntity.setStorage(this); if (returnEntity instanceof StorableObject) { logger.debug("CACHE: ( in) " + returnEntity.getId() + " :" + theTable); @@ -754,8 +753,7 @@ public class Database implements StorageObject { } /** - * insert-Operator: f?gt eine Entity in die Tabelle ein. Eine Spalte WEBDB_CREATE - * wird automatisch mit dem aktuellen Datum gefuellt. + * Inserts an entity into the database. * * @param theEntity * @return der Wert des Primary-keys der eingef?gten Entity @@ -795,7 +793,8 @@ public class Database implements StorageObject { if (aField.equals("webdb_create") || aField.equals("webdb_lastchange")) { aValue = "NOW()"; - } else { + } + else { if ((streamedInput != null) && streamedInput.contains(aField)) { aValue = "?"; } else { @@ -851,9 +850,7 @@ public class Database implements StorageObject { return null; } - pstmt = - con.prepareStatement(theAdaptor.getLastInsertSQL( - (Database) myselfDatabase)); + pstmt = con.prepareStatement(theAdaptor.getLastInsertSQL(this)); ResultSet rs = pstmt.executeQuery(); rs.next(); @@ -878,8 +875,7 @@ public class Database implements StorageObject { } /** - * update-Operator: aktualisiert eine Entity. Eine Spalte WEBDB_LASTCHANGE - * wird automatisch mit dem aktuellen Datum gefuellt. + * Updates an entity in the database * * @param theEntity */ @@ -975,9 +971,8 @@ public class Database implements StorageObject { } sql.append(" where id=").append(id); + logger.debug("UPDATE: " + sql); - //theLog.printInfo("UPDATE: " + sql); - // execute sql try { con = getPooledCon(); con.setAutoCommit(false); @@ -992,12 +987,15 @@ public class Database implements StorageObject { } pstmt.executeUpdate(); - } catch (SQLException sqe) { + } + catch (SQLException sqe) { throwSQLException(sqe, "update"); - } finally { + } + finally { try { con.setAutoCommit(true); - } catch (Exception e) { + } + catch (Exception e) { ; } @@ -1483,8 +1481,7 @@ public class Database implements StorageObject { * @param wo Funktonsname, in der die SQLException geworfen wurde * @exception StorageObjectException */ - protected void throwSQLException(SQLException sqe, String aFunction) - throws StorageObjectFailure { + protected void throwSQLException(SQLException sqe, String aFunction) throws StorageObjectFailure { String state = ""; String message = ""; int vendor = 0; diff --git a/source/mircoders/global/Abuse.java b/source/mircoders/global/Abuse.java index 41b31f8c..b0e28d50 100755 --- a/source/mircoders/global/Abuse.java +++ b/source/mircoders/global/Abuse.java @@ -207,6 +207,7 @@ public class Abuse { MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction); if (checkCookie(Arrays.asList(cookies)) || checkIpFilter(address) || checkRegExpFilter(aComment)) { + logger.debug("performing operation " + operation.getName()); operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment)); setCookie(aResponse); } @@ -238,12 +239,15 @@ public class Abuse { address = request.getRemoteAddr(); cookies = request.getCookies(); } + else + logger.debug("no request available! " + aRequest.getClass().getName()); logArticle(address, anArticle.getId(), new Date(), browser); - MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction); + MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleArticleOperationForName(commentBlockAction); if (checkCookie(Arrays.asList(cookies)) || checkIpFilter(address) || checkRegExpFilter(anArticle)) { + logger.debug("performing operation " + operation.getName()); operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle)); setCookie(aResponse); } diff --git a/source/mircoders/localizer/MirAdminInterfaceLocalizer.java b/source/mircoders/localizer/MirAdminInterfaceLocalizer.java index cc859fd0..25fc4882 100755 --- a/source/mircoders/localizer/MirAdminInterfaceLocalizer.java +++ b/source/mircoders/localizer/MirAdminInterfaceLocalizer.java @@ -82,7 +82,7 @@ public interface MirAdminInterfaceLocalizer { public interface MirSimpleEntityOperation { public String getName(); - public boolean isAvailable(EntityAdapter anEntity); - public void perform(EntityAdapter aUser, EntityAdapter anEntity); + public boolean isAvailable(EntityAdapter anEntity) throws MirLocalizerExc, MirLocalizerFailure; + public void perform(EntityAdapter aUser, EntityAdapter anEntity) throws MirLocalizerExc, MirLocalizerFailure; } } \ No newline at end of file diff --git a/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java b/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java index 97a3f285..7196ea11 100755 --- a/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java @@ -34,7 +34,7 @@ import java.text.SimpleDateFormat; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Vector; import mir.entity.Entity; @@ -139,18 +139,19 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz } }; - public void perform(EntityAdapter aUser, EntityAdapter anEntity) { + public void perform(EntityAdapter aUser, EntityAdapter anEntity) throws MirLocalizerExc, MirLocalizerFailure { Entity entity = anEntity.getEntity(); try { performModification(aUser, entity); entity.update(); } catch (Throwable t) { + throw new MirLocalizerFailure(t); } }; protected abstract boolean isAvailable(Entity anEntity) throws StorageObjectFailure ; - protected abstract void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure ; + protected abstract void performModification(EntityAdapter aUser, Entity anEntity) throws MirLocalizerExc, MirLocalizerFailure ; } public static abstract class CommentModifyingOperation extends EntityModifyingOperation { @@ -297,19 +298,22 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz protected static class ChangeArticleFieldOperation extends ArticleModifyingOperation { private String field; - private String oldValue; + private Set oldValues; private String newValue; - public ChangeArticleFieldOperation(String aName, String aField, String anOldValue, String aNewValue, boolean aLogOperation) { + public ChangeArticleFieldOperation(String aName, String aField, String anOldValues[], String aNewValue, boolean aLogOperation) { super(aName, aLogOperation); field = aField; newValue = aNewValue; - oldValue = anOldValue; + oldValues = new HashSet(Arrays.asList(anOldValues)); + } + public ChangeArticleFieldOperation(String aName, String aField, String anOldValue, String aNewValue, boolean aLogOperation) { + this(aName, aField, new String[] {anOldValue}, aNewValue, aLogOperation); } protected boolean isAvailable(EntityContent anArticle) { - return anArticle.getValue(field) != null && anArticle.getValue(field).equals(oldValue); + return anArticle.getValue(field) != null && oldValues.contains(anArticle.getValue(field)); } protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure { diff --git a/source/mircoders/localizer/basic/MirBasicArticlePostingHandler.java b/source/mircoders/localizer/basic/MirBasicArticlePostingHandler.java index 3923bcb7..fa132980 100755 --- a/source/mircoders/localizer/basic/MirBasicArticlePostingHandler.java +++ b/source/mircoders/localizer/basic/MirBasicArticlePostingHandler.java @@ -91,6 +91,8 @@ public class MirBasicArticlePostingHandler extends MirBasicPostingSessionHandler } public void validate(List aResults, Request aRequest, Session aSession) throws SessionExc, SessionFailure { + super.validate(aResults, aRequest, aSession); + testFieldEntered(aRequest, "title", "validationerror.missing", aResults); testFieldEntered(aRequest, "description", "validationerror.missing", aResults); testFieldEntered(aRequest, "creator", "validationerror.missing", aResults); diff --git a/source/mircoders/localizer/basic/MirBasicCommentPostingHandler.java b/source/mircoders/localizer/basic/MirBasicCommentPostingHandler.java index 6b05ddb3..7707dffc 100755 --- a/source/mircoders/localizer/basic/MirBasicCommentPostingHandler.java +++ b/source/mircoders/localizer/basic/MirBasicCommentPostingHandler.java @@ -87,6 +87,8 @@ public class MirBasicCommentPostingHandler extends MirBasicPostingSessionHandler } public void validate(List aResults, Request aRequest, Session aSession) throws SessionExc, SessionFailure { + super.validate(aResults, aRequest, aSession); + testFieldEntered(aRequest, "title", "validationerror.missing", aResults); testFieldEntered(aRequest, "description", "validationerror.missing", aResults); testFieldEntered(aRequest, "creator", "validationerror.missing", aResults); diff --git a/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java b/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java index e89d1192..08a7f570 100755 --- a/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java +++ b/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java @@ -35,10 +35,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; -import java.util.*; +import java.util.Vector; import mir.config.MirPropertiesConfiguration; -import mir.entity.Entity; import mir.log.LoggerWrapper; import mir.session.Request; import mir.session.Response; @@ -49,14 +48,8 @@ import mir.session.SessionHandler; import mir.session.UploadedFile; import mir.storage.StorageObject; import mir.util.ExceptionFunctions; -import mircoders.entity.EntityComment; import mircoders.global.MirGlobal; -import mircoders.media.MediaUploadProcessor; -import mircoders.module.ModuleComment; -import mircoders.storage.DatabaseComment; -import mircoders.storage.DatabaseCommentToMedia; -import mircoders.storage.DatabaseContent; -import mircoders.module.*; +import mircoders.module.ModuleMediaType; /** * @@ -103,12 +96,18 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler { } public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - if (aSession.getAttribute("initialRequest")==null) { - initialRequest(aRequest, aSession, aResponse); - aSession.setAttribute("initialRequest", "no"); + if (MirGlobal.abuse().getOpenPostingDisabled()) { + makeOpenPostingDisabledResponse(aRequest, aSession, aResponse); + aSession.terminate(); } else { - subsequentRequest(aRequest, aSession, aResponse); + if (aSession.getAttribute("initialRequest") == null) { + initialRequest(aRequest, aSession, aResponse); + aSession.setAttribute("initialRequest", "no"); + } + else { + subsequentRequest(aRequest, aSession, aResponse); + } } }; @@ -218,6 +217,10 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler { } }; + protected void makeOpenPostingDisabledResponse(Request aRequest, Session aSession, Response aResponse) { + aResponse.setResponseGenerator(configuration.getString("ServletModule.OpenIndy.PostingDisabledTemplate")); + } + protected void preProcessRequest(Request aRequest, Session aSession) throws SessionExc, SessionFailure { }; public void processUploadedFile(Request aRequest, Session aSession, UploadedFile aFile) throws SessionExc, SessionFailure { @@ -244,6 +247,15 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler { } protected void validate(List aResults, Request aRequest, Session aSession) throws SessionExc, SessionFailure { + String password = (String) aSession.getAttribute("password"); + + if (password!=null) { + String submittedPassword= aRequest.getParameter("password").trim(); + + if (!password.equals(submittedPassword)) { + aResults.add(new ValidationError("password", "passwordmismatch")); + } + } } /** diff --git a/source/mircoders/media/ImageProcessor.java b/source/mircoders/media/ImageProcessor.java index 22b46096..40f152e6 100755 --- a/source/mircoders/media/ImageProcessor.java +++ b/source/mircoders/media/ImageProcessor.java @@ -85,17 +85,10 @@ public class ImageProcessor { ImageLayout layout = new ImageLayout(); nrComponents = tempImage.getColorModel().getNumColorComponents(); -/* System.out.println("blaat sample model = " + tempImage.getSampleModel().toString()); - System.out.println("blaat color model = " + tempImage.getColorModel().toString()); - System.out.println("blaat nr color components = " + tempImage.getColorModel().getNumColorComponents()); - System.out.println("blaat nr components = " + tempImage.getColorModel().getNumComponents()); - */ bands = new int[nrComponents]; for (int i=0; iimplements abstract DB connection to the comment_x_media SQL table * * @author RK, mir-coders group - * @version $Id: DatabaseCommentToMedia.java,v 1.2 2003/04/21 12:42:47 idfx Exp $ + * @version $Id: DatabaseCommentToMedia.java,v 1.3 2003/05/03 00:21:22 zapata Exp $ * */ @@ -55,14 +55,9 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{ private static DatabaseCommentToMedia instance; - public static DatabaseCommentToMedia getInstance() { + public static synchronized DatabaseCommentToMedia getInstance() { if (instance == null) { - synchronized (DatabaseCommentToMedia.class) { - if (instance == null) { - instance = new DatabaseCommentToMedia(); - instance.myselfDatabase = instance; - } - } + instance = new DatabaseCommentToMedia(); } return instance; } diff --git a/source/mircoders/storage/DatabaseContent.java b/source/mircoders/storage/DatabaseContent.java index b3327785..a5fc5a48 100755 --- a/source/mircoders/storage/DatabaseContent.java +++ b/source/mircoders/storage/DatabaseContent.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -57,12 +57,10 @@ public class DatabaseContent extends Database implements StorageObject { // the following *has* to be sychronized cause this static method // could get preemted and we could end up with 2 instances of DatabaseFoo. // see the "Singletons with needles and thread" article at JavaWorld -mh - public synchronized static DatabaseContent getInstance() - throws StorageObjectFailure { + public synchronized static DatabaseContent getInstance() { if (instance == null ) { instance = new DatabaseContent(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseContentToMedia.java b/source/mircoders/storage/DatabaseContentToMedia.java index c06f91ae..8cb8a561 100755 --- a/source/mircoders/storage/DatabaseContentToMedia.java +++ b/source/mircoders/storage/DatabaseContentToMedia.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -47,7 +47,7 @@ import mircoders.entity.EntityUploadedMedia; * implements abstract DB connection to the content_x_media SQL table * * @author RK, mir-coders group - * @version $Id: DatabaseContentToMedia.java,v 1.18 2003/04/21 12:42:48 idfx Exp $ + * @version $Id: DatabaseContentToMedia.java,v 1.19 2003/05/03 00:21:22 zapata Exp $ * */ @@ -55,14 +55,9 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ private static DatabaseContentToMedia instance; - public static DatabaseContentToMedia getInstance() { + public synchronized static DatabaseContentToMedia getInstance() { if (instance == null) { - synchronized (DatabaseContentToMedia.class) { - if (instance == null) { - instance = new DatabaseContentToMedia(); - instance.myselfDatabase = instance; - } - } + instance = new DatabaseContentToMedia(); } return instance; } diff --git a/source/mircoders/storage/DatabaseContentToTopics.java b/source/mircoders/storage/DatabaseContentToTopics.java index 52e6dbd2..7475e909 100755 --- a/source/mircoders/storage/DatabaseContentToTopics.java +++ b/source/mircoders/storage/DatabaseContentToTopics.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -57,14 +57,9 @@ public class DatabaseContentToTopics extends Database implements StorageObject{ private static DatabaseContentToTopics instance; - public static DatabaseContentToTopics getInstance() { + public synchronized static DatabaseContentToTopics getInstance() { if (instance == null) { - synchronized (DatabaseContentToTopics.class) { - if (instance == null) { - instance = new DatabaseContentToTopics(); - instance.myselfDatabase = instance; - } - } + instance = new DatabaseContentToTopics(); } return instance; } diff --git a/source/mircoders/storage/DatabaseImageColor.java b/source/mircoders/storage/DatabaseImageColor.java index 90c7844b..f857d708 100755 --- a/source/mircoders/storage/DatabaseImageColor.java +++ b/source/mircoders/storage/DatabaseImageColor.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -53,7 +53,6 @@ public class DatabaseImageColor extends Database implements StorageObject{ public synchronized static DatabaseImageColor getInstance() { if (instance == null) { instance = new DatabaseImageColor(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseImageFormat.java b/source/mircoders/storage/DatabaseImageFormat.java index ee0dd72d..310987dd 100755 --- a/source/mircoders/storage/DatabaseImageFormat.java +++ b/source/mircoders/storage/DatabaseImageFormat.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -53,7 +53,6 @@ public class DatabaseImageFormat extends Database implements StorageObject{ public synchronized static DatabaseImageFormat getInstance() { if (instance == null) { instance = new DatabaseImageFormat(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseImageLayout.java b/source/mircoders/storage/DatabaseImageLayout.java index 7b042228..1fac5a32 100755 --- a/source/mircoders/storage/DatabaseImageLayout.java +++ b/source/mircoders/storage/DatabaseImageLayout.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -53,7 +53,6 @@ public class DatabaseImageLayout extends Database implements StorageObject{ public synchronized static DatabaseImageLayout getInstance() { if (instance == null) { instance = new DatabaseImageLayout(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseImageType.java b/source/mircoders/storage/DatabaseImageType.java index f8875e4d..377f1f73 100755 --- a/source/mircoders/storage/DatabaseImageType.java +++ b/source/mircoders/storage/DatabaseImageType.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; @@ -50,7 +50,6 @@ public class DatabaseImageType extends Database implements StorageObject{ public synchronized static DatabaseImageType getInstance() { if (instance == null) { instance = new DatabaseImageType(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseImages.java b/source/mircoders/storage/DatabaseImages.java index 7e1f030d..d525df4a 100755 --- a/source/mircoders/storage/DatabaseImages.java +++ b/source/mircoders/storage/DatabaseImages.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -57,7 +57,6 @@ public class DatabaseImages extends Database implements StorageObject{ public synchronized static DatabaseImages getInstance() { if (instance == null) { instance = new DatabaseImages(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseLanguage.java b/source/mircoders/storage/DatabaseLanguage.java index 17d7496d..e0b15bc2 100755 --- a/source/mircoders/storage/DatabaseLanguage.java +++ b/source/mircoders/storage/DatabaseLanguage.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -58,7 +58,6 @@ public class DatabaseLanguage extends Database implements StorageObject{ StorageObjectFailure { if (instance == null) { instance = new DatabaseLanguage(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseMedia.java b/source/mircoders/storage/DatabaseMedia.java index 16d10025..ed653a56 100755 --- a/source/mircoders/storage/DatabaseMedia.java +++ b/source/mircoders/storage/DatabaseMedia.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -55,7 +55,6 @@ public class DatabaseMedia extends Database implements StorageObject{ public synchronized static DatabaseMedia getInstance() { if (instance == null) { instance = new DatabaseMedia(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseMediaType.java b/source/mircoders/storage/DatabaseMediaType.java index 157caf91..398acb22 100755 --- a/source/mircoders/storage/DatabaseMediaType.java +++ b/source/mircoders/storage/DatabaseMediaType.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; @@ -51,7 +51,6 @@ public class DatabaseMediaType extends Database implements StorageObject{ public synchronized static DatabaseMediaType getInstance() { if (instance == null) { instance = new DatabaseMediaType(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseMediafolder.java b/source/mircoders/storage/DatabaseMediafolder.java index d9eed43f..01be6866 100755 --- a/source/mircoders/storage/DatabaseMediafolder.java +++ b/source/mircoders/storage/DatabaseMediafolder.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -57,7 +57,6 @@ public class DatabaseMediafolder extends Database implements StorageObject{ public synchronized static DatabaseMediafolder getInstance() { if (instance == null) { instance = new DatabaseMediafolder(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseMessages.java b/source/mircoders/storage/DatabaseMessages.java index 464e232b..81ad6968 100755 --- a/source/mircoders/storage/DatabaseMessages.java +++ b/source/mircoders/storage/DatabaseMessages.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -51,7 +51,6 @@ public class DatabaseMessages extends Database implements StorageObject{ public synchronized static DatabaseMessages getInstance() { if (instance == null) { instance = new DatabaseMessages(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseOther.java b/source/mircoders/storage/DatabaseOther.java index cec04983..22f48758 100755 --- a/source/mircoders/storage/DatabaseOther.java +++ b/source/mircoders/storage/DatabaseOther.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; @@ -55,7 +55,6 @@ public class DatabaseOther extends Database implements StorageObject{ public synchronized static DatabaseOther getInstance() { if (instance == null) { instance = new DatabaseOther(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseRights.java b/source/mircoders/storage/DatabaseRights.java index e0f59956..11914a85 100755 --- a/source/mircoders/storage/DatabaseRights.java +++ b/source/mircoders/storage/DatabaseRights.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -48,11 +48,9 @@ public class DatabaseRights extends Database implements StorageObject{ // the following *has* to be sychronized cause this static method // could get preemted and we could end up with 2 instances of DatabaseFoo.. // see the "Singletons with needles and thread" article at JavaWorld -mh - public synchronized static DatabaseRights getInstance() throws - StorageObjectFailure { + public synchronized static DatabaseRights getInstance() { if (instance == null) { instance = new DatabaseRights(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseTopics.java b/source/mircoders/storage/DatabaseTopics.java index f3922614..2b502cb3 100755 --- a/source/mircoders/storage/DatabaseTopics.java +++ b/source/mircoders/storage/DatabaseTopics.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -49,11 +49,9 @@ public class DatabaseTopics extends Database implements StorageObject{ // the following *has* to be sychronized cause this static method // could get preemted and we could end up with 2 instances of DatabaseFoo.. // see the "Singletons with needles and thread" article at JavaWorld -mh - public synchronized static DatabaseTopics getInstance() throws - StorageObjectFailure { + public synchronized static DatabaseTopics getInstance() { if (instance == null) { instance = new DatabaseTopics(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseUploadedMedia.java b/source/mircoders/storage/DatabaseUploadedMedia.java index 3d433898..0e077ed7 100755 --- a/source/mircoders/storage/DatabaseUploadedMedia.java +++ b/source/mircoders/storage/DatabaseUploadedMedia.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -41,14 +41,9 @@ public class DatabaseUploadedMedia extends Database implements StorageObject { private static DatabaseUploadedMedia instance; private static EntityRelation relationMediaType; - public static DatabaseUploadedMedia getInstance() { + public synchronized static DatabaseUploadedMedia getInstance() { if (instance == null ) { - synchronized(DatabaseUploadedMedia.class) { - if (instance == null ) { - instance = new DatabaseUploadedMedia(); - instance.myselfDatabase = instance; - } - } + instance = new DatabaseUploadedMedia(); } return instance; diff --git a/source/mircoders/storage/DatabaseUsers.java b/source/mircoders/storage/DatabaseUsers.java index 8e104b14..89e1ae6e 100755 --- a/source/mircoders/storage/DatabaseUsers.java +++ b/source/mircoders/storage/DatabaseUsers.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -49,11 +49,9 @@ public class DatabaseUsers extends Database implements StorageObject{ // the following *has* to be sychronized cause this static method // could get preemted and we could end up with 2 instances of DatabaseFoo.. // see the "Singletons with needles and thread" article at JavaWorld -mh - public synchronized static DatabaseUsers getInstance() throws - StorageObjectFailure { + public synchronized static DatabaseUsers getInstance() { if (instance == null) { instance = new DatabaseUsers(); - instance.myselfDatabase = instance; } return instance; } diff --git a/source/mircoders/storage/DatabaseVideo.java b/source/mircoders/storage/DatabaseVideo.java index 02238c32..a51d5b1f 100755 --- a/source/mircoders/storage/DatabaseVideo.java +++ b/source/mircoders/storage/DatabaseVideo.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -57,7 +57,6 @@ public class DatabaseVideo extends Database implements StorageObject{ public synchronized static DatabaseVideo getInstance() { if (instance == null) { instance = new DatabaseVideo(); - instance.myselfDatabase = instance; } return instance; } -- 2.11.0