fix parsing of API versions header

This commit is contained in:
korelstar 2020-06-14 15:58:46 +02:00
parent 0e2c0c4d9b
commit ae68495fab
2 changed files with 3 additions and 3 deletions

View file

@ -189,7 +189,7 @@ public abstract class NotesClient {
String supportedApiVersions = null;
final AidlNetworkRequest.PlainHeader supportedApiVersionsHeader = response.getPlainHeader(HEADER_KEY_X_NOTES_API_VERSIONS);
if (supportedApiVersionsHeader != null) {
supportedApiVersions = Objects.requireNonNull(supportedApiVersionsHeader.getValue()).replace("\"", "");
supportedApiVersions = "[" + Objects.requireNonNull(supportedApiVersionsHeader.getValue()) + "]";
}
// return these header fields since they should only be saved after successful processing the result!

View file

@ -861,9 +861,9 @@ public class NotesDatabase extends AbstractNotesDatabase {
Log.i(TAG, "Given API version is a valid JSON array but does not contain any valid API versions. Do not update database.");
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("API version does contain a non-valid version.");
throw new IllegalArgumentException("API version does contain a non-valid version: " + apiVersion);
} catch (JSONException e) {
throw new IllegalArgumentException("API version must contain be a JSON array.");
throw new IllegalArgumentException("API version must contain be a JSON array: " + apiVersion);
}
} else {
Log.v(TAG, "Given API version is null. Do not update database");