remove session.setUser(pre-save user) on email change #8643#8644
remove session.setUser(pre-save user) on email change #8643#8644
Conversation
| } catch (ConfirmEmailException ex) { | ||
| logger.log(Level.INFO, "Unable to send email confirmation link to user id {0}", savedUser.getId()); | ||
| } | ||
| session.setUser(currentUser); |
There was a problem hiding this comment.
Would it make sense here to setUser to the savedUser from line 372?
There was a problem hiding this comment.
I actually tried this first but didn't take good notes. Using savedUser doesn't help.
When you save the email change you get this in server.log and go to "My Data"
[2022-04-25T11:58:34.093-0400] [Payara 5.2021.5] [WARNING] [jsf.externalcontext.flash.response.already.committed] [javax.enterprise.resource.webcontainer.jsf.flash] [tid: _ThreadID=121 _ThreadName=http-thread-pool::http-listener-1(5)] [timeMillis: 1650902314093] [levelValue: 900] [[
JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request.]]
Then, if you click "Account Information" you get a stacktrace and and empty tab:
[2022-04-25T11:59:15.297-0400] [Payara 5.2021.5] [SEVERE] [] [javax.enterprise.resource.webcontainer.jsf.context] [tid: _ThreadID=121 _ThreadName=http-thread-pool::http-listener-1(5)] [timeMillis: 1650902355297] [levelValue: 1000] [[
java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2


What this PR does / why we need it:
When you change your email, the tabs on the user page are blank.
Which issue(s) this PR closes:
Special notes for your reviewer:
I'm not sure why
session.setUser(currentUser)is here (it was added in b13f9be) and removing it seems to help.There are still weird messages in server.log but fewer than the stacktrace seen in #8643.
When you click "Save Changes":
[2022-04-22T14:40:23.267-0400] [Payara 5.2021.5] [WARNING] [jsf.externalcontext.flash.response.already.committed] [javax.enterprise.resource.webcontainer.jsf.flash] [tid: _ThreadID=116 _ThreadName=http-thread-pool::http-listener-1(1)] [timeMillis: 1650652823267] [levelValue: 900] [[
JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request.]]
When you click another tab and then go back to "Account Information":
[2022-04-22T14:40:46.258-0400] [Payara 5.2021.5] [WARNING] [] [] [tid: _ThreadID=116 _ThreadName=http-thread-pool::http-listener-1(1)] [timeMillis: 1650652846258] [levelValue: 900] [[
Response has already been committed, and further write operations are not permitted. This may result in an IllegalStateException being triggered by the underlying application. To avoid this situation, consider adding a Rule
.when(Direction.isInbound().and(Response.isCommitted())).perform(Lifecycle.abort()), or figure out where the response is being incorrectly committed and correct the bug in the offending code.]]Suggestions on how to test this:
#8643 contains steps.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Yes, instead of going to "My Data"on email change, you stay on "Account Information" which looks like this:
Is there a release notes update needed for this change?:
No.
Additional documentation:
None.