You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2006/06/12 05:14:40 UTC
svn commit: r413572 -
/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java
Author: matzew
Date: Sun Jun 11 20:14:40 2006
New Revision: 413572
URL: http://svn.apache.org/viewvc?rev=413572&view=rev
Log:
MYFACES-1316, thanks to Neelesh
Modified:
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=413572&r1=413571&r2=413572&view=diff
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java Sun Jun 11 20:14:40 2006
@@ -1066,7 +1066,8 @@
/**
* @param string the component id, that should be a vaild one.
*/
- private void isIdValid(String string) {
+ private void isIdValid(String string)
+ {
//is there any component identifier ?
if(string == null)
@@ -1074,29 +1075,27 @@
//Component identifiers must obey the following syntax restrictions:
//1. Must not be a zero-length String.
- if(string.length()==0){
+ if(string.length()==0)
+ {
throw new IllegalArgumentException("component identifier must not be a zero-length String");
}
//let's look at all chars inside of the ID if it is a valid ID!
char[] chars = string.toCharArray();
- for (int i = 0; i < chars.length; i++) {
- char tmpChar = chars[i];
- //2. First character must be a letter or an underscore ('_').
- if(i==0){
- if(!Character.isLetter(tmpChar) && tmpChar !='_'){
- throw new IllegalArgumentException("component identifier's first character must be a letter or an underscore ('_')! But it is \""+tmpChar+"\"");
- }
- }else{
-
- //3. Subsequent characters must be a letter, a digit, an underscore ('_'), or a dash ('-').
- if(!Character.isDigit(tmpChar) && !Character.isLetter(tmpChar) && tmpChar !='-' && tmpChar !='_'){
- throw new IllegalArgumentException("Subsequent characters of component identifier must be a letter, a digit, an underscore ('_'), or a dash ('-')! But component identifier contains \""+tmpChar+"\"");
- }
+ //2. First character must be a letter or an underscore ('_').
+ if(!Character.isLetter(chars[0]) && chars[0] !='_')
+ {
+ throw new IllegalArgumentException("component identifier's first character must be a letter or an underscore ('_')! But it is \""+chars[0]+"\"");
+ }
+ for (int i = 1; i < chars.length; i++)
+ {
+ //3. Subsequent characters must be a letter, a digit, an underscore ('_'), or a dash ('-').
+ if(!Character.isDigit(chars[i]) && !Character.isLetter(chars[i]) && chars[i] !='-' && chars[i] !='_')
+ {
+ throw new IllegalArgumentException("Subsequent characters of component identifier must be a letter, a digit, an underscore ('_'), or a dash ('-')! But component identifier contains \""+chars[i]+"\"");
}
}
-
}