From fdcbadf17957ded20f1962e2cd86848564d2a431 Mon Sep 17 00:00:00 2001 From: Alik Kurdyukov Date: Tue, 10 Jul 2018 19:01:38 +0300 Subject: [PATCH 1/3] Fix for byte[] serialization --- .../java/com/trulioo/normalizedapi/JSON.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/trulioo/normalizedapi/JSON.java b/src/main/java/com/trulioo/normalizedapi/JSON.java index a79829f..a8cb1dc 100644 --- a/src/main/java/com/trulioo/normalizedapi/JSON.java +++ b/src/main/java/com/trulioo/normalizedapi/JSON.java @@ -3,7 +3,7 @@ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: v1 - * + * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -37,6 +37,8 @@ import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; +import javax.xml.bind.DatatypeConverter; + public class JSON { private ApiClient apiClient; private Gson gson; @@ -52,6 +54,7 @@ public JSON(ApiClient apiClient) { .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) + .registerTypeAdapter(byte[].class, new ByteArrayTypeAdapter()) .create(); } @@ -223,3 +226,26 @@ public LocalDate read(JsonReader in) throws IOException { } } } + +class ByteArrayTypeAdapter extends TypeAdapter { + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(DatatypeConverter.printBase64Binary(value)); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String value = in.nextString(); + return DatatypeConverter.parseBase64Binary(value); + } + } +} From 1a13a7ec2998a332715931dedd80185a802f1d87 Mon Sep 17 00:00:00 2001 From: Alik Kurdyukov Date: Tue, 10 Jul 2018 19:05:26 +0300 Subject: [PATCH 2/3] Project cleanup --- .gitignore | 5 ++++- build.gradle | 2 +- gradlew | 0 3 files changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 gradlew diff --git a/.gitignore b/.gitignore index ef3c847..4698e50 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,7 @@ build !*.prefs !*.classpath -!*.project \ No newline at end of file +!*.project + +.idea +*.iml diff --git a/build.gradle b/build.gradle index c6bc7e8..05cf45c 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'idea' apply plugin: 'eclipse' group = 'com.trulioo' -version = '1.0.0' +version = '1.1.0-SNAPSHOT' buildscript { repositories { diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 09698d199adf21a562fa0fc80c668a322a85966e Mon Sep 17 00:00:00 2001 From: "m.koshcheeva" Date: Tue, 18 Sep 2018 10:46:23 +0300 Subject: [PATCH 3/3] update for UT version --- build.gradle | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 05cf45c..e71e86e 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'idea' apply plugin: 'eclipse' group = 'com.trulioo' -version = '1.1.0-SNAPSHOT' +version = '1.1.0-UT' buildscript { repositories { diff --git a/pom.xml b/pom.xml index 62ae849..9c6b93a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ normalizedapi jar Trulioo Normalized API - 1.0.1 + 1.1.0-UT https://api.globaldatacompany.com/docs Trulioo provides a collection of API methods to help you build business processes powered by the GlobalGateway Normalized API.