carnold 2005/02/11 15:14:35
Modified: src/java/org/apache/log4j FileAppender.java
Removed: src/java/org/apache/log4j/db DBAppender2.java
Log:
Removing unused DBAppender2
Revision Changes Path
1.49 +40 -1 logging-log4j/src/java/org/apache/log4j/FileAppender.java
Index: FileAppender.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/FileAppender.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- FileAppender.java 11 Feb 2005 18:11:44 -0000 1.48
+++ FileAppender.java 11 Feb 2005 23:14:35 -0000 1.49
@@ -123,7 +123,7 @@
// Trim spaces from both ends. The users probably does not want
// trailing spaces in file names.
String val = file.trim();
- fileName = OptionConverter.stripDuplicateBackslashes(val);
+ fileName = stripDuplicateBackslashes(val);
}
/**
@@ -271,4 +271,43 @@
writeHeader();
getLogger().debug("setFile ended");
}
+
+ /**
+ * Replaces double backslashes (except the leading doubles in UNC's)
+ * with single backslashes for compatibility with existing path
specifications
+ * that were working around use of OptionConverter.convertSpecialChars
+ * in XML configuration files.
+ *
+ * @param src source string
+ * @return source string with double backslashes replaced
+ *
+ * @since 1.3
+ */
+ public static String stripDuplicateBackslashes(final String src) {
+ int i = src.lastIndexOf('\\');
+ if (i > 0) {
+ StringBuffer buf = new StringBuffer(src);
+ for(; i > 0; i = src.lastIndexOf('\\', i - 1)) {
+ //
+ // if the preceding character is a slash then
+ // remove the preceding character
+ // and continue processing with the earlier part of
the string
+ if(src.charAt(i - 1) == '\\') {
+ buf.deleteCharAt(i);
+ i--;
+ if (i == 0) break;
+ } else {
+ //
+ // if there was a single slash then
+ // the string was not trying to work around
+ // convertSpecialChars
+ //
+ return src;
+ }
+ }
+ return buf.toString();
+ }
+ return src;
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]