ignore unknown fields in index-v1 JSON data
Having Jackson set to ignore unknown fields in the incoming JSON data, instead of throwing an Exception, means that we can add any fields to the JSON without having to rev the index version, and older clients will still parse it fine. This is basically the same as in index.xml.
This commit is contained in:
parent
9d97546c4f
commit
281dd435e7
@ -12,6 +12,7 @@ import android.util.Log;
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@ -131,6 +132,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
public void processIndexV1(InputStream indexInputStream, JarEntry indexEntry, String cacheTag)
|
||||
throws IOException, UpdateException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
JsonFactory f = mapper.getFactory();
|
||||
JsonParser parser = f.createParser(indexInputStream);
|
||||
HashMap<String, Object> repoMap = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user