pnicolucci closed pull request #9: MYFACES-4239: Multiple performance 
improvements
URL: https://github.com/apache/myfaces/pull/9
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java 
b/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
index 6ec1321ae..6b3059b59 100755
--- a/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
@@ -2235,19 +2235,19 @@ private void _handleListenerForAnnotations(FacesContext 
context, Object inspecte
         List<ListenerFor> listenerForList = null;
         boolean isCachedList = false;
         
-        if(isProduction && _classToListenerForMap.containsKey(inspectedClass))
+        if(isProduction)
         {
             listenerForList = _classToListenerForMap.get(inspectedClass);
-            if(listenerForList == null)
-            {
-                return; //class has been inspected and did not contain any 
listener annotations
-            }
-            else if (listenerForList.isEmpty())
+
+            if (listenerForList != null)
             {
-                return;
+                if (listenerForList.isEmpty())
+                {
+                    return; //class has been inspected and did not contain any 
listener annotations
+                }
+                
+                isCachedList = true;    // else annotations were found in the 
cache
             }
-            
-            isCachedList = true;    // else annotations were found in the cache
         }
 
         if(listenerForList == null) //not in production or the class hasn't 
been inspected yet
@@ -2378,19 +2378,19 @@ private void 
_handleResourceDependencyAnnotations(FacesContext context, Class<?>
         List<ResourceDependency> dependencyList = null;
         boolean isCachedList = false;
         
-        if(isProduction && 
_classToResourceDependencyMap.containsKey(inspectedClass))
+        if(isProduction)
         {
             dependencyList = _classToResourceDependencyMap.get(inspectedClass);
-            if(dependencyList == null)
-            {
-                return; //class has been inspected and did not contain any 
resource dependency annotations
-            }
-            else if (dependencyList.isEmpty())
+
+            if (dependencyList != null)
             {
-                return;
+                if (dependencyList.isEmpty())
+                {
+                    return; //class has been inspected and did not contain any 
resource dependency annotations
+                }
+                
+                isCachedList = true;    // else annotations were found in the 
cache
             }
-            
-            isCachedList = true;    // else annotations were found in the cache
         }
         
         if(dependencyList == null)  //not in production or the class hasn't 
been inspected yet
diff --git 
a/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
 
b/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
index b468a7915..60f67cd0d 100755
--- 
a/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
+++ 
b/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
@@ -844,11 +844,18 @@ private String encodeURL(String baseUrl, Map<String, 
List<String>> parameters)
             }
         }        
 
+        boolean hasParams = paramMap != null && paramMap.size()>0;
+
+        if (!hasParams && fragment == null)
+        {
+            return baseUrl;
+        }
+
         // start building the new URL
         StringBuilder newUrl = new StringBuilder(baseUrl);
 
         //now add the updated param list onto the url
-        if (paramMap != null && paramMap.size()>0)
+        if (hasParams)
         {
             boolean isFirstPair = true;
             for (Map.Entry<String, List<String>> pair : paramMap.entrySet())
@@ -884,7 +891,8 @@ private String encodeURL(String baseUrl, Map<String, 
List<String>> parameters)
         //add the fragment back on (if any)
         if (fragment != null)
         {
-            newUrl.append(URL_FRAGMENT_SEPERATOR + fragment);
+            newUrl.append(URL_FRAGMENT_SEPERATOR);
+            newUrl.append(fragment);
         }
 
         return newUrl.toString();
diff --git 
a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
 
b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
index a754fef61..c598bbebf 100644
--- 
a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
+++ 
b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
@@ -92,8 +92,8 @@
     private boolean _isUTF8;
     
     private String _startElementName;
-    private Boolean _isInsideScript;
-    private Boolean _isStyle;
+    private boolean _isInsideScript = false;
+    private boolean _isStyle = false;
     private Boolean _isTextArea;
     private UIComponent _startElementUIComponent;
     private boolean _startTagOpen;
@@ -374,14 +374,14 @@ public void startElement(String name, UIComponent 
uiComponent) throws IOExceptio
         if(isScript(_startElementName))
         {
             // handle a <script> start
-            _isInsideScript = Boolean.TRUE;
-            _isStyle = Boolean.FALSE;
+            _isInsideScript = true;
+            _isStyle = false;
             _isTextArea = Boolean.FALSE;
         }
         else if (isStyle(_startElementName))
         {
-            _isInsideScript = Boolean.FALSE;
-            _isStyle = Boolean.TRUE;
+            _isInsideScript = false;
+            _isStyle = true;
             _isTextArea = Boolean.FALSE;
         }
     }
