vgritsenko 01/08/20 11:57:57
Modified: src/org/apache/cocoon/servlet CocoonServlet.java
Log:
Consistent web.xml parameters (allow true/yes, ignore case)
Revision Changes Path
1.33 +13 -13 xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- CocoonServlet.java 2001/08/20 13:55:17 1.32
+++ CocoonServlet.java 2001/08/20 18:57:57 1.33
@@ -57,7 +57,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.32 $ $Date: 2001/08/20 13:55:17 $
+ * @version CVS $Revision: 1.33 $ $Date: 2001/08/20 18:57:57 $
*/
public class CocoonServlet extends HttpServlet {
@@ -115,6 +115,7 @@
throws ServletException {
super.init(conf);
+ String value;
this.servletContext = conf.getServletContext();
this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new
HttpContext(this.servletContext));
@@ -126,13 +127,14 @@
log.debug("load-class was not set - defaulting to false?");
}
- this.addClassDirs =
"true".equals(conf.getInitParameter("init-classloader"));
- if(conf.getInitParameter("init-classloader") == null) {
+ value = conf.getInitParameter("init-classloader");
+ this.addClassDirs = "true".equalsIgnoreCase(value) ||
"yes".equalsIgnoreCase(value);
+ if(value == null) {
log.debug("init-classloader was not set - defaulting to false");
}
String workDirParam = conf.getInitParameter("work-directory");
- if ((workDirParam != null) && (workDirParam.trim().equals("") == false)) {
+ if ((workDirParam != null) && (!workDirParam.trim().equals(""))) {
workDir = IOUtils.createFile( new
File(this.servletContext.getRealPath("/")) , workDirParam);
workDir.mkdirs();
} else {
@@ -142,7 +144,7 @@
this.appContext.put(Constants.CONTEXT_WORK_DIR, workDir);
String uploadDirParam = conf.getInitParameter("upload-directory");
- if ((uploadDirParam != null) && (uploadDirParam.trim().equals("") ==
false)) {
+ if ((uploadDirParam != null) && (!uploadDirParam.trim().equals(""))) {
this.uploadDir = IOUtils.createFile( new
File(this.servletContext.getRealPath("/")) , uploadDirParam);
} else {
this.uploadDir = IOUtils.createFile(workDir, "image-dir" +
File.separator);
@@ -152,7 +154,7 @@
this.uploadDir.mkdirs();
String cacheDirParam = conf.getInitParameter("cache-directory");
- if ((cacheDirParam != null) && (cacheDirParam.trim().equals("") == false)) {
+ if ((cacheDirParam != null) && (!cacheDirParam.trim().equals(""))) {
this.cacheDir = IOUtils.createFile( new
File(this.servletContext.getRealPath("/")) , cacheDirParam);
} else {
this.cacheDir = IOUtils.createFile(workDir, "cache-dir" +
File.separator);
@@ -168,18 +170,16 @@
}
// get allow reload parameter, default is true
- String value = conf.getInitParameter("allow-reload");
- this.allowReload = (value == null || value.equals("yes") ||
value.equals("true"));
-
- if(conf.getInitParameter("allow-reload") == null) {
+ value = conf.getInitParameter("allow-reload");
+ this.allowReload = (value == null || value.equalsIgnoreCase("yes") ||
value.equalsIgnoreCase("true"));
+ if(value == null) {
log.debug("allow-reload was not set - defaulting to true");
}
value = conf.getInitParameter("show-time");
- this.showTime = "yes".equals(value) || "true".equals(value)
+ this.showTime = "yes".equalsIgnoreCase(value) ||
"true".equalsIgnoreCase(value)
|| (this.hiddenShowTime = "hide".equals(value));
-
- if(conf.getInitParameter("show-time") == null) {
+ if(value == null) {
log.debug("show-time was not set - defaulting to false");
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]