TeleSign/java_telesign

TeleSignRequest.encode function feedback

Closed this issue · 1 comments

Hi TeleSign team,

In the TeleSignRequest.encode function there is the line:

  byte[] decoded_key = Base64.decodeBase64(key);

This needs to be changed to:

byte[] decoded_key = Base64.decodeBase64(key.getBytes());
as Base64.decodeBase64 does not take a Java String as an argument, but a byte array.
Andrew"

Below is the error he was receiving:

Today (7/31/14) I have pulled the Telesign Java SDK from git and built it running the "ant jar" command.
But when I try "ant junit" all test fail:

andrew@MobileBaseState:~/CodeRepo/java_telesign$ ant junit
Buildfile: /home/andrew/CodeRepo/java_telesign/build.xml

clean:
[delete] Deleting directory /home/andrew/CodeRepo/java_telesign/build

compile_unittest:
[mkdir] Created dir: /home/andrew/CodeRepo/java_telesign/build/classes
[javac] Compiling 9 source files to /home/andrew/CodeRepo/java_telesign/build/classes
[javac] Compiling 4 source files to /home/andrew/CodeRepo/java_telesign/build/classes

jar_unit:
[mkdir] Created dir: /home/andrew/CodeRepo/java_telesign/build/jar
[jar] Building jar: /home/andrew/CodeRepo/java_telesign/build/jar/TeleSign.jar

junit:
[junit] Running com.telesign.PhoneIdTest
[junit] Tests run: 0, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec
[junit] Test com.telesign.PhoneIdTest FAILED
[junit] Running com.telesign.TeleSignRequestTest
[junit] Tests run: 0, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec
[junit] Test com.telesign.TeleSignRequestTest FAILED
[junit] Running com.telesign.VerifyTest
[junit] Tests run: 0, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec
[junit] Test com.telesign.VerifyTest FAILED
[junit] Running com.telesign.response.ResponseTest
[junit] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.075 sec

BUILD SUCCESSFUL
Total time: 1 second
andrew@MobileBaseState:~/CodeRepo/java_telesign$

Also, when I try to use the built jar file I also get the error:

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.decodeBase64(Ljava/lang/String;)[B
at com.telesign.util.TeleSignRequest.encode(Unknown Source)
at com.telesign.util.TeleSignRequest.executeRequest(Unknown Source)
at com.telesign.verify.Verify.call(Unknown Source)
at com.telesign.verify.Verify.call(Unknown Source)
when I run the commands:

Verify verify = new Verify(customer_id, secret_key);
VerifyResponse ret = verify.call("16502007906");

or

PhoneId phoneId = new PhoneId(customer_id, secret_key);
PhoneIdContactResponse contactResponse = phoneId.contact(phoneNumber, "UNKN");
The error comes when I run the "contact" or the "call" command.

What version of Java are you running?