0

RPCDataServiceAdapter がエラーをポップアップ表示する理由がわかりません。エラーに関連するスクリプトの一部があります。

        public function normalusercontactdatagrid_creationCompleteHandler(event:FlexEvent):void
        {
            getAllNormaluserResult.token = normaluserService.getAllNormaluser();
        }


        protected function addUSER(event:MouseEvent):void
        {
            var win:IFlexDisplayObject =PopUpManager.createPopUp(this, addUser, true) as IFlexDisplayObject;

            PopUpManager.centerPopUp(win);

            var e:FlexEvent;
            normalusercontactdatagrid_creationCompleteHandler(e);
        }

しかし、次の dataadapter エラーが表示されます

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.data::RPCDataServiceAdapter/processDataMessage()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:987]
    at RPCDataServiceRequest/invoke()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:1786]
    at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:3497]
    at Function/<anonymous>()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:1716]
    at Function/<anonymous>()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:1584]
    at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::fill()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:1771]
    at mx.data::ConcreteDataService/internalFill()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:7504]
    at Function/<anonymous>()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:1306]
    at mx.data::ConcreteDataService/fill()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:1325]
    at mx.data::ConcreteDataService/executeQuery()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:1607]
    at mx.data::DataManager/executeQuery()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataManager.as:1493]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.data::ManagedOperation/queryProxy()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ManagedOperation.as:519]
    at mx.rpc.remoting::Operation/send()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\remoting\Operation.as:212]
    at _Super_NormaluserService/getAllNormaluser()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\services\normaluserservice\_Super_NormaluserService.as:244]
    at normalUserDetailComp/normalusercontactdatagrid_creationCompleteHandler()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\normalUserDetailComp.mxml:80]
    at normalUserDetailComp/addUSER()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\normalUserDetailComp.mxml:93]
    at normalUserDetailComp/___normalUserDetailComp_LinkButton1_click()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\normalUserDetailComp.mxml:172]

80行目、93行目、172行目のエラー

それは

line 80 getAllNormaluserResult.token = normaluserService.getAllNormaluser();
line 93 normalusercontactdatagrid_creationCompleteHandler(e);
line 172 <mx:LinkButton label="Add" click="addUSER(event);"/>

エラーの山を正しく理解していれば、これらの行が dataService からエラーを引き起こすと思います。

at _Super_NormaluserService/getAllNormaluser()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\services\normaluserservice\_Super_NormaluserService.as:244]

これはどのように起こりますか?そして、私は何をすべきですか?

