tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@apache.org>
Subject Re: svn commit: r1177245 - /tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java
Date Thu, 29 Sep 2011 10:59:04 GMT
Wouldn't converting the whole method to use StringBuilder be more efficient
- as compared instantiating a StringWriter AND PrintWriter? We could
probably guess a good default size too of size()*40 which would assume most
headers are less than 40 chars (which is typically true except for
user-agent and cookie)

But as the previous commit noted .. its a debug method so it may not really
matter.

-Tim

On Thu, Sep 29, 2011 at 5:52 AM, <kkolinko@apache.org> wrote:

> Author: kkolinko
> Date: Thu Sep 29 09:52:56 2011
> New Revision: 1177245
>
> URL: http://svn.apache.org/viewvc?rev=1177245&view=rev
> Log:
> A bit more memory-efficient code.
>
> Modified:
>    tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java
>
> Modified: tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java
> URL:
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java?rev=1177245&r1=1177244&r2=1177245&view=diff
>
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java
> (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java Thu Sep
> 29 09:52:56 2011
> @@ -145,7 +145,9 @@ public class MimeHeaders {
>             String n = e.nextElement();
>             Enumeration<String> ev = values(n);
>             while (ev.hasMoreElements()) {
> -                pw.println(n + " = " + ev.nextElement());
> +                pw.print(n);
> +                pw.print(" = ");
> +                pw.println(ev.nextElement());
>             }
>         }
>         return sw.toString();
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message