-
Notifications
You must be signed in to change notification settings - Fork 145
Description
While in process of uploading file to OneDrive, we are getting crash on device OS 7. We couldn't verify this crash on Android OS level below 7 as we get the crash in CalenderSerializer before this flow kicks in.
Crash logs are as follow:
--------- beginning of crash 10-15 10:32:12.228 13689 13689 E AndroidRuntime: FATAL EXCEPTION: main 10-15 10:32:12.228 13689 13689 E AndroidRuntime: Process: com.adobe.reader, PID: 13689 10-15 10:32:12.228 13689 13689 E AndroidRuntime: java.lang.NoSuchMethodError: No interface method getTypeName()Ljava/lang/String; in class Ljava/lang/reflect/Type; or its super classes (declaration of 'java.lang.reflect.Type' appears in /system/framework/core-oj.jar) 10-15 10:32:12.228 13689 13689 E AndroidRuntime: at com.microsoft.graph.serializer.CollectionPageSerializer.deserialize(CollectionPageSerializer.java:115) 10-15 10:32:12.228 13689 13689 E AndroidRuntime: at com.microsoft.graph.serializer.GsonFactory$12.deserialize(GsonFactory.java:229) 10-15 10:32:12.228 13689 13689 E AndroidRuntime: at com.microsoft.graph.serializer.GsonFactory$12.deserialize(GsonFactory.java:224) 10-15 10:32:12.228 13689 13689 E AndroidRuntime: at
Expected behavior
It shouldn't crash and handle newer apis with fallback mechanish or apis that is supported in older OS version
Devices tested where issue is observed:
Asus Tab, Samsung J7, Samsung Tab A, Galaxy S6
Cause
After some analysis, I found that crash is originating from CollectionPageSerializer which is being registered into Gson type adapter and which in function deserialize calls the method Type#getTypeName() which is a default method added after Java 1.8
Also can we make gson variable in DefaultSerializer public so that while configuring the graph client we can replace these problematic TypeAdapters with the custom solution. Like in case of when XXX is not supported in simpleDateFormat then same can be replaced with joda-time as we already have that dependency. Similarly in this case as well usage of getTypeName() can be replace with getName() or getCannonicalName() as to avoid crash