ポップアップ ウィンドウで adduser.mxml を呼び出さないと、エラーが再度表示されないことがわかりました。adduser.mxml は以下のように表示されます

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx"
         xmlns:valueObjects="valueObjects.*"
         xmlns:userservice="services.userservice.*"
         xmlns:normaluserservice="services.normaluserservice.*"
         xmlns:specialcareuserservice="services.specialcareuserservice.*"
         width="522" height="732">
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import services.*;

            protected function button_clickHandler(event:MouseEvent):void
            {
                var userService:UserService = new UserService();
                var user2:User = new User();
                user2.idUser = parseInt(idUserTextInput.text);
                user2.userName = userNameTextInput.text;
                user2.password = passwordTextInput.text;

                createUserResult.token = userService.createUser(user2);
                userService.commit();

                var normaluserService:NormaluserService = new NormaluserService();
                var normaluser2:Normaluser = new Normaluser();
                normaluser2.user_idUser = parseInt(idUserTextInput.text);
                normaluser2.userFristName = userFristNameTextInput.text;
                normaluser2.userSecondName = userSecondNameTextInput.text;
                normaluser2.userAddress_Flat = userAddress_FlatTextInput.text;
                normaluser2.userAddress_Floor = userAddress_FloorTextInput.text;
                normaluser2.userAddress_Bulding = userAddress_BuldingTextInput.text;
                normaluser2.userAddress_Street = userAddress_StreetTextInput.text;
                normaluser2.userAddress_Dist = userAddress_DistTextInput.text;
                normaluser2.userAddress_Country = userAddress_CountryTextInput.text;

                createNormaluserResult.token = normaluserService.createNormaluser(normaluser2);
                normaluserService.commit();

                var specialcareuserService:SpecialcareuserService = new SpecialcareuserService();
                var specialcareuser2:Specialcareuser = new Specialcareuser();
                specialcareuser2.specialCareRequirement_idspecialCareRequirement = parseInt(specialCareRequirement_idspecialCareRequirementTextInput.text);
                specialcareuser2.user_idUser = parseInt(idUserTextInput.text);

                createSpecialcareuserResult.token = specialcareuserService.createSpecialcareuser(specialcareuser2);
                specialcareuserService.commit();
            }

        ]]>
    </fx:Script>



    <fx:Declarations>
        <valueObjects:User id="user"/>
        <userservice:UserService id="userService" 
                                 fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                 showBusyCursor="true"/>
        <s:CallResponder id="createUserResult"/>
        <valueObjects:Normaluser id="normaluser"/>
        <normaluserservice:NormaluserService id="normaluserService"
                                             fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                             showBusyCursor="true"/>
        <s:CallResponder id="createNormaluserResult"/>
        <valueObjects:Specialcareuser id="specialcareuser"/>
        <specialcareuserservice:SpecialcareuserService id="specialcareuserService"
                                                       fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                       showBusyCursor="true"/>
        <s:CallResponder id="createSpecialcareuserResult"/>


    </fx:Declarations>




    <s:Form x="43" y="10" width="445" height="727" >
        <s:FormItem label="IdUser">
            <s:TextInput id="idUserTextInput" text="{user.idUser}"/>
        </s:FormItem>
        <s:FormItem label="UserName">
            <s:TextInput id="userNameTextInput" text="{user.userName}"/>
        </s:FormItem>
        <s:FormItem label="Password">
            <s:TextInput id="passwordTextInput" text="{user.password}"/>
        </s:FormItem>
        <s:FormHeading width="266" label="User Detail (Name, address...)"/>
        <s:FormItem label="Frist Name">
            <s:TextInput id="userFristNameTextInput" text="{normaluser.userFristName}"/>
        </s:FormItem>
        <s:FormItem label="Second Name">
            <s:TextInput id="userSecondNameTextInput" text="{normaluser.userSecondName}"/>
        </s:FormItem>
        <s:FormItem label="Flat">
            <s:TextInput id="userAddress_FlatTextInput" text="{normaluser.userAddress_Flat}"/>
        </s:FormItem>
        <s:FormItem label="Floor">
            <s:TextInput id="userAddress_FloorTextInput" text="{normaluser.userAddress_Floor}"/>
        </s:FormItem>
        <s:FormItem label="UserAddress_Bulding">
            <s:TextInput id="userAddress_BuldingTextInput" text="{normaluser.userAddress_Bulding}"/>
        </s:FormItem>
        <s:FormItem label="Street">
            <s:TextInput id="userAddress_StreetTextInput" text="{normaluser.userAddress_Street}"/>
        </s:FormItem>
        <s:FormItem label="Dist">
            <s:TextInput id="userAddress_DistTextInput" text="{normaluser.userAddress_Dist}"/>
        </s:FormItem>
        <s:FormItem label="Country">
            <s:TextInput id="userAddress_CountryTextInput" text="{normaluser.userAddress_Country}"/>
        </s:FormItem>
        <s:FormHeading label="Special Requirement"/>

        <s:FormItem label="Care Requirement">
            <s:helpContent>
                <s:VGroup>
                    <s:Label text="Special Requirement?"></s:Label>
                </s:VGroup>
            </s:helpContent>
            <s:TextInput id="specialCareRequirement_idspecialCareRequirementTextInput"
                         text="{specialcareuser.specialCareRequirement_idspecialCareRequirement}"/>
        </s:FormItem>
            <s:Button id="button" label="CreateUser" click="button_clickHandler(event)"/>
    </s:Form>
</s:Group>
4

1 に答える 1

0

何らかの理由で、CreationComplete() が呼び出されたときに RPC 接続が利用できません。それを呼び出すのを遅らせる (短いタイマー?) か、RPC 接続がセットアップされるまで遅らせる CreationComplete から他の関数​​を呼び出すことができます。その間、おそらく「作業中...」ダイアログが表示されます。

いずれにせよ、その時点で null をテストし、エラーをトラップする必要があります。

于 2012-11-01T13:38:09.677 に答える