[richfaces-issues] [JBoss JIRA] (RF-12764) rich:select - javascript error when using myfaces with french locale
Brian Leathem (JIRA)
issues at jboss.org
Fri Jun 6 17:42:16 EDT 2014
[ https://issues.jboss.org/browse/RF-12764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974375#comment-12974375 ]
Brian Leathem commented on RF-12764:
------------------------------------
A github pull request with the proposed patch would be welcome. We can then review the patch and run our tests to check for regressions.
> rich:select - javascript error when using myfaces with french locale
> --------------------------------------------------------------------
>
> Key: RF-12764
> URL: https://issues.jboss.org/browse/RF-12764
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.3.0.CR2
> Reporter: Dupont Dupont
> Labels: patch_proposed
> Fix For: 4.5-Tracking
>
>
> Using RF 4.3.0.CR2, using rich:select with french locale on Myfaces produces the following javascript error :
> {code}
> Uncaught SyntaxError: Unexpected identifier.
> {code}
> It appears when javax.faces.component.UISelectOne.INVALID error message has a value containing a single quote.
> To reproduce it, just add the following line in your jsf messages properties :
> {code}
> javax.faces.component.UISelectOne.INVALID = {0} : Erreur de validation : la valeur n''est pas valide.
> {code}
> And add a rich:select in your JSF page.
> We end up with the javascript :
> {code}
> RichFaces.csv.addMessage({ 'UISELECTONE_INVALID': {detail:'{0} : Erreur de validation : la valeur n'est pas valide.',summary:'{0} : Erreur de validation : la valeur n'est pas valide.',severity:2} });
> {code}
> This error impacts users of Websphere 8 (tested on 8.0.0.3) with french locale (myfaces provides a default message containing simple quotes).
> Resolved locally by modifying AddCSVMessageScript#appendcript
> But perhaps I've missed some side effects.
> {code:java}
> @Override
> public void appendScript(Appendable target) throws IOException {
> String summary = facesMessage.getSummary();
> String detail = facesMessage.getDetail();
> int severity = facesMessage.getSeverity().getOrdinal();
> StringBuilder builder = new StringBuilder();
> ScriptUtils.appendEncodedString(builder, summary);
> summary = builder.toString();
> builder = new StringBuilder();
> ScriptUtils.appendEncodedString(builder, detail);
> detail = builder.toString();
>
> String script = MessageFormat.format(MESSAGE_OBJECT, messageId, summary, detail, severity);
> target.append(script);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
More information about the richfaces-issues
mailing list