ConfigParser: do NOT override existing sections

This commit support format as below:

```
[DNS]
EQUAL,example.com

[URL]
PREFIX,https://example.com/a

[URL]
PREFIX,https://example.com/foo

[URL]
PREFIX,https://example.com/bar
```

It merges sections with the same section name.
This commit is contained in:
Syrone Wong 2021-12-03 08:33:46 +08:00 committed by GitHub
parent af875d2ad0
commit 0993b354e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,10 @@ public class ConfigParser {
}
lastSection = section;
map.put(lastSection, new ArrayList<>());
if (null == map.get(lastSection)) {
// do NOT override existing sections
map.put(lastSection, new ArrayList<>());
}
break;
case '#':
case ';':