dlr 01/05/23 15:24:34
Modified: src/java/org/apache/turbine/services/velocity
TurbineVelocityService.java
Log:
Supply an informative error message when some poor sod--cough,
cough--attempts to use an absolute path to Velocity's log file.
Revision Changes Path
1.45 +20 -4
jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
Index: TurbineVelocityService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- TurbineVelocityService.java 2001/05/23 17:56:02 1.44
+++ TurbineVelocityService.java 2001/05/23 22:24:32 1.45
@@ -71,6 +71,8 @@
import org.apache.turbine.util.ContentURI;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.StringUtils;
+import org.apache.turbine.util.TurbineConfig;
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.template.TemplateLink;
import org.apache.turbine.util.template.TemplatePageAttributes;
@@ -99,7 +101,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: TurbineVelocityService.java,v 1.44 2001/05/23 17:56:02 dlr Exp $
+ * @version $Id: TurbineVelocityService.java,v 1.45 2001/05/23 22:24:32 dlr Exp $
*/
public class TurbineVelocityService extends BaseTemplateEngineService
implements VelocityService
@@ -413,9 +415,23 @@
* Now we have to perform a couple of path translations
* for our log file and template paths.
*/
- configuration.setProperty(Velocity.RUNTIME_LOG,
- TurbineServlet.getRealPath(configuration.getString(
- Velocity.RUNTIME_LOG, null)));
+ String logFile = TurbineServlet.getRealPath
+ (configuration.getString(Velocity.RUNTIME_LOG, null));
+ if (StringUtils.isValid(logFile))
+ {
+ configuration.setProperty(Velocity.RUNTIME_LOG, logFile);
+ }
+ else
+ {
+ String msg = VelocityService.SERVICE_NAME + " runtime log file " +
+ "is misconfigured: '" + logFile + "' is not a valid log file";
+ if (TurbineServlet.getServletConfig() instanceof TurbineConfig)
+ {
+ msg += ": TurbineConfig users must use a path relative to " +
+ "web application root";
+ }
+ throw new Error(msg);
+ }
/*
* Get all the template paths where the velocity
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]