henning     2003/03/05 06:44:51

  Modified:    src/java/org/apache/turbine/util TurbineConfig.java
               src/java/org/apache/turbine/services/component
                        TurbineComponentService.java
  Log:
  Added some explicit checking and error message to the getRealPath Method
  of TurbineConfig. This problem is caught if you run in standalone mode
  (without Servlet container) and have e.g. a wrong path definition for the
  Torque component. Make sure that an init exception is thrown in this case.
  
  Revision  Changes    Path
  1.10      +9 -2      
jakarta-turbine-2/src/java/org/apache/turbine/util/TurbineConfig.java
  
  Index: TurbineConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/TurbineConfig.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TurbineConfig.java        14 Feb 2003 06:18:58 -0000      1.9
  +++ TurbineConfig.java        5 Mar 2003 14:44:51 -0000       1.10
  @@ -259,7 +259,14 @@
               sb.append("found");
               log.debug(sb.toString());
           }
  -        return (f.exists() ? f.getPath() : null);
  +
  +        if (f.exists())
  +        {
  +          return f.getPath();
  +        }
  +
  +        log.error("getRealPath(\"" + path + "\") is undefined, returning null");
  +        return null;
       }
   
       /**
  
  
  
  1.10      +9 -2      
jakarta-turbine-2/src/java/org/apache/turbine/services/component/TurbineComponentService.java
  
  Index: TurbineComponentService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/component/TurbineComponentService.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TurbineComponentService.java      12 Feb 2003 17:50:07 -0000      1.9
  +++ TurbineComponentService.java      5 Mar 2003 14:44:51 -0000       1.10
  @@ -128,8 +128,15 @@
                   if (subKey.equals(CONFIG))
                   {
                       log.debug("Fixing up " + subVal);
  -                    subVal =
  +                    String newPath =
                               config.getServletContext().getRealPath((String) subVal);
  +
  +                    if (newPath == null)
  +                    {
  +                      throw new InitializationException("Could not translate path " 
+ subVal);
  +                    }
  +
  +                    subVal = newPath;
                       log.debug("Now: " + subVal);
                   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to