contentful/contentful.java

Retrofit TypeAdapter Error on 10.5.1

Closed this issue · 3 comments

The library is throwing java.lang.IllegalArgumentException: Unable to create converter for class com.contentful.java.cda.CDAArray when trying to fetch an entry using the CDAClient.

We noticed this happens after changes from #3327344.

Attached stack trace from the Discovery Sample app, after making changes on it so that it runs and builds. It runs when using the library from #d95138c, but starts throwing this exception when using the library from a version after that commit.

2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err: java.lang.IllegalArgumentException: Unable to create converter for class com.contentful.java.cda.CDAArray
2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err:     for method CDAService.array
2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err:     at retrofit2.Utils.methodError(Utils.java:52)
2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err:     at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:70)
2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err:     at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:46)
2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err:     at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:36)
2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err:     at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:168)
2021-09-28 22:45:52.555 12813-12914/discovery.contentful W/System.err:     at retrofit2.Retrofit$1.invoke(Retrofit.java:147)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at com.contentful.java.cda.$Proxy2.array(Unknown Source)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at com.contentful.java.cda.CDAClient.cacheLocales(CDAClient.java:410)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at com.contentful.java.cda.CDAClient.cacheAll(CDAClient.java:392)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at com.contentful.java.cda.ObserveQuery.all(ObserveQuery.java:88)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at com.contentful.java.cda.FetchQuery.all(FetchQuery.java:51)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at discovery.contentful.loaders.ContentTypesLoader.performLoad(ContentTypesLoader.java:18)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at discovery.contentful.loaders.ContentTypesLoader.performLoad(ContentTypesLoader.java:13)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at discovery.contentful.loaders.AbsAsyncTaskLoader.loadInBackground(AbsAsyncTaskLoader.java:15)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at discovery.contentful.loaders.ContentTypesLoader.loadInBackground(ContentTypesLoader.java:13)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2021-09-28 22:45:52.556 12813-12914/discovery.contentful W/System.err:     at java.lang.Thread.run(Thread.java:920)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err: Caused by: java.lang.UnsupportedOperationException: can't load this type of class file
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at java.lang.ClassLoader.defineClass(ClassLoader.java:517)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.module.mrbean.AbstractTypeMaterializer$MyClassLoader.loadAndResolve(AbstractTypeMaterializer.java:321)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.module.mrbean.AbstractTypeMaterializer.materializeRawType(AbstractTypeMaterializer.java:254)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.module.mrbean.AbstractTypeMaterializer.resolveAbstractType(AbstractTypeMaterializer.java:197)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.materializeAbstractType(BeanDeserializerFactory.java:185)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:121)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:414)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:446)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:183)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:27)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.DeserializationContext.handlePrimaryContextualization(DeserializationContext.java:653)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:489)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:293)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:479)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.ObjectReader._prefetchRootDeserializer(ObjectReader.java:2094)
2021-09-28 22:45:52.557 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.ObjectReader.<init>(ObjectReader.java:191)
2021-09-28 22:45:52.558 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.ObjectMapper._newReader(ObjectMapper.java:718)
2021-09-28 22:45:52.558 12813-12914/discovery.contentful W/System.err:     at com.fasterxml.jackson.databind.ObjectMapper.readerFor(ObjectMapper.java:3712)
2021-09-28 22:45:52.558 12813-12914/discovery.contentful W/System.err:     at retrofit2.converter.jackson.JacksonConverterFactory.responseBodyConverter(JacksonConverterFactory.java:60)
2021-09-28 22:45:52.558 12813-12914/discovery.contentful W/System.err:     at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:328)
2021-09-28 22:45:52.558 12813-12914/discovery.contentful W/System.err:     at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:311)
2021-09-28 22:45:52.558 12813-12914/discovery.contentful W/System.err:     at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:68)
2021-09-28 22:45:52.558 12813-12914/discovery.contentful W/System.err: 	... 22 more

@rafalniski ^^ thank you

Hey @amandasage @adityashri7

I merged PR with reverted changes #242 and will do a new release shortly.

@adityashri7 Should be fixed in v.10.5.2