cziegeler    02/02/05 06:49:18

  Modified:    src/java/org/apache/cocoon/components/hsqldb ServerImpl.java
  Log:
  Added exception when hsqldb is run from inside a WAR file
  
  Revision  Changes    Path
  1.9       +8 -2      
xml-cocoon2/src/java/org/apache/cocoon/components/hsqldb/ServerImpl.java
  
  Index: ServerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/hsqldb/ServerImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ServerImpl.java   4 Feb 2002 12:22:21 -0000       1.8
  +++ ServerImpl.java   5 Feb 2002 14:49:18 -0000       1.9
  @@ -79,7 +79,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Vadim Gritsenko</a>
  - * @version CVS $Id: ServerImpl.java,v 1.8 2002/02/04 12:22:21 cziegeler Exp $
  + * @version CVS $Id: ServerImpl.java,v 1.9 2002/02/05 14:49:18 cziegeler Exp $
    */
   public class ServerImpl
   extends AbstractLoggable
  @@ -128,9 +128,15 @@
       public void contextualize(Context context) throws ContextException {
           org.apache.cocoon.environment.Context ctx =
                   (org.apache.cocoon.environment.Context) 
context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
  +        // test if we are running inside a WAR file
  +        final String dbPath = ctx.getRealPath("/WEB-INF/db");
  +        if (dbPath == null) {
  +            throw new ContextException("The hsqldb cannot be used inside a WAR 
file.");
  +        }
  +
           try {
               arguments[6] = "-database";
  -            arguments[7] = new 
File(ctx.getRealPath("/WEB-INF/db")).getCanonicalPath();
  +            arguments[7] = new File(dbPath).getCanonicalPath();
               arguments[7] += File.separator + "cocoondb";
               getLogger().debug("database is " + arguments[7]);
           } catch (MalformedURLException e) {
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to