This is an automated email from the ASF dual-hosted git repository.
luckychen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new b94e830 [Android] Fix ClassCastException in
WXComponent.updateProperties() (#2897)
b94e830 is described below
commit b94e83074fe5a6eb7220fef8a1a5064df68f7894
Author: YorkShen <[email protected]>
AuthorDate: Thu Sep 12 16:33:14 2019 +0800
[Android] Fix ClassCastException in WXComponent.updateProperties() (#2897)
```
java.lang.ClassCastException: java.lang.Object[] cannot be cast to
java.lang.String
at
com.taobao.weex.ui.component.WXComponent.updateProperties(WXComponent.java:710)
at
com.taobao.weex.ui.component.WXComponent.updateAttrs(WXComponent.java:274)
at
com.taobao.weex.ui.component.WXComponent.bindData(WXComponent.java:663)
at CustomComponent.bindData(InteractiveVideoComponentV2.java:638)
at
com.taobao.weex.ui.component.WXVContainer.bindData(WXVContainer.java:166)
```
---
.../src/main/java/com/taobao/weex/common/WXErrorCode.java | 1 +
.../java/com/taobao/weex/ui/component/WXComponent.java | 14 +++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
b/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
index b4fb844..80ef371 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
@@ -219,6 +219,7 @@ public enum WXErrorCode {
WX_RENDER_ERR_NULL_KEY("-9603", "WX_RENDER_ERR_NULL_KEY",
ErrorType.NATIVE_ERROR, ErrorGroup.NATIVE),
WX_RENDER_ERR_NATIVE_RUNTIME("-9604", "WX_RENDER_ERR for js error",
ErrorType.RENDER_ERROR, ErrorGroup.NATIVE),
WX_RENDER_ERR_COMPONENT_NOT_REGISTER("-9605",
"WX_RENDER_ERR_COMPONENT_NOT_REGISTER", ErrorType.NATIVE_ERROR,
ErrorGroup.NATIVE),
+ WX_RENDER_ERR_COMPONENT_ATTR_KEY("-9606", "The key passed to
Component.updateAttr() is not string", ErrorType.NATIVE_ERROR, ErrorGroup.JS),
WX_RENDER_ERR_BRIDGE_ARG_NULL("-9610", "WX_RENDER_ERR_BRIDGE_ARG_NULL",
ErrorType.NATIVE_ERROR, ErrorGroup.NATIVE),
WX_RENDER_ERR_CONTAINER_TYPE("-9611", "WX_RENDER_ERR_CONTAINER_TYPE",
ErrorType.JS_ERROR,ErrorGroup.JS),
WX_RENDER_ERR_TRANSITION("-9616", "WX_RENDER_ERR_TRANSITION",
ErrorType.JS_ERROR, ErrorGroup.JS),
diff --git
a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
index e7be2ff..6c2f5e5 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
@@ -707,7 +707,19 @@ public abstract class WXComponent<T extends View> extends
WXBasicComponent imple
}
for (Map.Entry<String, Object> entry : props.entrySet()) {
- String key = entry.getKey();
+ Object key_obj = entry.getKey();
+ String key = WXUtils.getString(key_obj, null);
+ if (!(key_obj instanceof String)) {
+ Map<String, String> map = new HashMap<>();
+ map.put("componentType", getComponentType());
+ map.put("actual key", key == null ? "" : key);
+ WXExceptionUtils.commitCriticalExceptionRT(getInstanceId(),
+ WXErrorCode.WX_RENDER_ERR_COMPONENT_ATTR_KEY,
+ "WXComponent.updateProperties",
+ WXErrorCode.WX_RENDER_ERR_COMPONENT_ATTR_KEY.getErrorMsg(),
+ map);
+ }
+
Object param = entry.getValue();
String value = WXUtils.getString(param, null);