empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1324946 - /empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
Date Wed, 11 Apr 2012 19:41:13 GMT
Author: doebele
Date: Wed Apr 11 19:41:12 2012
New Revision: 1324946

URL: http://svn.apache.org/viewvc?rev=1324946&view=rev
Log:
EMPIREDB-138
adjustment

Modified:
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java?rev=1324946&r1=1324945&r2=1324946&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java Wed Apr 11
19:41:12 2012
@@ -42,7 +42,6 @@ import org.apache.empire.db.expr.column.
 import org.apache.empire.exceptions.InternalException;
 import org.apache.empire.exceptions.InvalidArgumentException;
 import org.apache.empire.exceptions.ItemExistsException;
-import org.apache.empire.exceptions.ItemNotFoundException;
 import org.apache.empire.exceptions.MiscellaneousErrorException;
 import org.apache.empire.exceptions.PropertyReadOnlyException;
 import org.apache.empire.exceptions.UnexpectedReturnValueException;
@@ -101,11 +100,8 @@ public abstract class DBDatabase extends
      */
     public static DBDatabase findById(String dbIdent)
     {
-        if (databaseMap.containsKey(dbIdent)==false)
-            log.warn("Database {} not found!", dbIdent);
-        // get reference
-        WeakReference<DBDatabase> ref = databaseMap.get(dbIdent); 
-        return ref.get();
+        WeakReference<DBDatabase> ref = databaseMap.get(dbIdent);
+        return (ref!=null) ? ref.get() : null;
     }
     
     /** 
@@ -119,7 +115,8 @@ public abstract class DBDatabase extends
             if (db!=null && cls.isInstance(db))
                 return db;
         }
-        throw new ItemNotFoundException(cls.getName());
+        log.warn("Database of class {} not found!", cls.getSimpleName());
+        return null;
     }
 
     /** the database schema * */



Mime
View raw message