Skip to content

Commit 6118e30

Browse files
committed
Fix migrator failing if data dir is empty
Fix errors with old formatted strings
1 parent 8c2de26 commit 6118e30

File tree

1 file changed

+5
-6
lines changed
  • platform_api/src/main/java/net/modfest/platform/migrations

1 file changed

+5
-6
lines changed

platform_api/src/main/java/net/modfest/platform/migrations/Migrator.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
import java.nio.file.Path;
1212
import java.text.ParseException;
1313
import java.text.SimpleDateFormat;
14-
import java.util.HashMap;
15-
import java.util.HashSet;
16-
import java.util.Map;
14+
import java.util.*;
1715
import java.util.function.Function;
1816

1917
/**
@@ -169,14 +167,15 @@ public void migrateTo3() {
169167
* Changes timestamps to ISO8086
170168
*/
171169
public void migrateTo4() {
172-
var oldFormat = new SimpleDateFormat("MMM dd, yyyy, h:mm:ssa");
170+
var oldFormat = new SimpleDateFormat("MMM dd yyyy h:mm:ssa", Locale.ROOT);
173171

174172
Function<String, String> toIso = str -> {
175173
try {
176174
// These idiosyncrasies sometimes occur within the old format
177175
str = str.replace(" ", "");
178-
if (str.startsWith("Sep ")) {
179-
str = str.replaceFirst("Sep ", "Sept ");
176+
str = str.replace(",", "");
177+
if (str.startsWith("Sept ")) {
178+
str = str.replaceFirst("Sept ", "Sep ");
180179
}
181180
if (str.endsWith(" AM")) {
182181
str = str.replace(" AM", "AM");

0 commit comments

Comments
 (0)