From 281dd435e7a3fcf9352accfe1ca228c796190beb Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 6 Dec 2016 11:29:47 +0100 Subject: [PATCH] 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. --- app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java b/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java index 9b8001d0b..97b82c773 100644 --- a/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java +++ b/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java @@ -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 repoMap = null;