Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCK Challenge: numConverterGetAsObjectLocaleTest uses improper format/locale combination #1733

Closed
brideck opened this issue Nov 22, 2022 · 0 comments · Fixed by #1743
Closed
Labels
accepted Accepted certification request challenge TCK challenge pr-available

Comments

@brideck
Copy link
Contributor

brideck commented Nov 22, 2022

Challenged Tests:
com.sun.ts.tests.jsf.api.jakarta_faces.convert.numberconverter.URLClient#numConverterGetAsObjectLocaleTest

TCK Version:
Jakarta Faces 4.0.x

Tested Implementation:
Open Liberty -- containing MyFaces 4.0

Description:
This test is designed to "ensure getAsObject() picks up the Locale from the appropriate locations and uses it to create its value." However, it has the added (probably unintentional) wrinkle of testing with a mismatched combination of number format and locale, namely the French locale and the number 5.5. The French locale uses a comma delimiter for decimal numbers, so the proper number to use in this test would be 5,5. Because of this mismatch, the control case using java.text.NumberFormat ends up parsing 5.5 down to just 5 since it hits a character ('.') that is neither a digit nor a recognized delimiter.

In the 4.0 release, MyFaces added a quality-of-life improvement that flags this type of scenario, where an input string is not completely parsed, as an error. This results in this exception when running this test:

Caused by: jakarta.faces.convert.ConverterException: j_id__v_0: '5.5' nest pas un nombre.
    at jakarta.faces.convert.NumberConverter.getAsObject(NumberConverter.java:163)
    at com.sun.ts.tests.jsf.api.jakarta_faces.convert.numberconverter.TestServlet.numConverterGetAsObjectLocaleTest(TestServlet.java:384)

This test should be updated to use the proper format of 5,5. It would still be covering the stated design intention, and no longer inadvertently be testing a corner case where implementations may differ in how it is handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Accepted certification request challenge TCK challenge pr-available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants