hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1698040 - /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java
Date Thu, 27 Aug 2015 00:12:49 GMT
Author: ggregory
Date: Thu Aug 27 00:12:49 2015
New Revision: 1698040

URL: http://svn.apache.org/r1698040
Log:
Don't create a new empty array when the value is null.

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java?rev=1698040&r1=1698039&r2=1698040&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java
Thu Aug 27 00:12:49 2015
@@ -42,6 +42,8 @@ import org.apache.http.util.Args;
 @Immutable
 public class BasicHeader implements Header, Serializable {
 
+    private static final HeaderElement[] EMPTY_HEADER_ELEMENT_ARRAY = new HeaderElement[0];
+
     private static final long serialVersionUID = -5427236326487562174L;
 
     private final String name;
@@ -85,7 +87,7 @@ public class BasicHeader implements Head
             final ParserCursor cursor = new ParserCursor(0, this.value.length());
             return BasicHeaderValueParser.INSTANCE.parseElements(this.value, cursor);
         }
-        return new HeaderElement[] {};
+        return EMPTY_HEADER_ELEMENT_ARRAY;
     }
 
 }



Mime
View raw message