@@ -522,7 +522,7 @@ private void resetStartedElement()
         _startElementName = null;
         _startElementUIComponent = null;
         _passThroughAttributesMap = null;
-        _isStyle = null;
+        _isStyle = false;
         _isTextArea = null;
     }
 
@@ -804,11 +804,11 @@ private void writeEndTag(String name)
         if (isScript(name))
         {
             // reset _isInsideScript
-            _isInsideScript = Boolean.FALSE;
+            _isInsideScript = false;
         }
         else if (isStyle(name))
         {
-            _isStyle = Boolean.FALSE;
+            _isStyle = false;
         }
 
         _currentWriter.write("</");
@@ -931,7 +931,7 @@ private void encodeAndWriteURIAttribute(String name, Object 
value) throws IOExce
             }
             */
             //_writer.write(strValue);
-            
org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder.encodeURIAtributte(_currentWriter,
+            
org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder.encodeURIAttribute(_currentWriter,
                             strValue, _characterEncoding);
         }
         _currentWriter.write('"');
@@ -1024,8 +1024,7 @@ private boolean isScriptOrStyle()
     {
         //initializeStartedTagInfo();
 
-        return (_isStyle != null && _isStyle.booleanValue()) ||
-                (_isInsideScript != null && _isInsideScript.booleanValue());
+        return _isStyle || _isInsideScript;
     }
     
     /**
@@ -1040,7 +1039,7 @@ private boolean isScript(String element)
     
     private boolean isScript()
     {
-        return (_isInsideScript != null && _isInsideScript.booleanValue());
+        return _isInsideScript;
     }
     
     private boolean isStyle(String element)
@@ -1050,7 +1049,7 @@ private boolean isStyle(String element)
     
     private boolean isStyle()
     {
-        return (_isStyle != null && _isStyle.booleanValue());
+        return _isStyle;
     }
 
     private boolean isTextarea()
diff --git 
a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
 
b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
index c136ce8d0..d137808a3 100644
--- 
a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
+++ 
b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
@@ -71,10 +71,13 @@ public static String encode (String string,
 
         StringBuilder sb = null;    //create later on demand
         String app;
-        char c;
-        for (int i = 0; i < string.length (); ++i)
+        char c = ' ';
+        char prevC;
+        int length = string.length();
+        for (int i = 0; i < length; ++i)
         {
             app = null;
+            prevC = c;
             c = string.charAt(i);
             
             // All characters before letters
@@ -88,7 +91,7 @@ public static String encode (String string,
                     case '>': app = "&gt;"; break;      //>
                     case ' ':
                         if (encodeSubsequentBlanksToNbsp &&
-                                (i == 0 || (i - 1 >= 0 && string.charAt(i - 1) 
== ' ')))
+                                prevC == ' ')
                         {
                             //Space at beginning or after another space
                             app = "&#160;";
@@ -202,10 +205,13 @@ public static void encode (Writer writer, String string,
 
         int start = 0;
         String app;
-        char c;
-        for (int i = 0; i < string.length (); ++i)
+        char c = ' ';
+        char prevC;
+        int length = string.length();
+        for (int i = 0; i < length; ++i)
         {
             app = null;
+            prevC = c;
             c = string.charAt(i);
             
             // All characters before letters
@@ -219,7 +225,7 @@ public static void encode (Writer writer, String string,
                     case '>': app = "&gt;"; break;      //>
                     case ' ':
                         if (encodeSubsequentBlanksToNbsp &&
-                                (i == 0 || (i - 1 >= 0 && string.charAt(i - 1) 
== ' ')))
+                                prevC == ' ')
                         {
                             //Space at beginning or after another space
                             app = "&#160;";
@@ -304,9 +310,9 @@ else if (encodeNonLatin && (int)c > 0x80)
         {
             writer.write(string);
         }
-        else if (start < string.length())
+        else if (start < length)
         {
-            writer.write(string,start,string.length()-start);
+            writer.write(string,start,length-start);
         }
     }
 
@@ -359,12 +365,14 @@ public static void encode (char[] string, int offset, int 
length,
 
         //StringBuilder sb = null;    //create later on demand
         String app;
-        char c;
+        char c = ' ';
+        char prevC;
         int start = offset;
         
         for (int i = offset; i < offset + realLength; ++i)
         {
             app = null;
+            prevC = c;
             c = string[i];
 
             // All characters before letters
@@ -378,7 +386,7 @@ public static void encode (char[] string, int offset, int 
length,
                     case '>': app = "&gt;"; break;      //>
                     case ' ':
                         if (encodeSubsequentBlanksToNbsp &&
-                                (i == 0 || (i - 1 >= 0 && string[i - 1] == ' 
')))
+                                prevC == ' ')
                         {
                             //Space at beginning or after another space
                             app = "&#160;";
@@ -484,14 +492,15 @@ else if (start < offset+realLength)
      * @return
      * @throws IOException
      */
