yoavs 2004/01/15 08:18:11
Modified: catalina/src/share/org/apache/catalina/valves
AccessLogValve.java
Log:
Added null check for current date for safety, after user reported
null date following webapp reload.
Revision Changes Path
1.8 +12 -10
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
Index: AccessLogValve.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AccessLogValve.java 2 Sep 2003 21:22:03 -0000 1.7
+++ AccessLogValve.java 15 Jan 2004 16:18:11 -0000 1.8
@@ -1022,17 +1022,21 @@
* less than 1 second since a new Date was created, this method
* simply gives out the same Date again so that the system doesn't
* spend time creating Date objects unnecessarily.
+ *
+ * @return Date
*/
private Date getDate() {
-
- // Only create a new Date once per second, max.
- long systime = System.currentTimeMillis();
- if ((systime - currentDate.getTime()) > 1000) {
- currentDate = new Date(systime);
- }
+ if(currentDate == null) {
+ currentDate = new Date();
+ } else {
+ // Only create a new Date once per second, max.
+ long systime = System.currentTimeMillis();
+ if ((systime - currentDate.getTime()) > 1000) {
+ currentDate = new Date(systime);
+ }
+ }
return currentDate;
-
}
@@ -1160,6 +1164,4 @@
close();
}
-
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]