[
https://issues.jboss.org/browse/GTNPORTAL-1775?page=com.atlassian.jira.pl...
]
Marek Posolda commented on GTNPORTAL-1775:
------------------------------------------
I agree that it's not obvious from javadoc if it should ignore \ character in element
part or not. But from sentence in javadoc for method store described in my first comment
for this issue, it makes sense to me that \ character is ignored in element part as well.
And I need to mention that default ResourceBundle in java is really ignoring \ characters
in element part. You can try program "ResourceTest" which is attached to WAR.
It's doing something like this:
public static void main(String[] args) throws Exception
{
ResourceBundle bundle =
ResourceBundle.getBundle("locale.portlet.Language-ext", new
Locale("en"));
String str = bundle.getString("prefix.key");
System.out.println(str);
}
and output of this program is: Hello, This character will not be escaped in portlet :
(properties file contains this: prefix.key=Hello, This character will not be escaped in
portlet \: )
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, worked
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#st...
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