You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/09/01 21:17:15 UTC
svn commit: r265767 -
/directory/naming/trunk/naming-resources/src/java/org/apache/naming/resources/ResourceAttributes.java
Author: elecharny
Date: Thu Sep 1 12:17:10 2005
New Revision: 265767
URL: http://svn.apache.org/viewcvs?rev=265767&view=rev
Log:
Synchronized SimpleDateFormat
Modified:
directory/naming/trunk/naming-resources/src/java/org/apache/naming/resources/ResourceAttributes.java
Modified: directory/naming/trunk/naming-resources/src/java/org/apache/naming/resources/ResourceAttributes.java
URL: http://svn.apache.org/viewcvs/directory/naming/trunk/naming-resources/src/java/org/apache/naming/resources/ResourceAttributes.java?rev=265767&r1=265766&r2=265767&view=diff
==============================================================================
--- directory/naming/trunk/naming-resources/src/java/org/apache/naming/resources/ResourceAttributes.java (original)
+++ directory/naming/trunk/naming-resources/src/java/org/apache/naming/resources/ResourceAttributes.java Thu Sep 1 12:17:10 2005
@@ -130,14 +130,14 @@
/**
* HTTP date format.
*/
- protected static final SimpleDateFormat format =
+ protected static final SimpleDateFormat dateFormat =
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
/**
* Date formats using for Date parsing.
*/
- protected static final SimpleDateFormat formats[] = {
+ protected static final SimpleDateFormat dateFormats[] = {
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
@@ -152,11 +152,11 @@
*/
static {
- format.setTimeZone(gmtZone);
+ dateFormat.setTimeZone(gmtZone);
- formats[0].setTimeZone(gmtZone);
- formats[1].setTimeZone(gmtZone);
- formats[2].setTimeZone(gmtZone);
+ dateFormats[0].setTimeZone(gmtZone);
+ dateFormats[1].setTimeZone(gmtZone);
+ dateFormats[2].setTimeZone(gmtZone);
}
@@ -353,9 +353,12 @@
Date result = null;
// Parsing the HTTP Date
for (int i = 0; (result == null) &&
- (i < formats.length); i++) {
+ (i < dateFormats.length); i++) {
try {
- result = formats[i].parse(creationDateValue);
+ synchronized (dateFormats)
+ {
+ result = dateFormats[i].parse(creationDateValue);
+ }
} catch (ParseException e) {
;
}
@@ -415,9 +418,12 @@
Date result = null;
// Parsing the HTTP Date
for (int i = 0; (result == null) &&
- (i < formats.length); i++) {
+ (i < dateFormats.length); i++) {
try {
- result = formats[i].parse(creationDateValue);
+ synchronized (dateFormats)
+ {
+ result = dateFormats[i].parse(creationDateValue);
+ }
} catch (ParseException e) {
;
}
@@ -474,10 +480,13 @@
Date result = null;
// Parsing the HTTP Date
for (int i = 0; (result == null) &&
- (i < formats.length); i++) {
+ (i < dateFormats.length); i++) {
try {
- result =
- formats[i].parse(lastModifiedDateValue);
+ synchronized (dateFormats)
+ {
+ result =
+ dateFormats[i].parse(lastModifiedDateValue);
+ }
} catch (ParseException e) {
;
}
@@ -548,10 +557,13 @@
Date result = null;
// Parsing the HTTP Date
for (int i = 0; (result == null) &&
- (i < formats.length); i++) {
+ (i < dateFormats.length); i++) {
try {
- result =
- formats[i].parse(lastModifiedDateValue);
+ synchronized (dateFormats)
+ {
+ result =
+ dateFormats[i].parse(lastModifiedDateValue);
+ }
} catch (ParseException e) {
;
}
@@ -596,8 +608,8 @@
if (modifiedDate == null) {
modifiedDate = new Date();
}
- synchronized (format) {
- lastModifiedHttp = format.format(modifiedDate);
+ synchronized (dateFormat) {
+ lastModifiedHttp = dateFormat.format(modifiedDate);
}
return lastModifiedHttp;
}