Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Prior to spring-core 5.1.x calling this method:
would throw IllegalArgumentException. However in spring-core 5.1.x (tested with 5.1.3.BUILD-SNAPSHOT) it doesn't. It simply returns a java.util.Locale object with language="some-locale-that-does-not-exist", region="", country=""
Juergen Hoeller commented
As of 5.1, we only really accept "-" as a valid character in locale strings, driven by #21241 and the parsing of RFC6265 language tags. So the reason why that particular test would fail is a side effect of that "-" leniency; we would have accepted any other non-existing locale before and simply accept "-" in such non-existent locale specifications as well now...
Do you see a specific issue with the tolerance of "-" here? Or did you expect
That's a very valid argument, and we note that the following have the same output accordingly.
System.out.println(StringUtils.parseLocaleString("some-locale-that-does-not-exist")); System.out.println(new Locale("some-locale-that-does-not-exist"));
Yes, indeed. Moreover, the Javadoc for
In light of the above, I am closing this issue.