You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/23 07:23:26 UTC

[08/11] incubator-weex git commit: add response header and use hashmap to handle null key, value

add response header and use hashmap to handle null key,value


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7d89a0c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7d89a0c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7d89a0c3

Branch: refs/heads/release-0.16
Commit: 7d89a0c3f98c903af11bdfaf8d75ee549adc14e3
Parents: 0d4dada
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Sat Oct 21 15:05:47 2017 +0800
Committer: jianbai.gbj <ji...@alibaba-inc.com>
Committed: Mon Oct 23 10:02:36 2017 +0800

----------------------------------------------------------------------
 .../main/java/com/taobao/weex/WXSDKInstance.java    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7d89a0c3/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
index 18a66e6..78e801b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
@@ -130,7 +130,7 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext, View.
 
   public WeakReference<String> templateRef;
 
-  public Map<String,List<String>> headers = new ConcurrentHashMap<>();
+  public Map<String,List<String>> responseHeaders = new HashMap<>();
 
   /**
    * Render strategy.
@@ -1299,8 +1299,8 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext, View.
       mRenderListener = null;
       isDestroy = true;
       mStatisticsListener = null;
-      if(headers != null){
-          headers.clear();
+      if(responseHeaders != null){
+          responseHeaders.clear();
       }
       if(templateRef != null){
         templateRef = null;
@@ -1617,9 +1617,11 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext, View.
       if (this.instance != null
           && this.instance.getWXStatisticsListener() != null) {
         this.instance.getWXStatisticsListener().onHeadersReceived();
-        if(this.instance.headers != null && headers != null){
-           this.instance.headers.putAll(headers);
-        }
+      }
+      if(this.instance != null
+              && this.instance.responseHeaders != null
+              && headers != null){
+        this.instance.responseHeaders.putAll(headers);
       }
     }
 
@@ -1727,7 +1729,7 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext, View.
     try {
       byte[] bts = template.getBytes("UTF-8");
       return " template md5 " + WXFileUtils.md5(bts) + " length " +   bts.length
-               + "response header " + JSONObject.toJSONString(headers);
+               + "response header " + JSONObject.toJSONString(responseHeaders);
     } catch (UnsupportedEncodingException e) {
       return "template md5 getBytes error";
     }