Skip to content

Commit e0ca831

Browse files
committed
Explicitly setting locale for dateformats
1 parent be7c587 commit e0ca831

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/main/java/org/archive/format/gzip/zipnum/ZipNumCluster.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Date;
2222
import java.util.HashMap;
2323
import java.util.List;
24+
import java.util.Locale;
2425
import java.util.Map.Entry;
2526
import java.util.concurrent.ConcurrentHashMap;
2627
import java.util.logging.Level;
@@ -102,7 +103,7 @@ public void run() {
102103
public final static String LATEST_TIMESTAMP = "_LATEST";
103104
public final static String OFF = "OFF";
104105

105-
protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
106+
protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
106107
protected Date startDate, endDate;
107108

108109
class BlockSize

src/main/java/org/archive/util/ArchiveUtils.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public class ArchiveUtils {
104104
private static ThreadLocal<SimpleDateFormat> threadLocalDateFormat(final String pattern) {
105105
ThreadLocal<SimpleDateFormat> tl = new ThreadLocal<SimpleDateFormat>() {
106106
protected SimpleDateFormat initialValue() {
107-
SimpleDateFormat df = new SimpleDateFormat(pattern);
107+
SimpleDateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
108108
df.setTimeZone(TimeZone.getTimeZone("GMT"));
109109
return df;
110110
}
@@ -393,9 +393,9 @@ public static Date getDate(String d) throws ParseException {
393393
}
394394

395395
final static SimpleDateFormat dateToTimestampFormats[] =
396-
{new SimpleDateFormat("MM/dd/yyyy"),
397-
new SimpleDateFormat("MM/yyyy"),
398-
new SimpleDateFormat("yyyy")};
396+
{new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH),
397+
new SimpleDateFormat("MM/yyyy", Locale.ENGLISH),
398+
new SimpleDateFormat("yyyy", Locale.ENGLISH)};
399399

400400
/**
401401
* Convert a user-entered date into a timestamp

src/main/java/org/archive/util/DateUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class DateUtils {
6565
private static ThreadLocal<SimpleDateFormat> threadLocalDateFormat(final String pattern) {
6666
ThreadLocal<SimpleDateFormat> tl = new ThreadLocal<SimpleDateFormat>() {
6767
protected SimpleDateFormat initialValue() {
68-
SimpleDateFormat df = new SimpleDateFormat(pattern);
68+
SimpleDateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
6969
df.setTimeZone(TimeZone.getTimeZone("GMT"));
7070
return df;
7171
}

src/main/java/org/archive/util/binsearch/impl/http/ApacheHttp31SLRFactory.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.IOException;
44
import java.text.SimpleDateFormat;
55
import java.util.Date;
6+
import java.util.Locale;
67
import java.util.logging.Logger;
78

89
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
@@ -156,7 +157,7 @@ public boolean isStaleChecking()
156157
public long getModTime()
157158
{
158159
HTTPSeekableLineReader reader = null;
159-
SimpleDateFormat lastModFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
160+
SimpleDateFormat lastModFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH);
160161

161162
try {
162163
reader = get();

0 commit comments

Comments
 (0)