Jackson gives us {"repo": {"mirrors": ["foo", "bar"] as ArrayList

I was optimistic and guessed it was a String[], since that's what is needed.

Found by @cde while working on #35
This commit is contained in:
Hans-Christoph Steiner 2017-07-06 21:34:15 +02:00
parent 2a7fe78483
commit 6c247e3201

View File

@ -289,10 +289,12 @@ public class IndexV1Updater extends RepoUpdater {
return null;
}
@SuppressWarnings("unchecked")
private String[] getStringArrayRepoValue(Map<String, Object> repoMap, String key) {
Object value = repoMap.get(key);
if (value != null && value instanceof String[]) {
return (String[]) value;
if (value != null && value instanceof ArrayList) {
ArrayList<String> list = (ArrayList<String>) value;
return list.toArray(new String[list.size()]);
}
return null;
}