-    public static String encodeURIAtributte(final String string, final String 
characterEncoding)
+    public static String encodeURIAttribute(final String string, final String 
characterEncoding)
         throws IOException
     {
         StringBuilder sb = null;    //create later on demand
         String app;
         char c;
         boolean endLoop = false;
-        for (int i = 0; i < string.length (); ++i)
+        int length = string.length();
+        for (int i = 0; i < length; ++i)
         {
             app = null;
             c = string.charAt(i);
@@ -632,7 +641,7 @@ public static String encodeURIAtributte(final String 
string, final String charac
             }
             else if (c == '%')
             {
-                if (i + 2 < string.length())
+                if (i + 2 < length)
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
@@ -654,7 +663,7 @@ else if (c == '%')
             }
             else if (c == '?' || c == '#')
             {
-                if (i+1 < string.length())
+                if (i+1 < length)
                 {
                     // The remaining part of the URI are data that should be 
encoded
                     // using the document character encoding.
@@ -762,7 +771,8 @@ private static String encodeURIQuery(final String string, 
final String character
         String app;
         char c;
         boolean endLoop = false;
-        for (int i = 0; i < string.length (); ++i)
+        int length = string.length();
+        for (int i = 0; i < length; ++i)
         {
             app = null;
             c = string.charAt(i);
@@ -791,7 +801,7 @@ private static String encodeURIQuery(final String string, 
final String character
             }
             else if (c == '%')
             {
-                if (i + 2 < string.length())
+                if (i + 2 < length)
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
@@ -812,7 +822,7 @@ else if (c == '%')
             }
             else if (c == '&')
             {
-                if (i+4 < string.length() )
+                if (i+4 < length )
                 {
                     if ('a' == string.charAt(i+1) &&
                         'm' == string.charAt(i+2) &&
@@ -875,7 +885,7 @@ else if (c == '&')
      * @return
      * @throws IOException
      */
-    public static void encodeURIAtributte(Writer writer, final String string, 
final String characterEncoding)
+    public static void encodeURIAttribute(Writer writer, final String string, 
final String characterEncoding)
         throws IOException
     {
         //StringBuilder sb = null;    //create later on demand
@@ -883,7 +893,8 @@ public static void encodeURIAtributte(Writer writer, final 
String string, final
         String app;
         char c;
         boolean endLoop = false;
-        for (int i = 0; i < string.length (); ++i)
+        int length = string.length();
+        for (int i = 0; i < length; ++i)
         {
             app = null;
             c = string.charAt(i);
@@ -1030,7 +1041,7 @@ public static void encodeURIAtributte(Writer writer, 
final String string, final
             }
             else if (c == '%')
             {
-                if (i + 2 < string.length())
+                if (i + 2 < length)
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
@@ -1064,7 +1075,7 @@ else if (c == '%')
             }
             else if (c == '?' || c == '#')
             {
-                if (i+1 < string.length())
+                if (i+1 < length)
                 {
                     // The remaining part of the URI are data that should be 
encoded
                     // using the document character encoding.
@@ -1108,7 +1119,7 @@ else if (c == '?' || c == '#')
             //}
             if (endLoop)
             {
-                start = string.length();
+                start = length;
                 break;
             }
         }
@@ -1124,9 +1135,9 @@ else if (c == '?' || c == '#')
         {
             writer.write(string);
         }
-        else if (start < string.length())
+        else if (start < length)
         {
-            writer.write(string,start,string.length()-start);
+            writer.write(string,start,length-start);
         }
     }
 
@@ -1202,11 +1213,12 @@ private static void encodeURIQuery(Writer writer, final 
String string, int offse
     {
         //StringBuilder sb = null;    //create later on demand
         int start = offset;
-        int realLength = string.length()-offset;
+        int length = string.length();
+        int realLength = length-offset;
         String app;
         char c;
         //boolean endLoop = false;
-        for (int i = offset; i < offset+realLength; ++i)
+        for (int i = offset; i < length; ++i)
         {
             app = null;
             c = string.charAt(i);
@@ -1241,7 +1253,7 @@ private static void encodeURIQuery(Writer writer, final 
String string, int offse
             }
             else if (c == '%')
             {
-                if (i + 2 < string.length())
+                if (i + 2 < length)
                 {
                     char c1 = string.charAt(i+1);
                     char c2 = string.charAt(i+2);
@@ -1274,7 +1286,7 @@ else if (c == '%')
             }
             else if (c == '&')
             {
-                if (i+4 < string.length() )
+                if (i+4 < length )
                 {
                     if ('a' == string.charAt(i+1) &&
                         'm' == string.charAt(i+2) &&
@@ -1337,9 +1349,9 @@ else if (c == '&')
         {
             writer.write(string, offset, realLength);
         }
-        else if (start < offset+realLength)
+        else if (start < length)
         {
-            writer.write(string,start,offset+realLength-start);
+            writer.write(string,start,length-start);
         }
     }
 }
diff --git 
a/shared/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
 
b/shared/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
index 638530526..a609b3565 100644
--- 
a/shared/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
+++ 
b/shared/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
@@ -39,8 +39,8 @@ public static boolean isValidResourceId(String resourceId)
     {
         // Follow the same rules as for resourceName, but check resourceId 
does not
         // start with '/'
-        return validateResourceName(resourceId, true) && 
-            resourceId.length() > 0 && resourceId.charAt(0) != '/';
+        return resourceId.length() > 0 && resourceId.charAt(0) != '/' && 
+            validateResourceName(resourceId, true); 
     }
     
     public static boolean isValidViewResource(String resourceId)
@@ -57,7 +57,7 @@ public static boolean isValidContractName(String contractName)
     
     public static boolean isValidLocalePrefix(String localePrefix)
     {
-        for (int i = 0; i < localePrefix.length(); i++)
+        for (int i = 0, length = localePrefix.length(); i < length; i++)
         {
             char c = localePrefix.charAt(i);
             if ( (c >='A' && c <='Z') || c == '_' || (c >='a' && c <='z') || 
(c >='0' && c <='9') )
@@ -74,13 +74,14 @@ public static boolean isValidLocalePrefix(String 
localePrefix)
     
     private static boolean validate(String expression, boolean allowSlash)
     {
-        if (expression.length() == 2 && 
+        int length = expression.length();
+        if (length == 2 && 
             expression.charAt(0) == '.' &&
             expression.charAt(1) == '.')
         {
             return false;
         }
-        for (int i = 0; i < expression.length(); i++)
+        for (int i = 0; i < length; i++)
         {
             char c = expression.charAt(i);
 
@@ -108,7 +109,7 @@ private static boolean validate(String expression, boolean 
allowSlash)
             }
             else if (c == '.')
             {
-                if (i+2 < expression.length())
+                if (i+2 < length)
                 {
                     char c1 = expression.charAt(i+1);
                     char c2 = expression.charAt(i+2);
@@ -124,9 +125,8 @@ else if (c == '.')
                 return false;
             }
         }
-        if (expression.length() >= 3)
+        if (length >= 3)
         {
-            int length = expression.length();
             if ( (expression.charAt(length-3) == '/' || 
expression.charAt(length-3) == '\\' ) && 
                   expression.charAt(length-2) == '.' &&
                   expression.charAt(length-1) == '.' )
@@ -139,13 +139,14 @@ else if (c == '.')
     
     private static boolean validateResourceName(String expression, boolean 
allowSlash)
     {
-        if (expression.length() == 2 && 
+        int length = expression.length();
+        if (length == 2 && 
             expression.charAt(0) == '.' &&
             expression.charAt(1) == '.')
         {
             return false;
         }
-        for (int i = 0; i < expression.length(); i++)
+        for (int i = 0; i < length; i++)
         {
             char c = expression.charAt(i);
 
@@ -188,7 +189,7 @@ private static boolean validateResourceName(String 
expression, boolean allowSlas
             }
             else if (c == '.')
             {
-                if (i+2 < expression.length())
+                if (i+2 < length)
                 {
                     char c1 = expression.charAt(i+1);
                     char c2 = expression.charAt(i+2);
@@ -204,9 +205,8 @@ else if (c == '.')
                 return false;
             }
         }
-        if (expression.length() >= 3)
+        if (length >= 3)
         {
-            int length = expression.length();
             if ( (expression.charAt(length-3) == '/' || 
expression.charAt(length-3) == '\\' ) && 
                   expression.charAt(length-2) == '.' &&
                   expression.charAt(length-1) == '.' )
diff --git 
a/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java
 
b/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java
index 856036596..d5b808c79 100644
--- 
a/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java
+++ 
b/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java
@@ -242,7 +242,7 @@ public void testSimpleWriteURIAttribute() throws Exception
   {
       String cad1 = 
"http://myfaces.apache.org/hello.jsf?key1=val&key2=val2#id";;
       String cad2 = 
"http://myfaces.apache.org/hello.jsf?key1=val&amp;key2=val2#id";;
-      String cad3 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
+      String cad3 = HTMLEncoder.encodeURIAttribute(cad1,"UTF-8");
       assertEquals(cad2, cad3);      
   }
   
@@ -257,12 +257,12 @@ public void testUsAsciiEscapedCharactersBeforeQuery() 
throws Exception
       // - From %7F ad infinitum
       String cad1 = "?key=\"%<>\\`{|}^\n "; //Omit %
       String cad2 = "?key=%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
-      String cad3 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
+      String cad3 = HTMLEncoder.encodeURIAttribute(cad1,"UTF-8");
       assertEquals(cad2, cad3);
       
       String cad4 = "\"%<>\\`{|}^\n ";
       String cad5 = "%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
-      String cad6 = HTMLEncoder.encodeURIAtributte(cad4,"UTF-8");
+      String cad6 = HTMLEncoder.encodeURIAttribute(cad4,"UTF-8");
       assertEquals(cad5, cad6);
       
       
@@ -279,12 +279,12 @@ public void 
testUsAsciiEscapedCharactersBeforeQueryLowerCase() throws Exception
       // - From %7F ad infinitum
       String cad1 = "?key=\"%<>\\`{|}^\n "; //Omit %
       String cad2 = "?key=%22%25%3c%3e%5c%60%7b%7c%7d%5e%0a%20";
-      String cad3 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
+      String cad3 = HTMLEncoder.encodeURIAttribute(cad1,"UTF-8");
       assertEquals(cad2.substring(0,5) + cad2.substring(5).toUpperCase(), 
cad3);
       
       String cad4 = "\"%<>\\`{|}^\n ";
       String cad5 = "%22%25%3c%3e%5c%60%7b%7c%7d%5e%0a%20";
-      String cad6 = HTMLEncoder.encodeURIAtributte(cad4,"UTF-8");
+      String cad6 = HTMLEncoder.encodeURIAttribute(cad4,"UTF-8");
       assertEquals(cad5.substring(0,5) + cad5.substring(5).toUpperCase(), 
cad6);
       
   }  
@@ -296,7 +296,7 @@ public void testWriteNonUsAsciiOnURIAttribute() throws 
Exception
          byte [] array = new byte[]{(byte)0xFC};
       String cad1 = new 
String(array,"ISO-8859-1");//+(char)0xC3BC;//"http://myfaces.apache.org/heüll 
o.jsf?key=val#id";
       String cad2 = 
"%C3%BC";//"http://myfaces.apache.org/he%FCll%20o.jsf?key=val#id";;
-      String cad3 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
+      String cad3 = HTMLEncoder.encodeURIAttribute(cad1,"UTF-8");
       assertEquals(cad2, cad3);
 
   }
@@ -312,11 +312,11 @@ public void testReservedCharactersOnURIAttribute() throws 
Exception
       //               %21   %24   %26   %27   %28   %29   %2A   %2B   %2C   
%3B   %3D
       
       String cad1 = "?key=:/[]@!$'()*+,;="; //Omit &
-      String cad2 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
+      String cad2 = HTMLEncoder.encodeURIAttribute(cad1,"UTF-8");
       assertEquals(cad1, cad2);
       
       String cad7 = ":/[]@!$&'()*+,;=";
-      String cad8 = HTMLEncoder.encodeURIAtributte(cad7,"UTF-8");
+      String cad8 = HTMLEncoder.encodeURIAttribute(cad7,"UTF-8");
       assertEquals(cad7, cad8);
   }
 
@@ -327,15 +327,15 @@ public void testNonEncodedCharactersOnURIAttribute() 
throws Exception
       // underscore (%5F), or tilde (%7E) should not be created by URI
       // producers...."
       String cad1 = 
"?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
-      String cad2 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
+      String cad2 = HTMLEncoder.encodeURIAttribute(cad1,"UTF-8");
       assertEquals(cad1, cad2);
       
       String cad3 = 
"#somefile?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
-      String cad4 = HTMLEncoder.encodeURIAtributte(cad3,"UTF-8");
+      String cad4 = HTMLEncoder.encodeURIAttribute(cad3,"UTF-8");
       assertEquals(cad3, cad4);
       
       String cad5 = 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
-      String cad6 = HTMLEncoder.encodeURIAtributte(cad5,"UTF-8");
+      String cad6 = HTMLEncoder.encodeURIAttribute(cad5,"UTF-8");
       assertEquals(cad5, cad6);
   }
 
@@ -353,17 +353,17 @@ public void testWriteURIAttribute() throws Exception
       String cad11 = new String(array11,"UTF-8") + 
((char)(0xFF))+((char)(0x100));
       String cad12 = 
"%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
                      "%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
-      String cad13 = HTMLEncoder.encodeURIAtributte(cad11,"UTF-8");
+      String cad13 = HTMLEncoder.encodeURIAttribute(cad11,"UTF-8");
       assertEquals(cad12, cad13);
       
       String cad1= "?key=" + new 
String(array11,"UTF-8")+((char)(0xFF))+((char)(0x100));
       String cad2 = 
"?key=%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
                      "%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
-      String cad3 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
+      String cad3 = HTMLEncoder.encodeURIAttribute(cad1,"UTF-8");
       assertEquals(cad2, cad3);
             
       //String cad14 = 
"http://myfaces.apache.org/page.jsf?key="+((char)0xFF)+((char)0x100);
-      //String cad15 = HTMLEncoder.encodeURIAtributte(cad14,false);
+      //String cad15 = HTMLEncoder.encodeURIAttribute(cad14,false);
       //assertEquals(cad14,cad15);
   }
     
diff --git 
a/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderWriterTest.java
 
b/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderWriterTest.java
index 099898de7..b16a68fee 100644
--- 
a/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderWriterTest.java
+++ 
b/shared/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderWriterTest.java
@@ -252,7 +252,7 @@ private void assertEquals(char[] expected, char[] actual) {
   {
       String cad1 = 
"http://myfaces.apache.org/hello.jsf?key1=val&key2=val2#id";;
       String cad2 = 
"http://myfaces.apache.org/hello.jsf?key1=val&amp;key2=val2#id";;
-      HTMLEncoder.encodeURIAtributte(sw, cad1,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad1,"UTF-8");
       String cad3 = sw.toString();
       assertEquals(cad2, cad3);      
   }
@@ -268,14 +268,14 @@ public void testUsAsciiEscapedCharactersBeforeQuery() 
throws Exception
       // - From %7F ad infinitum
       String cad1 = "?key=\"%<>\\`{|}^\n "; //Omit %
       String cad2 = "?key=%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
-      HTMLEncoder.encodeURIAtributte(sw, cad1,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad1,"UTF-8");
       String cad3 = sw.toString();
       assertEquals(cad2, cad3);
       
       String cad4 = "\"%<>\\`{|}^\n ";
       String cad5 = "%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
       sw = new StringWriter();
-      HTMLEncoder.encodeURIAtributte(sw, cad4,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad4,"UTF-8");
       String cad6 = sw.toString();
       assertEquals(cad5, cad6);
       
@@ -289,7 +289,7 @@ public void testWriteNonUsAsciiOnURIAttribute() throws 
Exception
          byte [] array = new byte[]{(byte)0xFC};
       String cad1 = new 
String(array,"ISO-8859-1");//+(char)0xC3BC;//"http://myfaces.apache.org/heüll 
o.jsf?key=val#id";
       String cad2 = 
"%C3%BC";//"http://myfaces.apache.org/he%FCll%20o.jsf?key=val#id";;
-      HTMLEncoder.encodeURIAtributte(sw, cad1,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad1,"UTF-8");
       String cad3 = sw.toString();
       assertEquals(cad2, cad3);
 
@@ -306,13 +306,13 @@ public void testReservedCharactersOnURIAttribute() throws 
Exception
       //               %21   %24   %26   %27   %28   %29   %2A   %2B   %2C   
%3B   %3D
       
       String cad1 = "?key=:/[]@!$'()*+,;="; //Omit &
-      HTMLEncoder.encodeURIAtributte(sw, cad1,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad1,"UTF-8");
       String cad2 = sw.toString();
       assertEquals(cad1, cad2);
       
       String cad7 = ":/[]@!$&'()*+,;=";
       sw = new StringWriter(40);
-      HTMLEncoder.encodeURIAtributte(sw, cad7,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad7,"UTF-8");
       String cad8 = sw.toString();
       assertEquals(cad7, cad8);
   }
@@ -324,19 +324,19 @@ public void testNonEncodedCharactersOnURIAttribute() 
throws Exception
       // underscore (%5F), or tilde (%7E) should not be created by URI
       // producers...."
       String cad1 = 
"?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
-      HTMLEncoder.encodeURIAtributte(sw, cad1,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad1,"UTF-8");
       String cad2 = sw.toString();
       assertEquals(cad1, cad2);
       
       String cad3 = 
"#somefile?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
       sw = new StringWriter(40);
-      HTMLEncoder.encodeURIAtributte(sw, cad3,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad3,"UTF-8");
       String cad4 = sw.toString();
       assertEquals(cad3, cad4);
       
       String cad5 = 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
       sw = new StringWriter(40);
-      HTMLEncoder.encodeURIAtributte(sw, cad5,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad5,"UTF-8");
       String cad6 = sw.toString();
       assertEquals(cad5, cad6);
   }
@@ -355,7 +355,7 @@ public void testWriteURIAttribute() throws Exception
       String cad11 = new String(array11,"UTF-8") + 
((char)(0xFF))+((char)(0x100));
       String cad12 = 
"%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
                      "%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
-      HTMLEncoder.encodeURIAtributte(sw, cad11,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad11,"UTF-8");
       String cad13 = sw.toString();
       assertEquals(cad12, cad13);
       
@@ -363,12 +363,12 @@ public void testWriteURIAttribute() throws Exception
       String cad2 = 
"?key=%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
                      "%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
       sw = new StringWriter(40);
-      HTMLEncoder.encodeURIAtributte(sw, cad1,"UTF-8");
+      HTMLEncoder.encodeURIAttribute(sw, cad1,"UTF-8");
       String cad3 = sw.toString();
       assertEquals(cad2, cad3);
             
       //String cad14 = 
"http://myfaces.apache.org/page.jsf?key="+((char)0xFF)+((char)0x100);
-      //String cad15 = HTMLEncoder.encodeURIAtributte(cad14,false);
+      //String cad15 = HTMLEncoder.encodeURIAttribute(cad14,false);
       //assertEquals(cad14,cad15);
   }
     


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to