找出抛出TypeErrors的位置

时间:2011-08-09 07:27:18

标签: flex actionscript amf typeerror

我遇到的问题让我疯了。 最近我出于性能原因将我的BlazeDS配置为使用Array而不是ArrayCollection。另外,我调整了模板以生成数组属性。

一切都不好。除了导致TypeError的一个函数之外的所有函数:错误#1034。在调用结果回调之前抛出这些。它声称在将ArrayCollection转换为Array时遇到问题。我删除了生成的类型以使Flex使用对象,但这些不包含任何ArrayCollections。我现在的问题是:如何在事件处理程序中抛出错误的堆栈跟踪?

我已经在所有模块中为unhandledExceptions添加了处理程序,如果在用户交互触发的代码中出现错误,则会调用它们,但它们似乎无法捕获事件处理程序抛出的内容。

如何跟踪这些错误?

克里斯

PS:这些课程是:     包de.upw.ps.ucg.model.ucg.scheduler {

[Bindable]
[RemoteClass(alias="de.upw.ps.ucg.model.ucg.scheduler.Task")]
public class Task extends TaskBase {
}
}

package de.upw.ps.ucg.model.ucg.scheduler {

import de.upw.ps.ucg.model.oval.common.OvalVersionedIdentifier;
import flash.utils.IExternalizable;

[Bindable]
public class TaskBase {

public function TaskBase() {}


    private var _aborted:Boolean;
    private var _characteristicsId:String;
    private var _currentExecutorPhase:JobExecutorPhase;
    private var _definitionSetName:String;
    private var _definitionSetVid:OvalVersionedIdentifier;
    private var _endTime:Date;
    private var _enqueueTime:Date;
    private var _environmentId:String;
    private var _environmentName:String;
    private var _messages:Array;
    private var _numberOfDefinitions:int;
    private var _processedNumberOfTests:int;
    private var _resultsId:String;
    private var _schedulerJob:SchedulerJob;
    private var _startTime:Date;
    private var _statusMessage:String;
    private var _taskId:String;
    private var _totalNumberOfTests:int;

    public function set aborted(value:Boolean):void {
        _aborted = value;
    }
    public function get aborted():Boolean {
        return _aborted;
    }

    public function set characteristicsId(value:String):void {
        _characteristicsId = value;
    }
    public function get characteristicsId():String {
        return _characteristicsId;
    }

    public function set currentExecutorPhase(value:JobExecutorPhase):void {
        _currentExecutorPhase = value;
    }
    public function get currentExecutorPhase():JobExecutorPhase {
        return _currentExecutorPhase;
    }

    public function set definitionSetName(value:String):void {
        _definitionSetName = value;
    }
    public function get definitionSetName():String {
        return _definitionSetName;
    }

    public function set definitionSetVid(value:OvalVersionedIdentifier):void {
        _definitionSetVid = value;
    }
    public function get definitionSetVid():OvalVersionedIdentifier {
        return _definitionSetVid;
    }

    public function set endTime(value:Date):void {
        _endTime = value;
    }
    public function get endTime():Date {
        return _endTime;
    }

    public function set enqueueTime(value:Date):void {
        _enqueueTime = value;
    }
    public function get enqueueTime():Date {
        return _enqueueTime;
    }

    public function set environmentId(value:String):void {
        _environmentId = value;
    }
    public function get environmentId():String {
        return _environmentId;
    }

    public function set environmentName(value:String):void {
        _environmentName = value;
    }
    public function get environmentName():String {
        return _environmentName;
    }

    public function set messages(value:Array):void {
        _messages = value;
    }
    public function get messages():Array {
        return _messages;
    }

    public function set numberOfDefinitions(value:int):void {
        _numberOfDefinitions = value;
    }
    public function get numberOfDefinitions():int {
        return _numberOfDefinitions;
    }

    public function set processedNumberOfTests(value:int):void {
        _processedNumberOfTests = value;
    }
    public function get processedNumberOfTests():int {
        return _processedNumberOfTests;
    }

    public function set resultsId(value:String):void {
        _resultsId = value;
    }
    public function get resultsId():String {
        return _resultsId;
    }

    public function set schedulerJob(value:SchedulerJob):void {
        _schedulerJob = value;
    }
    public function get schedulerJob():SchedulerJob {
        return _schedulerJob;
    }

    public function set startTime(value:Date):void {
        _startTime = value;
    }
    public function get startTime():Date {
        return _startTime;
    }

    public function set statusMessage(value:String):void {
        _statusMessage = value;
    }
    public function get statusMessage():String {
        return _statusMessage;
    }

    public function set taskId(value:String):void {
        _taskId = value;
    }
    public function get taskId():String {
        return _taskId;
    }

    public function set totalNumberOfTests(value:int):void {
        _totalNumberOfTests = value;
    }
    public function get totalNumberOfTests():int {
        return _totalNumberOfTests;
    }
}
}

这两个类都是由我的maven构建从相应的Java类生成的,而且类型很好地融合在一起。

2 个答案:

答案 0 :(得分:0)

您是否可以访问正在读取所有这些消息的套接字类?在反序列化之前跟踪缓冲区,你至少应该能够找到给你带来麻烦的类。

如果失败,请在反序列化后跟踪对象,它应该是抛出错误后的第一个对象。

答案 1 :(得分:0)

这是你必须自己调试的东西,但我有一种直觉,认为问题是因为你的java DTO发送的数据与你的AS3类不一样,即使你有RemoteClass元数据说它是。

你错过了一处房产吗?或者财产不匹配?这是导致错误的最可能原因。我建议你尽可能多地调试java端,并使用类似firebug的东西来查看服务器的请求/响应。