[ 
https://issues.apache.org/jira/browse/WEEX-611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16611624#comment-16611624
 ] 

ASF GitHub Bot commented on WEEX-611:
-------------------------------------

YorkShen closed pull request #1511: [WEEX-611][Android] Fix 
java.lang.ArrayIndexOutOfBoundsException
URL: https://github.com/apache/incubator-weex/pull/1511
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/android/sdk/src/main/java/com/taobao/weex/utils/batch/BatchOperationHelper.java
 
b/android/sdk/src/main/java/com/taobao/weex/utils/batch/BatchOperationHelper.java
index a900cc4c45..3c79d538ee 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/utils/batch/BatchOperationHelper.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/utils/batch/BatchOperationHelper.java
@@ -32,7 +32,7 @@
 
 
   private BactchExecutor mExecutor;
-  private ArrayList <Runnable> sRegisterTasks = new ArrayList<>();
+  private CopyOnWriteArrayList<Runnable> sRegisterTasks = new 
CopyOnWriteArrayList<>();
   private boolean isCollecting = false;
 
   public BatchOperationHelper(BactchExecutor executor){
@@ -62,7 +62,8 @@ public void run() {
         while(iterator.hasNext()){
           Runnable item = iterator.next();
           item.run();
-          iterator.remove();
+//          iterator.remove();
+          sRegisterTasks.remove(item);
         }
       }
     });


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Fix java.lang.ArrayIndexOutOfBoundsException
> --------------------------------------------
>
>                 Key: WEEX-611
>                 URL: https://issues.apache.org/jira/browse/WEEX-611
>             Project: Weex
>          Issue Type: Improvement
>          Components: Android
>    Affects Versions: 0.19
>            Reporter: Yayun Dong
>            Assignee: YorkShen
>            Priority: Major
>             Fix For: 0.18
>
>
> arrayList is not thread safe, if arraylist add item in multithread may 
> produce ArrayIndexOutOfBoundsException



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to