|
13 | 13 | import java.nio.file.NoSuchFileException; |
14 | 14 | import java.nio.file.Path; |
15 | 15 | import java.nio.file.Paths; |
16 | | -import java.util.HashMap; |
| 16 | +import java.util.LinkedHashMap; |
17 | 17 | import java.util.Map; |
18 | 18 |
|
19 | 19 | import static io.github.filelize.FilelizeUtil.getFilelizeId; |
@@ -41,15 +41,15 @@ public <T> T readFile(String fullPath, Class<T> valueType) throws IOException { |
41 | 41 | public <T> Map<String, T> readFileMap(String fullPath, Class<T> valueType) throws IOException { |
42 | 42 | try { |
43 | 43 | JsonNode json = objectMapper.readTree(getNewBufferedReader(fullPath)); |
44 | | - JavaType mapType = objectMapper.getTypeFactory().constructMapType(Map.class, String.class, valueType); |
| 44 | + JavaType mapType = objectMapper.getTypeFactory().constructMapType(LinkedHashMap.class, String.class, valueType); |
45 | 45 | return objectMapper.readValue(json.traverse(), mapType); |
46 | 46 | } catch (NoSuchFileException e) { |
47 | | - return new HashMap<>(); |
| 47 | + return new LinkedHashMap<>(); |
48 | 48 | } |
49 | 49 | } |
50 | 50 |
|
51 | 51 | public <T> Map<String, Object> readFiles(String folderPath, Class<T> valueType) throws IOException { |
52 | | - Map<String, Object> content = new HashMap<>(); |
| 52 | + Map<String, Object> content = new LinkedHashMap<>(); |
53 | 53 | File folder = new File(folderPath); |
54 | 54 | File[] files = folder.listFiles(); |
55 | 55 | if (files != null) { |
@@ -77,7 +77,7 @@ public void delete(String fullPath) throws IOException { |
77 | 77 | try { |
78 | 78 | Files.delete(Path.of(fullPath)); |
79 | 79 | } catch (NoSuchFileException e) { |
80 | | - log.warn("No such file: " + fullPath); |
| 80 | + log.warn("No such file: {}", fullPath); |
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
0 commit comments