Issue with Growl and \n Characters in a FacesMessage

Components, Ajax Framework, Utilities and More.
Post Reply
csyperski
Posts: 85
Joined: 16 Apr 2010, 14:36

29 Dec 2010, 17:49

After a lot of chasing my tail I found out that an exception that was thrown by some code I was using contained a \n character in the getMessage() method. I was passing this to a FaceMessage() to be displayed by growl and found that growl fell to pieces when it encounters a message with this character.

So basically in my bean's catch statement I had:

Code: Select all

facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Unable to process license key!" , e.getMessage()  ) );
Which would only show up some of the time, depending on the exception being thrown by the upstream code. I found that one of the messages had a tailing \n character that cause it to not be displayed in a growl message, so I replaced this with

Code: Select all

facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Unable to process license key!" , ( e.getMessage() != null ) ? e.getMessage().replace('\n', ' ') : "") );
So shouldn't growl / PF check for this so the user doesn't have to because you never know what is going to be in the getMessage() statement, especially if it is written by a third party.

I have testing this on the latest snapshot of 2.2 (dec 28th) and the rc2 running on tomcat 6
PrimeFaces 5.2.9, Mojarra 2.2.12, Oracle JDK 8, Tomcat 8, Ubuntu 14.04, Netbeans 8

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider], bigzidane and 15 guests