[gatein-issues] [JBoss JIRA] Commented: (GTNPORTAL-1775) Bad handling of special characters by portal ResourceBundle
Minh Hoang TO (JIRA)
jira-events at lists.jboss.org
Mon Feb 28 04:40:05 EST 2011
[ https://issues.jboss.org/browse/GTNPORTAL-1775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12584905#comment-12584905 ]
Minh Hoang TO commented on GTNPORTAL-1775:
------------------------------------------
{quote}
*The key contains all of the characters in the line starting with the first non-white space character and up to, but not including, the first unescaped '=', ':', or white space character other than a line terminator*. All of these key termination characters may be included in the key by escaping them with a preceding backslash character; for example,
\:\=
would be the two-character key ":=". Line terminator characters can be included using \r and \n escape sequences. *Any white space after the key is skipped; if the first non-white space character after the key is '=' or ':', then it is ignored and any white space characters after it are also skipped*. All remaining characters on the line become part of the associated element string; if there are no remaining characters, the element is the empty string "".
{quote}
The paragraph is extracted from the Javadoc of load(Reader) method in Properties. As i understand, the special character =, : is ignored while processing for key. In the associated element part, only the first =, : is skipped. So i think reported use case is expected.
> Bad handling of special characters by portal ResourceBundle
> -----------------------------------------------------------
>
> Key: GTNPORTAL-1775
> URL: https://issues.jboss.org/browse/GTNPORTAL-1775
> Project: GateIn Portal
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 3.1.0-GA
> Environment: GateIn trunk rev 5668 , GateIn common librayr version: common-common-2.0.3-GA
> Reporter: Marek Posolda
> Assignee: Minh Hoang TO
> Labels: portal-s48, review_julien
> Attachments: localization-test-portlet-0.0.1-SNAPSHOT.war
>
> Original Estimate: 4 hours
> Remaining Estimate: 4 hours
>
> It seems that properties file are not handled correctly by GateIn portal. For example this property:
> prefix.key=Hello, This character will not be escaped in portlet \:
> is read by portal ResourceBundle implementation ( org.gatein.common.i18n.ParentChildResourceBundle ) as "Hello, This character will not be escaped in portlet \:" . But special characters like ":" should be escaped and first "\" should be ignored by ResourceBundle.
> In javadoc to Properties class http://download.oracle.com/javase/6/docs/api/java/util/Properties.html#store%28java.io.Writer,%20java.lang.String%29 can be seen: The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded.
> And some editors like JBoss Tools Property Editor are saving special characters with backslash and this backslash is now incorrectly read by portal and shown in portlets.
> I am attaching example portlet application, which can be used to simulate the issue. Sources are attached as well.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the gatein-issues
mailing list