这是我的代码:
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
....
private static Date parseIfModifiedSince(HttpServletRequest request) {
String lastModifiedHeader = "";
try {
lastModifiedHeader = request.getHeader(IF_MODIFIED_SINCE);
return !StringUtils.isEmpty(lastModifiedHeader) ? DATE_FORMAT.parse(lastModifiedHeader) : null;
} catch (Exception ex) {
log.warn("Error while parsing If-Modified-Since date: \"" + lastModifiedHeader+"\"", ex);
return null;
}
}
有时我会看到一个异常:
WARN ru.planeta.web.res.ResourcesController 2013-03-29 20:16:58,635: Error while parsing If-Modified-Since date: "Fri, 29 Mar 2013 16:16:28 GMT"
java.lang.NumberFormatException: multiple points
我在代码中找不到任何问题。我怎么了?