You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/03/11 01:33:29 UTC

svn commit: r1080409 - in /myfaces/core/trunk/api/src: main/java/javax/faces/component/ test/java/javax/faces/component/

Author: lu4242
Date: Fri Mar 11 00:33:29 2011
New Revision: 1080409

URL: http://svn.apache.org/viewvc?rev=1080409&view=rev
Log:
MYFACES-3064 UIView.createUniqueId shouldn't call encodeNameSpace to build the id.

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIForm.java
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UINamingContainer.java
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewRootTest.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java?rev=1080409&r1=1080408&r2=1080409&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java Fri Mar 11 00:33:29 2011
@@ -780,7 +780,6 @@ public class UIData extends UIComponentB
      */
     public String createUniqueId(FacesContext context, String seed)
     {
-        ExternalContext extCtx = context.getExternalContext();
         StringBuilder bld = __getSharedStringBuilder(context);
 
         Long uniqueIdCounter = (Long) getStateHelper().get(PropertyKeys.uniqueIdCounter);
@@ -789,12 +788,12 @@ public class UIData extends UIComponentB
         // Generate an identifier for a component. The identifier will be prefixed with UNIQUE_ID_PREFIX, and will be unique within this UIViewRoot. 
         if(seed==null)
         {
-            return extCtx.encodeNamespace(bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString());    
+            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString();    
         }
         // Optionally, a unique seed value can be supplied by component creators which should be included in the generated unique id.
         else
         {
-            return extCtx.encodeNamespace(bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(seed).toString());
+            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(seed).toString();
         }
     }
 

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIForm.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIForm.java?rev=1080409&r1=1080408&r2=1080409&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIForm.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIForm.java Fri Mar 11 00:33:29 2011
@@ -53,7 +53,6 @@ public class UIForm extends UIComponentB
      */
     public String createUniqueId(FacesContext context, String seed)
     {
-        ExternalContext extCtx = context.getExternalContext();
         StringBuilder bld = __getSharedStringBuilder(context);
 
         Long uniqueIdCounter = (Long) getStateHelper().get(PropertyKeys.uniqueIdCounter);
@@ -62,12 +61,12 @@ public class UIForm extends UIComponentB
         // Generate an identifier for a component. The identifier will be prefixed with UNIQUE_ID_PREFIX, and will be unique within this UIViewRoot. 
         if(seed==null)
         {
-            return extCtx.encodeNamespace(bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString());    
+            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString();    
         }
         // Optionally, a unique seed value can be supplied by component creators which should be included in the generated unique id.
         else
         {
-            return extCtx.encodeNamespace(bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(seed).toString());
+            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(seed).toString();
         }
     }
 

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UINamingContainer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UINamingContainer.java?rev=1080409&r1=1080408&r2=1080409&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UINamingContainer.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UINamingContainer.java Fri Mar 11 00:33:29 2011
@@ -70,7 +70,6 @@ public class UINamingContainer extends U
      */
     public String createUniqueId(FacesContext context, String seed)
     {
-        ExternalContext extCtx = context.getExternalContext();
         StringBuilder bld = __getSharedStringBuilder(context);
 
         Long uniqueIdCounter = (Long) getStateHelper().get(PropertyKeys.uniqueIdCounter);
@@ -79,12 +78,12 @@ public class UINamingContainer extends U
         // Generate an identifier for a component. The identifier will be prefixed with UNIQUE_ID_PREFIX, and will be unique within this UIViewRoot. 
         if(seed==null)
         {
-            return extCtx.encodeNamespace(bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString());    
+            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString();    
         }
         // Optionally, a unique seed value can be supplied by component creators which should be included in the generated unique id.
         else
         {
-            return extCtx.encodeNamespace(bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(seed).toString());
+            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(seed).toString();
         }
     }
     

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java?rev=1080409&r1=1080408&r2=1080409&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java Fri Mar 11 00:33:29 2011
@@ -320,7 +320,6 @@ public class UIViewRoot extends UICompon
      */
     public String createUniqueId(FacesContext context, String seed)
     {
-        ExternalContext extCtx = context.getExternalContext();
         StringBuilder bld = __getSharedStringBuilder(context);
 
         Long uniqueIdCounter = (Long) getStateHelper().get(PropertyKeys.uniqueIdCounter);
@@ -329,12 +328,12 @@ public class UIViewRoot extends UICompon
         // Generate an identifier for a component. The identifier will be prefixed with UNIQUE_ID_PREFIX, and will be unique within this UIViewRoot. 
         if(seed==null)
         {
-            return extCtx.encodeNamespace(bld.append(UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString());    
+            return bld.append(UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString();    
         }
         // Optionally, a unique seed value can be supplied by component creators which should be included in the generated unique id.
         else
         {
-            return extCtx.encodeNamespace(bld.append(UNIQUE_ID_PREFIX).append(seed).toString());
+            return bld.append(UNIQUE_ID_PREFIX).append(seed).toString();
         }
     }
 

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewRootTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewRootTest.java?rev=1080409&r1=1080408&r2=1080409&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewRootTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewRootTest.java Fri Mar 11 00:33:29 2011
@@ -151,13 +151,14 @@ public class UIViewRootTest extends Abst
     @Test
     public void testCreateUniqueId()
     {
+        /*
         expect(_externalContext.encodeNamespace((String) anyObject())).andAnswer(new IAnswer<String>()
         {
             public String answer() throws Throwable
             {
                 return (String) getCurrentArguments()[0];
             }
-        }).anyTimes();
+        }).anyTimes();*/
         _mocksControl.replay();
         Collection<String> createdIds = new HashSet<String>();
         for (int i = 0; i < 10000; i++)