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

StateManager#STATE_SAVING_METHOD_PARAM_NAME specifies wrong default #1999

Open
BalusC opened this issue Jan 25, 2025 · 0 comments
Open

StateManager#STATE_SAVING_METHOD_PARAM_NAME specifies wrong default #1999

BalusC opened this issue Jan 25, 2025 · 0 comments
Labels
mojarra-implemented API issue implemented by Mojarra
Milestone

Comments

@BalusC
Copy link
Member

BalusC commented Jan 25, 2025

Unsure how that's possible but already in 2.3 https://github.com/eclipse-ee4j/mojarra/blob/2.3/impl/src/main/java/javax/faces/application/StateManager.java#L56-L57 and 4.0 https://github.com/eclipse-ee4j/mojarra/blob/4.0/impl/src/main/java/jakarta/faces/application/StateManager.java#L55-L56 the StateManager#STATE_SAVING_METHOD_PARAM_NAME javadoc is wrong

     * <p>
     * If this parameter is not specified, the default value is the value of the constant
     * {@link #STATE_SAVING_METHOD_CLIENT}.
     * </p>

This is not what the spec says https://jakarta.ee/specifications/faces/4.0/jakarta-faces-4.0#a6088

jakarta.faces.STATE_SAVING_METHOD —The location where state information is saved. Valid values are “server” (typically saved in HttpSession) and “client (typically saved as a hidden field in the subsequent form submit). If not specified, the default value “server” must be used. When examining the parameter value, the runtime must ignore case.

This was also the correct behavior in Mojarra 2.3, 4.0 and 4.1, however today when working on h:form prependId in Mojarra 5.0 I noticed it suddenly emitted a client state saved string in the hidden input field in a blank project. Backtracking the cause, this appeared to be the consequence of FacesConfig.ContextParam rework in #1879 whereby the javadocs of context param names were basically re-read and implemented literally without much afterthought.

Also unbelieveable this slipped through the TCK. On the other hand, it's impossible to distinguish whether the generated value of the view state hidden field represents client or server state based on the spec alone as the impls may choose their own way. It could only be validated based on observable and testable behavior of forms which are submitted against an expired HTTP session ("sever" would throw ViewExpiredException, "client" would continue to work fine) but even this is not per definition guranteed by the spec (as far as I see).

@BalusC BalusC added this to the 5.0 milestone Jan 25, 2025
BalusC added a commit that referenced this issue Jan 25, 2025
BalusC added a commit that referenced this issue Feb 1, 2025
Fix #1999: default of jakarta.faces.STATE_SAVING_METHOD is actually "server"
BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue Feb 1, 2025
Fix jakartaee/faces#1999: default of jakarta.faces.STATE_SAVING_METHOD is actually "server"
@BalusC BalusC added the mojarra-implemented API issue implemented by Mojarra label Feb 1, 2025
@BalusC BalusC reopened this Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mojarra-implemented API issue implemented by Mojarra
Projects
None yet
Development

No branches or pull requests

1 participant