Closed ducnh298 closed 2 years ago
@ducnh298 Thank you for raising this issue. We will review your PR and work to have this resolved.
Hello there!
Looks like my PR doesn't solve anything (of course, my bad in checking back code) Is there any way to fix this issue, Or maybe the sandbox API key i'm using, its response is different from production.
Looking forward to hearing from you soon!
Best, Duc Nguyen Huu
I believe you'll want to do this:
List<Map<String, String>> result = shipengine.validateAddresses(unvalidatedAddress);
I've updated the readme as well, let me know if that does not resolve your issue.
@sushithegreat No, it isn't my issue. You get it wrong. Please take a look at my first comment. I have 2 pics to describe it. I have issue in file "src/main/java/com/shipengine/InternalClient.java" at function "checkResponseForErrors( )"
You should not be calling any of the methods in the InternalClient directly, only using methods in ShipEngine. What does your actual code look like?
Yes I'm using methods in ShipEngine.
But when Shipengine meet error (such as incorrect address, carrier, service, etc...), I have to use debug mode, create a breakpoint in InternalClient to get the correct response. Otherwise, 100% times , this exception is thrown: "class java.lang.String cannot be cast to class java.util.ArrayList (java.lang.String and java.util.ArrayList are in module java.base of loader 'bootstrap')"
Which prevents me from getting specific error messages, to know what is wrong with my shipment details.
I'm not able to reproduce this error. Can you post an example line of code?
Does your error response look like this ? A map with String type key, but both String and ArrayList type value
In src/main/java/com/shipengine/InternalClient.java func checkResponseForErrors( ) you initiate a Map<String, ArrayList> to get that response:
String cannot be cast to ArrayList and this exception's throw:
class java.lang.String cannot be cast to class java.util.ArrayList (java.lang.String and java.util.ArrayList are in module java.base of loader 'bootstrap')
Fixed in #24
Hi! Can you release new version maven's dependency (include this issue fixed) ?
I'll publish a release ASAP, just waiting on some access control changes on our end
Great, thanks!
Vào 5:10, Th 7, 22 thg 10, 2022 Susi Rathmann @.***> đã viết:
I'll publish a release ASAP, just waiting on some access control changes on our end
— Reply to this email directly, view it on GitHub https://github.com/ShipEngine/shipengine-java/issues/19#issuecomment-1287484553, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ6WI5XJN6POA4N6FZITHG3WEMIEDANCNFSM6AAAAAARBDORXA . You are receiving this because you were mentioned.Message ID: @.***>
Your response return Map<String, String+ArrayList>:
In src/main/java/com/shipengine/InternalClient.java func checkResponseForErrors( ) you initiate a Map<String, ArrayList> to get that response:
then this ClassCastException's always thrown (should be ShipengineException)
class java.lang.String cannot be cast to class java.util.ArrayList (java.lang.String and java.util.ArrayList are in module java.base of loader 'bootstrap')
Please help me solve this