Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[Android] Fix ClassCastException in WXComponent.updateProperties() #2897

Merged
merged 1 commit into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,19 @@ public void updateProperties(Map<String, Object> props) {
}

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);

Expand Down