On May 3, 2006, at 4:35 PM, Allen Gilliland wrote:
is that really appropriate? that same exception should be thrown automatically whenever someone tries to access the RollerFactory.getRoller() method.

Perhaps not, but I'd like the check to run before *anything* else happens. So, how about this. I'll add the check to RollerFactory, but the first thing I'll do in RollerContext.initialize() is to call RollerFactory.getRoller().


also, you are exposing a persistence implementation detail in the presentation layer. what if we switch away from Hibernate?

Obviously, we'll be changing that line of code (and many others) when we switch away from Hibernate.

- Dave





i think this one should be rolled back.

-- Allen


[EMAIL PROTECTED] wrote:
Author: snoopdave
Date: Wed May  3 13:29:46 2006
New Revision: 399407
URL: http://svn.apache.org/viewcvs?rev=399407&view=rev
Log:
Fail fast with appropriate error message when Hibernate is not found
Modified:
incubator/roller/trunk/src/org/apache/roller/presentation/ RollerContext.java Modified: incubator/roller/trunk/src/org/apache/roller/ presentation/RollerContext.java URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/ apache/roller/presentation/RollerContext.java? rev=399407&r1=399406&r2=399407&view=diff ===================================================================== ========= --- incubator/roller/trunk/src/org/apache/roller/presentation/ RollerContext.java (original) +++ incubator/roller/trunk/src/org/apache/roller/presentation/ RollerContext.java Wed May 3 13:29:46 2006
@@ -133,6 +133,14 @@
      */
     public void contextInitialized(ServletContextEvent sce) {
         +        try {
+            Class.forName("org.hibernate.Session");
+        } catch (Throwable t) {
+            // if Hibernate is not available, we're hosed
+            throw new RuntimeException(
+ "FATAL ERROR: Hibernate not found, please refer to the Roller Installation Guide for instructions on how to install the required Hibernate jars");
+        }
+                 mLogger.debug("RollerContext initializing");
                  // Save context in self and self in context

Reply via email to