Hi,
Im calling XMLTools.loadXMLSchema() to define data source and simple types. SimpleType.getType() crashes with "Out of stack space exception". This happens with SmartGWT 4.0 and the latest 3.1p, but not with older 3.1p downloads. Is this a bug?
1. the *complete* SmartGWT or SmartClient version
SmartClient Version: v9.0p_2013-11-19/PowerEdition Deployment (built 2013-11-19)
2. browser(s) and version(s) involved
MSIE-9, Firefox, Chrome
5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
Stacktrace in MSIE
Stacktrace in Firefox
6. sample code if applicable
To test download the attached files and check the README.txt (rename *xsd.txt to *xsd)
REMARK: Actually this is part of a method for copying a DataSourceField obtained from XMLTools.loadXMLSchema(), and the tricky part is the "type" attribute, and this used to work and it is broken now.
Thanks for help
Im calling XMLTools.loadXMLSchema() to define data source and simple types. SimpleType.getType() crashes with "Out of stack space exception". This happens with SmartGWT 4.0 and the latest 3.1p, but not with older 3.1p downloads. Is this a bug?
1. the *complete* SmartGWT or SmartClient version
SmartClient Version: v9.0p_2013-11-19/PowerEdition Deployment (built 2013-11-19)
2. browser(s) and version(s) involved
MSIE-9, Firefox, Chrome
5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
Stacktrace in MSIE
Code:
Exception (Error) @com.smartgwt.client.data.SimpleType::getType(Ljava/lang/String;)([string: 'EquipmentId']): Out of stack space com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) com.smartgwt.client.data.SimpleType.getType(SimpleType.java) com.smartgwt.sample.client.BuiltInDS$6.onClick(BuiltInDS.java:128) com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:104) com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:1) com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1) com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40) com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193) com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88) com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127) com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:496) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338) com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) com.google.gwt.core.client.impl.Impl.apply(Impl.java) com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242) sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) java.lang.Thread.run(Thread.java:744)
Code:
Exception (InternalError) @com.smartgwt.client.data.SimpleType::getType(Ljava/lang/String;)([string: 'EquipmentId']): too much recursion com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) com.smartgwt.client.data.SimpleType.getType(SimpleType.java) com.smartgwt.sample.client.BuiltInDS$6.onClick(BuiltInDS.java:128) com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:104) com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:1) com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1) com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40) com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193) com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88) com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127) com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:496) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338) com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) com.google.gwt.core.client.impl.Impl.apply(Impl.java) com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242) sun.reflect.GeneratedMethodAccessor317.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) java.lang.Thread.run(Thread.java:744)
To test download the attached files and check the README.txt (rename *xsd.txt to *xsd)
REMARK: Actually this is part of a method for copying a DataSourceField obtained from XMLTools.loadXMLSchema(), and the tricky part is the "type" attribute, and this used to work and it is broken now.
Code:
public static DataSourceField copyField(DataSourceField field) { DataSourceField newField = new DataSourceField(); newField.setName(field.getName()); newField.setTitle(field.getTitle()); newField.setXmlAttribute(field.getXmlAttribute()); newField.setRequired(field.getRequired()); newField.setValidators(field.getValidators()); newField.setDetail(field.getDetail()); newField.setHidden(field.getHidden()); // type FieldType type = field.getType(); if (type != null) { newField.setType(type); } else { String strType = field.getAttributeAsString("type"); if (strType != null) { SimpleType st = SimpleType.getType(strType); if (st != null) { newField.setType(st); } else { SC.logWarn("type not found: " + strType + " on " + field.getName()); } } } // value map as string array // TODO support map type too String[] valueMap = field.getAttributeAsStringArray("valueMap"); if (valueMap != null) { if (!field.getRequired() && valueMap.length > 0 && valueMap[0].length() > 0) { List<String> values = new ArrayList<String>(); values.add(""); values.addAll(Arrays.asList(valueMap)); valueMap = values.toArray(new String[0]); } newField.setValueMap(valueMap); } return newField; }
Comment