You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Markus Jung (Jira)" <de...@myfaces.apache.org> on 2023/12/04 13:56:00 UTC
[jira] [Created] (MYFACES-4646) Incorrect formatting on String built by ValidatorException
Markus Jung created MYFACES-4646:
------------------------------------
Summary: Incorrect formatting on String built by ValidatorException
Key: MYFACES-4646
URL: https://issues.apache.org/jira/browse/MYFACES-4646
Project: MyFaces Core
Issue Type: Bug
Reporter: Markus Jung
See this example test:
{code:java}
@Test
public void facesMessageEmptyDetail()
{
FacesMessage message = new FacesMessage("Summary", "");
ValidatorException exception = new ValidatorException(message);
assertEquals("Summary", exception.getMessage());
} {code}
It currenty fails as the Exception message being built is "Summary: " because ValidatorException#facesMessageToString only [only checks for null|https://github.com/apache/myfaces/blob/main/api/src/main/java/jakarta/faces/validator/ValidatorException.java#L78], empty strings are not being taken care of.
Actually, if you create a FacesMessage with detail=null it will [return the summary as the detail|https://github.com/apache/myfaces/blob/main/api/src/main/java/jakarta/faces/application/FacesMessage.java#L218]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)