Merged V2.1 to HEAD

6295, 6296: EHCache patch on 1.3.0 and related classpath fixes
   6300: WCM-509 - Usernames with '@'
   6301: FacesHelper.makeLegalId()
   6302: Portlet fixes to remove hardcoded "Company Home" string
   6305: Fix for AWC-1440 - Potential NullPointerException in workflow history
   6306: Fix to error message when incorrect parameters are passed to number range constraint


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6718 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 12:33:37 +00:00
parent 10236f165a
commit bf4349d64d
2 changed files with 5 additions and 9 deletions

View File

@@ -24,6 +24,8 @@
*/
package org.alfresco.web.app.servlet;
import java.util.regex.Pattern;
import javax.faces.FactoryFinder;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
@@ -51,6 +53,7 @@ import org.apache.commons.logging.LogFactory;
public final class FacesHelper
{
private static Log logger = LogFactory.getLog(FacesHelper.class);
private static Pattern FACES_ID_PATTERN = Pattern.compile("[^a-z^A-Z^_]?[^a-z^A-Z^_^-]");
/**
* Private constructor
@@ -167,14 +170,7 @@ public final class FacesHelper
{
if (id != null)
{
// replace illegal ID characters with an underscore
id = id.replace(':', '_');
id = id.replace(' ', '_');
id = id.replace('.', '_');
id = id.replace('+', '_');
// TODO: check all other illegal characters - only allowed dash and underscore
// TODO: use regular expression to do check and replacment of characters
id = FACES_ID_PATTERN.matcher(id).replaceAll("_");
}
return id;