You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2019/01/10 03:02:57 UTC

[GitHub] YorkShen closed pull request #2029: [Android] fix multithread task crash after instance crash && rm unnecessary exception

YorkShen closed pull request #2029: [Android] fix multithread task crash after instance crash && rm unnecessary exception
URL: https://github.com/apache/incubator-weex/pull/2029
 
 
   

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/bridge/NativeInvokeHelper.java b/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
index ded55d4d73..a84a2401c4 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
@@ -23,8 +23,12 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+
+import com.taobao.weex.WXSDKInstance;
 import com.taobao.weex.WXSDKManager;
+import com.taobao.weex.common.WXModule;
 import com.taobao.weex.performance.WXAnalyzerDataTransfer;
+import com.taobao.weex.utils.WXLogUtils;
 import com.taobao.weex.utils.WXReflectionUtils;
 
 import java.lang.reflect.Type;
@@ -67,9 +71,13 @@ public void onInvokeSuccess() {
         public void run() {
           if (invoker != null) {
             try {
+              WXSDKInstance targetInstance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
+              if (null == targetInstance || targetInstance.isDestroy()){
+                return;
+              }
               invoker.invoke(target, params);
             } catch (Exception e) {
-              throw new RuntimeException(target + "Invoker " + invoker.toString(), e);
+              WXLogUtils.e("NativeInvokeHelper",target + " Invoker " + invoker.toString()+" exception:"+e);
             }
           }
         }
diff --git a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
index b3ad35ebad..c58b0ecd6c 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
@@ -436,9 +436,6 @@ public Object callModuleMethod(String instanceId, String moduleStr, String metho
       ext.put("methodName", methodStr);
       ext.put("args", args.toJSONString());
       WXLogUtils.e("[WXBridgeManager] callNative : numberFormatException when parsing string to numbers in args", ext.toString());
-      WXExceptionUtils.commitCriticalExceptionRT(instanceId,
-          WXErrorCode.WX_KEY_EXCEPTION_INVOKE_BRIDGE, "callNative",
-              WXLogUtils.getStackTrace(e) , ext);
       return null;
     }
   }
@@ -598,9 +595,6 @@ public Object callNativeModule(String instanceId, String module, String method,
     } catch (Exception e) {
       String err = "[WXBridgeManager] callNativeModule exception: " + WXLogUtils.getStackTrace(e);
       WXLogUtils.e(err);
-      WXExceptionUtils.commitCriticalExceptionRT(instanceId,
-              WXErrorCode.WX_KEY_EXCEPTION_INVOKE_BRIDGE, "callNativeModule",
-              err, null);
     }
 
     return null;
diff --git a/android/sdk/src/main/java/com/taobao/weex/bridge/WXModuleManager.java b/android/sdk/src/main/java/com/taobao/weex/bridge/WXModuleManager.java
index c13a442831..2226547fca 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXModuleManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXModuleManager.java
@@ -173,13 +173,6 @@ static Object callModuleMethod(final String instanceId, String moduleStr, String
         return null;
       }
     } catch (Exception e) {
-      WXExceptionUtils.commitCriticalExceptionRT(instanceId,
-              WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_CONTENT_FAILED,
-              "callModuleMethod",
-              WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_CONTENT_FAILED.getErrorMsg()
-                      + "callModuleMethod >>> invoke module:" + moduleStr + ", method:" + methodStr + " failed. "
-                      + WXLogUtils.getStackTrace(e),
-              null);
       WXLogUtils.e("callModuleMethod >>> invoke module:" + moduleStr + ", method:" + methodStr + " failed. ", e);
       return null;
     } finally {


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services