Author: remy.maucherat(a)jboss.com
Date: 2008-09-27 14:50:25 -0400 (Sat, 27 Sep 2008)
New Revision: 794
Modified:
trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java
trunk/webapps/docs/changelog.xml
Log:
- Use a real formatter to fix sync issue.
Modified: trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java 2008-09-27 17:44:11 UTC
(rev 793)
+++ trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java 2008-09-27 18:50:25 UTC
(rev 794)
@@ -20,6 +20,8 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
@@ -42,6 +44,8 @@
*/
private static final String CONTENT_TYPE = "content-type";
private static final String LAST_MODIFIED = "last-modified";
+ private static final DateFormat format =
+ new SimpleDateFormat(DateTool.RFC1123_PATTERN, DateTool.LOCALE_US);
protected long lastModified = -1;
private String contentType = null;
@@ -66,7 +70,7 @@
* @param captureServletOutputStream The ServletOutputStream to use
*/
public ResponseIncludeWrapper(ServletContext context,
- HttpServletRequest request, HttpServletResponse response,
+ HttpServletRequest request, HttpServletResponse response,
ServletOutputStream captureServletOutputStream) {
super(response);
this.context = context;
@@ -175,7 +179,7 @@
}
else
{
- // return a safe value
+ // return a safe value
setContentType("application/x-octet-stream");
}
}
@@ -208,7 +212,9 @@
String lname = name.toLowerCase();
if (lname.equals(LAST_MODIFIED)) {
try {
- lastModified = DateTool.rfc1123Format.parse(value).getTime();
+ synchronized(format) {
+ lastModified = format.parse(value).getTime();
+ }
} catch (Throwable ignore) { }
} else if (lname.equals(CONTENT_TYPE)) {
contentType = value;
@@ -228,7 +234,9 @@
String lname = name.toLowerCase();
if (lname.equals(LAST_MODIFIED)) {
try {
- lastModified = DateTool.rfc1123Format.parse(value).getTime();
+ synchronized(format) {
+ lastModified = format.parse(value).getTime();
+ }
} catch (Throwable ignore) { }
}
else if (lname.equals(CONTENT_TYPE))
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-09-27 17:44:11 UTC (rev 793)
+++ trunk/webapps/docs/changelog.xml 2008-09-27 18:50:25 UTC (rev 794)
@@ -43,6 +43,9 @@
<fix>
Tighten up the max size for content caching (which is often useless due to
sendfile). (markt, remm)
</fix>
+ <fix>
+ Sync date format usage in SSI. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
Show replies by date