Closed mimi89999 closed 7 years ago
So there are tow possibilities:
We implement a data type for the full Account status and from there we get whether averages are available or not
We check if "disabled" is present in Librus response (input to that class (??)) and if it is, not execute the code that causes the issue.
Which one we go for?
I cannot find anything related to averages in /Units response, so i think we will have to go for the second option. We can also calculate averages ourselves.
śr., 22 lut 2017 o 18:27 użytkownik Michel Le Bihan < notifications@github.com> napisał:
So there are tow possibilities:
1.
We implement a data type for the full Account status and from there we get whether averages are available or not 2.
We check if "disabled" is present in Librus response (input to that class (??)) and if it is, not execute the code that causes the issue.
Which one we go for?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shymmq/librus-client/issues/87#issuecomment-281740166, or mute the thread https://github.com/notifications/unsubscribe-auth/AIH1mTiiQUrMYEs-KV2rtOQYKhBrvij9ks5rfHANgaJpZM4MEuN4 .
I will go for checking if disabled is present.
That's not the ideal solution as "disabled" keyword can theoretically be a part of a normal response. I would rather suggest checking for root / topLevel property. If it isn't there, try to parse response as an error an only then check for disabled keyword
So we can compare the input with exact response of Librus when averages aren't available (or hashes of replies).
@rowysock
if (topLevelName.equals("Averages") && input.contains("Disabled")) {
What do you think?
Version: 39bbe93 Device: Samsung Galaxy S4 Mini OS: LineageOS 14.1 (Android 7.1.1)
02-17 21:30:01.763 32741-374/pl.librus.client E/librus-client-log: Error parsing Averages 02-17 21:30:01.763 32741-374/pl.librus.client W/System.err: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of pl.librus.client.datamodel.Average[] out of NOT_AVAILABLE token 02-17 21:30:01.763 32741-374/pl.librus.client W/System.err: at [Source: N/A; line: -1, column: -1] 02-17 21:30:01.763 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.DeserializationContext.reportMappingException(DeserializationContext.java:1234) 02-17 21:30:01.763 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1122) 02-17 21:30:01.763 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1075) 02-17 21:30:01.763 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.handleNonArray(ObjectArrayDeserializer.java:275) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:179) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:20) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3770) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2099) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:2596) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at pl.librus.client.api.APIClient.parseList(APIClient.java:66) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at pl.librus.client.api.APIClient.lambda$getList$4(APIClient.java:219) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at pl.librus.client.api.APIClient.access$lambda$5(APIClient.java) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at pl.librus.client.api.APIClient$$Lambda$6.apply(Unknown Source) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at java8.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:630) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at java8.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:468) 02-17 21:30:01.764 32741-374/pl.librus.client W/System.err: at java.lang.Thread.run(Thread.java:761)