Skip to content

Commit eadf3b6

Browse files
committed
Further improve comment-preservation & update to 3.1.8
1 parent 3f154ba commit eadf3b6

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.javafactorydev</groupId>
88
<artifactId>lightningstorage</artifactId>
9-
<version>3.1.7</version>
9+
<version>3.1.8</version>
1010
<name>LightningStorage</name>
1111
<description>Store data in a better way</description>
1212
<url>https://github.com/JavaFactoryDev/LightningStorage</url>

src/main/java/de/leonhard/storage/internal/editor/yaml/YamlParser.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ public List<String> parseLines(
2727

2828
Collections.reverse(rawList);
2929
out.addAll(rawList);
30-
if (!line.equals(FOOTER)) {
30+
if (!line.equals(FOOTER))
3131
out.add(line);
32-
}
3332
}
3433

3534
return out;
@@ -66,18 +65,17 @@ public Map<String, List<String>> assignCommentsToKey(final List<String> lines) {
6665
String currentKey = FOOTER;
6766
for (int i = lines.size() - 1; i >= 0; i--) {
6867
final String line = lines.get(i);
69-
if (!line.trim().startsWith("#") && !line.isEmpty()) {
68+
if (!line.trim().startsWith("#") && !line.isEmpty())
7069
currentKey = line;
71-
} else {
70+
else {
7271
final List<String> storage = out.get(currentKey.split(":")[0]);
7372

74-
if (storage == null) {
73+
if (storage == null)
7574
out.put(
7675
currentKey.split(":")[0],
7776
new ArrayList<>(Collections.singletonList(line)));
78-
} else {
77+
else if (!storage.contains(line))
7978
storage.add(line);
80-
}
8179
}
8280
}
8381
return out;

0 commit comments

Comments
 (0)