dlr 01/05/23 14:52:12
Modified: src/java/org/apache/turbine/util TurbineConfig.java
Log:
* JavaDoc tweak and variable naming fix for debug flag.
* JavaDoc corrections for getRealPath(). Also reduced amount of code
in method, and changed logging to use System.err because
LoggingService hasn't been initialized at this point.
Revision Changes Path
1.19 +12 -33
jakarta-turbine/src/java/org/apache/turbine/util/TurbineConfig.java
Index: TurbineConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/TurbineConfig.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- TurbineConfig.java 2001/05/05 03:19:22 1.18
+++ TurbineConfig.java 2001/05/23 21:52:11 1.19
@@ -100,12 +100,12 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: TurbineConfig.java,v 1.18 2001/05/05 03:19:22 jvanzyl Exp $
+ * @version $Id: TurbineConfig.java,v 1.19 2001/05/23 21:52:11 dlr Exp $
*/
public class TurbineConfig implements ServletConfig, ServletContext
{
- /** Enables output of debug messages. (compile time option) */
- private final static boolean debug = false;
+ /** Enables output of debug messages (compile time option). */
+ private final static boolean DEBUG = false;
/** Filenames are looked up in this directory. */
private File root;
@@ -190,43 +190,22 @@
}
/**
- * Translates a relative path into an absolute one.
+ * Translates a path relative to the web application root into an
+ * absolute path.
*
- * @param path a relative path
- * @return an absolute path
+ * @param path A path relative to the web application root.
+ * @return An absolute version of the supplied path.
*/
public String getRealPath( String path )
{
- if(debug)
- {
- Log.info("getRealPath: " + path);
- }
-
File f = new File(root, path);
-
- if(debug)
- {
- if(f.exists())
- {
- Log.info("found " + f.getPath());
- return f.getPath();
- } else
- {
- Log.info("not found");
- return null;
- }
- }
- else // !debug
+ if (DEBUG)
{
- if(f.exists())
- {
- return f.getPath();
- }
- else
- {
- return null;
- }
+ System.err.println("TurbineConfig.getRealPath: path '" + path +
+ "' translated to '" + f.getPath() + "' " +
+ (f.exists() ? "" : "not ") + "found");
}
+ return (f.exists() ? f.getPath() : null);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]