[
https://issues.apache.org/jira/browse/WEEX-534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16571093#comment-16571093
]
ASF GitHub Bot commented on WEEX-534:
-------------------------------------
YorkShen closed pull request #1361: * [WEEX-534][Android] Add JS Error Log in
GraphicActionAddElement
URL: https://github.com/apache/incubator-weex/pull/1361
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/dom/CSSShorthand.java
b/android/sdk/src/main/java/com/taobao/weex/dom/CSSShorthand.java
index 1af2de50c9..3037d99e70 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/CSSShorthand.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/CSSShorthand.java
@@ -20,6 +20,8 @@
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
+import android.support.annotation.RestrictTo.Scope;
+import android.text.TextUtils;
import com.taobao.weex.dom.CSSShorthand.CSSProperty;
import java.util.Arrays;
@@ -109,4 +111,10 @@ private void setInternal(@NonNull Enum<? extends
CSSProperty> edge, float value)
private float getInternal(@NonNull Enum<? extends CSSProperty> edge){
return (edge == EDGE.ALL || edge == CORNER.ALL) ? 0 :
values[edge.ordinal()];
}
+
+ @Override
+ @RestrictTo(Scope.LIBRARY)
+ public String toString() {
+ return TextUtils.isEmpty(values.toString()) ? "" : Arrays.toString(values);
+ }
}
\ No newline at end of file
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
index 000db30acd..64e8a670be 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
@@ -18,6 +18,8 @@
*/
package com.taobao.weex.dom;
+import android.support.annotation.RestrictTo;
+import android.support.annotation.RestrictTo.Scope;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
@@ -581,4 +583,10 @@ public WXAttr clone() {
}
return wxAttr;
}
+
+ @RestrictTo(Scope.LIBRARY)
+ @Override
+ public String toString() {
+ return attr.toString();
+ }
}
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java
b/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java
index 2a317d5acc..a401090370 100644
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java
@@ -21,6 +21,8 @@
import android.graphics.Typeface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.support.annotation.RestrictTo;
+import android.support.annotation.RestrictTo.Scope;
import android.support.v4.util.ArrayMap;
import android.text.Layout;
import android.text.TextUtils;
@@ -545,4 +547,9 @@ public WXStyle clone(){
return style;
}
+ @Override
+ @RestrictTo(Scope.LIBRARY)
+ public String toString() {
+ return mStyles.toString();
+ }
}
diff --git
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAddElement.java
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAddElement.java
index 87681e08b4..02d1b69963 100644
---
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAddElement.java
+++
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAddElement.java
@@ -21,8 +21,8 @@
import android.support.annotation.RestrictTo;
import android.support.annotation.RestrictTo.Scope;
import android.support.annotation.WorkerThread;
+import android.support.v4.util.ArrayMap;
import android.text.TextUtils;
-
import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.WXSDKManager;
import com.taobao.weex.common.WXErrorCode;
@@ -31,6 +31,7 @@
import com.taobao.weex.ui.component.WXVContainer;
import com.taobao.weex.utils.WXExceptionUtils;
import com.taobao.weex.utils.WXLogUtils;
+import java.util.Arrays;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -79,14 +80,59 @@ public GraphicActionAddElement(String pageId, String ref,
return;
}
}catch (ClassCastException e){
+ Map<String, String> ext = new ArrayMap<>();
+ WXComponent parent = WXSDKManager.getInstance().getWXRenderManager()
+ .getWXComponent(getPageId(), mParentRef);
+
+ if (mStyle != null && !mStyle.isEmpty()) {
+ ext.put("child.style", mStyle.toString());
+ }
+ if (parent != null && parent.getStyles() != null &&
!parent.getStyles().isEmpty()) {
+ ext.put("parent.style", parent.getStyles().toString());
+ }
+
+ if (mAttributes != null && !mAttributes.isEmpty()) {
+ ext.put("child.attr", mAttributes.toString());
+ }
+ if (parent != null && parent.getAttrs() != null &&
!parent.getAttrs().isEmpty()) {
+ ext.put("parent.attr", parent.getAttrs().toString());
+ }
+
+ if (mEvents != null && !mEvents.isEmpty()) {
+ ext.put("child.event", mEvents.toString());
+ }
+ if (parent != null && parent.getEvents() != null &&
!parent.getEvents().isEmpty()) {
+ ext.put("parent.event", parent.getEvents().toString());
+ }
+
+ if (mMargins != null && mMargins.length > 0) {
+ ext.put("child.margin", Arrays.toString(mMargins));
+ }
+ if (parent != null && parent.getMargin() != null) {
+ ext.put("parent.margin", parent.getMargin().toString());
+ }
+
+ if (mPaddings != null && mPaddings.length > 0) {
+ ext.put("child.padding", Arrays.toString(mPaddings));
+ }
+ if (parent != null && parent.getPadding() != null) {
+ ext.put("parent.padding", parent.getPadding().toString());
+ }
+
+ if (mBorders != null && mBorders.length > 0) {
+ ext.put("child.border", Arrays.toString(mBorders));
+ }
+ if (parent != null && parent.getBorder() != null) {
+ ext.put("parent.border", parent.getBorder().toString());
+ }
+
WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
WXErrorCode.WX_RENDER_ERR_CONTAINER_TYPE,
"GraphicActionAddElement",
- String.format(Locale.ENGLISH,"You are trying to add a %s (ref: %s)
to a %3$s (ref: %4$s), which is illegal as %3$s (ref: %4$s) is not a container",
- componentType, ref,
-
WXSDKManager.getInstance().getWXRenderManager().getWXComponent(getPageId(),
mParentRef).getComponentType(),
- parentRef),
- null);
+ String.format(Locale.ENGLISH,"You are trying to add a %s to a %2$s,
which is illegal as %2$s is not a container",
+ componentType,
+
WXSDKManager.getInstance().getWXRenderManager().getWXComponent(getPageId(),
mParentRef).getComponentType()),
+ ext);
}
}
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 bca659bd8d..d76ad8e4f8 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
@@ -1346,6 +1346,9 @@ protected void createViewImpl() {
}
if (mHost != null) {
mHost.setId(WXViewUtils.generateViewId());
+ if(TextUtils.isEmpty(mHost.getContentDescription()) &&
WXEnvironment.isApkDebugable()){
+ mHost.setContentDescription(getRef());
+ }
ComponentObserver observer;
if ((observer = getInstance().getComponentObserver()) != null) {
observer.onViewCreated(this, mHost);
----------------------------------------------------------------
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]
> Add JS Error Log in GraphicActionAddElement
> -------------------------------------------
>
> Key: WEEX-534
> URL: https://issues.apache.org/jira/browse/WEEX-534
> Project: Weex
> Issue Type: Bug
> Reporter: YorkShen
> Assignee: YorkShen
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)