2011/10/27  <ma...@apache.org>:
> Author: markt
> Date: Thu Oct 27 18:02:27 2011
> New Revision: 1189899
>
> URL: http://svn.apache.org/viewvc?rev=1189899&view=rev
> Log:
> Re-factor parameter parsing to improve performance
>
> Added:
>    
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/LocalStrings.properties 
>   (with props)
> Modified:
>    tomcat/tc7.0.x/trunk/   (props changed)
>    tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Connector.java
>    tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java
>    
> tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml
>    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
>    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java
>    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/StringCache.java
>    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java
>    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>    tomcat/tc7.0.x/trunk/webapps/docs/config/ajp.xml
>    tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml
>

> @@ -97,15 +101,23 @@ public final class ByteChunk implements
>         as most standards seem to converge, but the servlet API requires
>         8859_1, and this object is used mostly for servlets.
>     */
> -    public static final String DEFAULT_CHARACTER_ENCODING="ISO-8859-1";
> +    public static Charset DEFAULT_CHARSET = null;

1. The above public variable must declared as final.

> +    static {
> +        try {
> +            DEFAULT_CHARSET = B2CConverter.getCharset("ISO-8859-1");
> +        } catch (UnsupportedEncodingException e) {
> +            // Should never happen since all JVMs must support ISO-8859-1
> +        }
> +    }

IIRC, it might be done using a helper variable in the static{} block.

   public static final Charset DEFAULT_CHARSET;

   static {
       Charset defaultCharset = null;
       try {
            defaultCharset = B2CConverter.getCharset("ISO-8859-1");
        } catch (UnsupportedEncodingException e) {
            // Should never happen since all JVMs must support ISO-8859-1
        }
        DEFAULT_CHARSET = defaultCharset;
    }


2) In TestParameters.java
in http://svn.apache.org/viewvc?view=revision&revision=1189876

UEncoder uencoder = new UEncoder();
field can be private final, like the others.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to