Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Adobe Flex SDK Previous
-
None
-
Affected OS(s): All OS Platforms
Language Found: English
Description
Steps to reproduce:
1. Run the following program
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:DataGrid >
<s:columns>
<s:ArrayCollection>
<fx:String>Test1</fx:String>
</s:ArrayCollection>
</s:columns>
</s:DataGrid>
</s:Application>
Actual Results:
TypeError: Error #1034: Type Coercion failed: cannot convert "Test1" to spark.components.gridClasses.GridColumn.
atspark.components::Grid/set columns()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Grid.as:760]
atspark.components::DataGrid$/setPartProperty()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:795]
atspark.components::DataGrid/setGridProperty()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:827]
atspark.components::DataGrid/partAdded()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:1995]
atspark.components.supportClasses::SkinnableComponent/findSkinParts()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:737]
atspark.components::DataGrid/findSkinParts()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\DataGrid.as:1950]
atspark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:702]
atspark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:436]
atspark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:399]
atmx.core::UIComponent/initialize()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:7567]
atmx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:7452]
atmx.core::UIComponent/addChildAt()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:7158]
atspark.components::Group/addDisplayObjectToDisplayList()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:1942]
atspark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:1533]
atspark.components::Group/setMXMLContent()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:626]
atspark.components::Group/set mxmlContent()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Group.as:566]
atspark.components::SkinnableContainer/set mxmlContent()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:657]
atspark.components::SkinnableContainer/createDeferredContent()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1045]
atspark.components::SkinnableContainer/createContentIfNeeded()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1073]
atspark.components::SkinnableContainer/createChildren()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:880]
atmx.core::UIComponent/initialize()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:7567]
atspark.components::Application/initialize()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\Application.as:1049]
atBadColumns/initialize()
atmx.managers.systemClasses::ChildManager/childAdded()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:189]
atmx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:359]
atmx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\SystemManager.as:2963]
atmx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\SystemManager.as:2749]
atmx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\SystemManager.as:2629]
atflash.events::EventDispatcher/dispatchEventFunction()
atflash.events::EventDispatcher/dispatchEvent()
atmx.preloaders::Preloader/timerHandler()[E:\dev\hero_private\frameworks\projects\framework\src\mx\preloaders\Preloader.as:539]
atflash.utils::Timer/_timerDispatch()
atflash.utils::Timer/tick()
Expected Results:
The exception is valid, because the code specifies an ArrayCollection with a String instead of a GridColumn.
For tooling, it would be very helpful if there was a way to determine which component caused the exception. An idea that I discussed with Ryan was to wrap UIComponent.initialize() in a try/catch block, and send an event if there is an exception. A field in the event would store what component caused the exception. Tooling would listen for this event and take corrective action.
This is similar to LayoutManager.doPhasedInstantiationCallback(). If a UIComponentGlobals flag is set, the LayoutManager catches exceptions and sends an event. Tooling listens for that event so that it can perform recovery actions.