ceki 2004/12/23 12:37:17
Modified: src/java/org/apache/log4j/pattern CachedDateFormat.java
CacheUtil.java
tests/src/java/org/apache/log4j/pattern CacheUtilTest.java
Log:
Typo fixes, other corrections.
Revision Changes Path
1.9 +3 -1
logging-log4j/src/java/org/apache/log4j/pattern/CachedDateFormat.java
Index: CachedDateFormat.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/CachedDateFormat.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- CachedDateFormat.java 23 Dec 2004 20:13:33 -0000 1.8
+++ CachedDateFormat.java 23 Dec 2004 20:37:17 -0000 1.9
@@ -48,7 +48,7 @@
private int milliDigits;
private StringBuffer milliBuf = new StringBuffer(JVM_MAX_MILLI_DIGITS);
private NumberFormat numberFormat;
-
+
public CachedDateFormat(String pattern) {
this(pattern, null);
}
@@ -148,9 +148,11 @@
*/
public StringBuffer format(
Date date, StringBuffer sbuf, FieldPosition fieldPosition) {
+
if (millisecondStart == BAD_PATTERN) {
return formatter.format(date, sbuf, fieldPosition);
}
+
long now = date.getTime();
if ((now < (slotBegin + 1000L)) && (now >= slotBegin)) {
//System.out.println("Using cached val:"+date);
1.4 +0 -4
logging-log4j/src/java/org/apache/log4j/pattern/CacheUtil.java
Index: CacheUtil.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/CacheUtil.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CacheUtil.java 23 Dec 2004 17:50:30 -0000 1.3
+++ CacheUtil.java 23 Dec 2004 20:37:17 -0000 1.4
@@ -65,10 +65,6 @@
* a non-sensical pattern, but unsafe nonetheless.
*/
public static boolean isPatternSafeForCaching(String pattern) {
- int x = 3;
- if(x == 3) {
- return false;
- }
// this code assumes that literals have been removed from the pattern
if(pattern.indexOf("EEEE") != -1 && pattern.indexOf("MMMM") != -1) {
return false;
1.2 +1 -1
logging-log4j/tests/src/java/org/apache/log4j/pattern/CacheUtilTest.java
Index: CacheUtilTest.java
===================================================================
RCS file:
/home/cvs/logging-log4j/tests/src/java/org/apache/log4j/pattern/CacheUtilTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CacheUtilTest.java 23 Dec 2004 13:00:58 -0000 1.1
+++ CacheUtilTest.java 23 Dec 2004 20:37:17 -0000 1.2
@@ -52,7 +52,7 @@
assertEquals("ZZZEEE", result);
}
- public void testIsPatternSafeForCachingRemoveLiteral() {
+ public void testIsPatternSafeForCaching() {
boolean result;
result = CacheUtil.isPatternSafeForCaching("a");
assertEquals(true, result);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]