You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/12/01 07:55:03 UTC

svn commit: r350193 - in /geronimo/trunk/modules: jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java tomcat/src/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java

Author: ammulder
Date: Wed Nov 30 22:54:58 2005
New Revision: 350193

URL: http://svn.apache.org/viewcvs?rev=350193&view=rev
Log:
Applied patch for GERONIMO-1185 (Thanks Joe), re: file separators in
  web log file paths

Modified:
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java?rev=350193&r1=350192&r2=350193&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java Wed Nov 30 22:54:58 2005
@@ -49,6 +49,11 @@
     private final static int GROUP_FILENAME_YEAR  = 2;
     private final static int GROUP_FILENAME_MONTH = 4;
     private final static int GROUP_FILENAME_DAY   = 5;
+    // NOTE:  The file separators are specified here rather than using something like File.separator because
+    //        they are hard coded in config plans and sometimes in java code itself rather than being dependent
+    //        upon the OS.  This should be fixed someday, but for now we will manually check for either format.
+    private final static String FILE_SEPARATOR_UNIX_STYLE = "/";
+    private final static String FILE_SEPARATOR_WIN_STYLE = "\\";
 
     // Pattern that matches a single line  (used to calculate line numbers)
     private final static Pattern FULL_LINE_PATTERN = Pattern.compile("^.*", Pattern.MULTILINE);
@@ -124,8 +129,10 @@
 
         try {
             String fileNamePattern = logName;
-            if (fileNamePattern.indexOf(File.separator) > -1) {
-                fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf(File.separator) + 1);
+            if (fileNamePattern.indexOf(FILE_SEPARATOR_UNIX_STYLE) > -1) {
+                fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf(FILE_SEPARATOR_UNIX_STYLE) + 1);
+            } else if (fileNamePattern.indexOf(FILE_SEPARATOR_WIN_STYLE) > -1) {
+                fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf(FILE_SEPARATOR_WIN_STYLE) + 1);
             }
 
             String logFile = serverInfo.resolvePath(logName);

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java?rev=350193&r1=350192&r2=350193&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java Wed Nov 30 22:54:58 2005
@@ -50,6 +50,11 @@
     private final static int GROUP_FILENAME_YEAR  = 2;
     private final static int GROUP_FILENAME_MONTH = 4;
     private final static int GROUP_FILENAME_DAY   = 5;
+    // NOTE:  The file separators are specified here rather than using something like File.separator because
+    //        they are hard coded in config plans and sometimes in java code itself rather than being dependent
+    //        upon the OS.  This should be fixed someday, but for now we will manually check for either format.
+    private final static String FILE_SEPARATOR_UNIX_STYLE = "/";
+    private final static String FILE_SEPARATOR_WIN_STYLE = "\\";
 
     // Pattern that matches a single line  (used to calculate line numbers)
     private final static Pattern FULL_LINE_PATTERN = Pattern.compile("^.*", Pattern.MULTILINE);
@@ -126,10 +131,10 @@
 
         try {
             String fileNamePattern = logName;
-            if (fileNamePattern.indexOf("/") > -1) {
-                fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf("/") + 1);
-            } else if (fileNamePattern.indexOf("\\") > -1) {
-                fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf("\\") + 1);
+            if (fileNamePattern.indexOf(FILE_SEPARATOR_UNIX_STYLE) > -1) {
+                fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf(FILE_SEPARATOR_UNIX_STYLE) + 1);
+            } else if (fileNamePattern.indexOf(FILE_SEPARATOR_WIN_STYLE) > -1) {
+                fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf(FILE_SEPARATOR_WIN_STYLE) + 1);
             }
 
             String logFile = serverInfo.resolvePath(logName);