[ 
https://issues.apache.org/jira/browse/FLEX-33987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13913751#comment-13913751
 ] 

Alex Harui commented on FLEX-33987:
-----------------------------------

Was able to reproduce with a contrived test case:
<?xml version="1.0" encoding="utf-8"?>
<!-- dpcontrols\sparkdpcontrols\SparkDGItemEditor.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"; 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" 
               width="450">
    <fx:Script>
        <![CDATA[                
            import mx.collections.ArrayCollection;
            
            [Bindable]
            private var myDP:ArrayCollection = new ArrayCollection([
                {label1:"Order #2314", quant:3, Sent:true},
                {label1:"Order #2315", quant:3, Sent:false}     
            ]);       
        ]]>
    </fx:Script>
    
    <s:DataGrid id="myDG" width="100%" focusEnabled="false"
                dataProvider="{myDP}" 
                variableRowHeight="true" 
                editable="true" >
        <s:columns>
            <s:ArrayList>
                <s:GridColumn dataField="label1" headerText="Order #" 
rendererIsEditable="true"/>
            </s:ArrayList> 
        </s:columns >
    </s:DataGrid> 
</s:Application>

They "contrived" part is setting DG focusEnabled=false and also making the 
mistake of setting rendererIsEditable when the renderer is not editable.  

The only way I can figure out to cause this stack trace is to somehow prevent 
the DG and editable widgets from getting registered with the FocusManager.  In 
a well-behaved application, there should be at least one focusable widget 
per-screen.

I'll add the null check to make the FocusManager more fault-tolerant, but it 
sort of implies that the application is mis-configured in some way.


> FocusManager NPE
> ----------------
>
>                 Key: FLEX-33987
>                 URL: https://issues.apache.org/jira/browse/FLEX-33987
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Focus Manager
>    Affects Versions: Adobe Flex SDK 4.5.1 (Release), Apache Flex 4.11.0
>            Reporter: Alexander Mazuruk
>            Assignee: Alex Harui
>            Priority: Critical
>
> FocusManager Null pointer exception occurs.
> This:
>     public function getNextFocusManagerComponent(
>                             backward:Boolean = false):IFocusManagerComponent
>       {
>               return getNextFocusManagerComponent2(backward, 
> fauxFocus).displayObject as IFocusManagerComponent;
>       }
> Must be rewritten as:
> public function getNextFocusManagerComponent(
>                             backward:Boolean = false):IFocusManagerComponent
>       {
>         const focusInfo:FocusInfo = getNextFocusManagerComponent2(backward, 
> fauxFocus);
>         return focusInfo ? focusInfo.displayObject as IFocusManagerComponent 
> : null;
>       }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to