Scenario:
While reading an Action via REST interface, an error occurs in the getData of the corresponding Datasource and is added to the FieldProcessor.
But this error is not in the returned JSON and the messages of the Action object.
Reproduction:
Use the example application. Add an error to the PersonDataSource.getData: fieldProcessor.addErrorMessage("MYERROR");
Add a JSON Messageconverter to enable the REST interface
Call the Action on Rest: /service/manager/appname/rest/action/personEvent/editPerson/1
-> messages are empty
Source:
I tried to trace this issue down an found the following lines:
CallableAction.retrieveData // Messages/Errors are removed (!) from the Session and added to the action 243ff. if (!dataOk) { Messages messages = elementHelper.getMessages(environment); messages.getMessageList().removeAll(addedMessages); Messages actionMessages = new Messages(); actionMessages.getMessageList().addAll(addedMessages); getAction().setMessages(actionMessages); } ApplicationProvider.processAction // Messages/Errors from action are overridden with the (empty) Messages from the Session 868ff Messages messages = elementHelper.removeMessages(environment); // already empty list is returned. see above if (null != messages) { //nullcheck but messages is empty list messages.setRef(actionId); action.setMessages(messages); //messages set to empty }
Tested on 1.19.1 but i guess this applies to all 1.x versions
Can you confirm this error and do you see any immediate workaround?