abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r773297 - /abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
Date Sun, 10 May 2009 02:57:34 GMT
Author: jmsnell
Date: Sun May 10 02:57:34 2009
New Revision: 773297

URL: http://svn.apache.org/viewvc?rev=773297&view=rev
Log:
Fix for https://issues.apache.org/jira/browse/ABDERA-231

Modified:
    abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java

Modified: abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=773297&r1=773296&r2=773297&view=diff
==============================================================================
--- abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
(original)
+++ abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
Sun May 10 02:57:34 2009
@@ -17,6 +17,7 @@
 */
 package org.apache.abdera.protocol.client;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
@@ -258,24 +259,40 @@
   /**
    * Similar to setHeader but allows for multiple instances of the specified header
    */
-  public RequestOptions addHeader(String header, String value) {
-    if (value != null)
-      addHeader(header, new String[] {value});
-    return this;
+  public RequestOptions addHeader(
+    String header, 
+    String value) {
+      if (value != null)
+        addHeader(
+          header, 
+          new String[] {value});
+      return this;
   }
   
   /**
-   * Similar to setHeader but allows for multiple instances of the specified header
-   */
-  public RequestOptions addHeader(String header, String... values) {
-    if (values == null || values.length == 0) return this;
-    List<String> list = Arrays.asList(getHeaders().get(header));
+   * Similar to setHeader but allows for 
+   * multiple instances of the specified header
+   */
+  public RequestOptions addHeader(
+    String header, 
+    String... values) {
+      if (values == null || 
+          values.length == 0) 
+        return this;
+    String[] headers = 
+      getHeaders().get(header);
+    List<String> list = 
+      headers != null ? 
+        Arrays.asList(headers) : 
+        new ArrayList<String>();
     String value = combine(values);
     if (list != null) {
       if (!list.contains(value)) 
         list.add(value);
     } else {
-      setHeader(header, new String[] {value});
+      setHeader(
+        header, 
+        new String[] {value});
     }
     return this;
   }



Mime
View raw message