facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
393 stars 324 forks source link

ArrayIndexOutOfBoundsException on invalid postal code #460

Open CoenNeefjesTrackbee opened 1 month ago

CoenNeefjesTrackbee commented 1 month ago

Which SDK version are you using?

19.0.2

What's the issue?

When executing a postal code validation on a String containing only "-" an ArrayIndexOutOfBoundsException is thrown.

Steps/Sample code to reproduce the issue

Call ServerSideApiUtil.normalize("-", "zp") from anywhere in your codebase.

Observed Results:

An ArrayIndexOutOfBoundsException is thrown: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

Expected Results:

I would expect an IllegalArgumentException to be thrown instead.