diff --git a/README.md b/README.md
index 9e7fb3672..4f3ea29ef 100644
--- a/README.md
+++ b/README.md
@@ -104,13 +104,13 @@ If you are using Maven, you need to add the following dependency:
com.yoti
yoti-sdk-impl
- 2.6.0
+ 2.6.1
```
If you are using Gradle, here is the dependency to add:
-`compile group: 'com.yoti', name: 'yoti-sdk-impl', version: '2.6.0'`
+`compile group: 'com.yoti', name: 'yoti-sdk-impl', version: '2.6.1'`
You will find all classes packaged under `com.yoti.api`
diff --git a/pom.xml b/pom.xml
index 736890860..a0476fc11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.yoti
yoti-sdk
pom
- 2.6.0
+ 2.6.1
Yoti SDK
Java SDK for simple integration with the Yoti platform
https://github.com/getyoti/yoti-java-sdk
diff --git a/yoti-sdk-api/pom.xml b/yoti-sdk-api/pom.xml
index 7f9d46020..f9ba41132 100644
--- a/yoti-sdk-api/pom.xml
+++ b/yoti-sdk-api/pom.xml
@@ -11,7 +11,7 @@
com.yoti
yoti-sdk-parent
- 2.6.0
+ 2.6.1
../yoti-sdk-parent
diff --git a/yoti-sdk-impl/pom.xml b/yoti-sdk-impl/pom.xml
index 77b7cea14..ba7552fa6 100644
--- a/yoti-sdk-impl/pom.xml
+++ b/yoti-sdk-impl/pom.xml
@@ -11,7 +11,7 @@
com.yoti
yoti-sdk-parent
- 2.6.0
+ 2.6.1
../yoti-sdk-parent
diff --git a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/DocumentDetailsAttributeParser.java b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/DocumentDetailsAttributeParser.java
index c74e85da5..cc75e0c94 100644
--- a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/DocumentDetailsAttributeParser.java
+++ b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/DocumentDetailsAttributeParser.java
@@ -2,13 +2,14 @@
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
+import java.util.Arrays;
import com.yoti.api.client.Date;
import com.yoti.api.client.DocumentDetails;
class DocumentDetailsAttributeParser {
- private static final String MINIMUM_ACCEPTABLE = "([A-Za-z_]*) ([A-Za-z]{3}) ([A-Za-z0-9]{1}).*";
+ private static final int MINIMUM_ACCEPTABLE = 3;
private static final int TYPE_INDEX = 0;
private static final int COUNTRY_INDEX = 1;
private static final int NUMBER_INDEX = 2;
@@ -16,11 +17,22 @@ class DocumentDetailsAttributeParser {
private static final int AUTHORITY_INDEX = 4;
DocumentDetails parseFrom(String attributeValue) throws UnsupportedEncodingException, ParseException {
- if (attributeValue == null || !attributeValue.matches(MINIMUM_ACCEPTABLE)) {
+ if (attributeValue == null || attributeValue.isEmpty()) {
throw new IllegalArgumentException("Unable to parse attribute value to a DocumentDetails");
}
+
String[] attributes = attributeValue.split(" ");
+ if (attributes.length < MINIMUM_ACCEPTABLE) {
+ throw new IllegalArgumentException("Unable to parse attribute value to a DocumentDetails");
+ }
+
+ for (String s : attributes) {
+ if (s == null || s.isEmpty()) {
+ throw new IllegalArgumentException("Invalid Document Details value, multiple consecutive spaces");
+ }
+ }
+
return DocumentDetailsAttributeValue.builder()
.withType(attributes[TYPE_INDEX])
.withIssuingCountry(attributes[COUNTRY_INDEX])
diff --git a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/call/YotiConstants.java b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/call/YotiConstants.java
index 29ab4704d..a84b52c8e 100644
--- a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/call/YotiConstants.java
+++ b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/call/YotiConstants.java
@@ -21,7 +21,7 @@ private YotiConstants() {}
public static final String CONTENT_TYPE_JPEG = "image/jpeg";
public static final String JAVA = "Java";
- public static final String SDK_VERSION = JAVA + "-2.6.0";
+ public static final String SDK_VERSION = JAVA + "-2.6.1";
public static final String SIGNATURE_ALGORITHM = "SHA256withRSA";
public static final String ASYMMETRIC_CIPHER = "RSA/NONE/PKCS1Padding";
public static final String SYMMETRIC_CIPHER = "AES/CBC/PKCS7Padding";
diff --git a/yoti-sdk-impl/src/test/java/com/yoti/api/client/spi/remote/DocumentDetailsAttributeParserConsecutiveSpacesTest.java b/yoti-sdk-impl/src/test/java/com/yoti/api/client/spi/remote/DocumentDetailsAttributeParserConsecutiveSpacesTest.java
new file mode 100644
index 000000000..0340d46cd
--- /dev/null
+++ b/yoti-sdk-impl/src/test/java/com/yoti/api/client/spi/remote/DocumentDetailsAttributeParserConsecutiveSpacesTest.java
@@ -0,0 +1,33 @@
+package com.yoti.api.client.spi.remote;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+
+@RunWith(Parameterized.class)
+public class DocumentDetailsAttributeParserConsecutiveSpacesTest {
+
+ @Parameterized.Parameters(name = "{index}: Test with {0}")
+ public static Iterable