christophe-hall / as3-commons

Automatically exported from code.google.com/p/as3-commons
0 stars 0 forks source link

Type.forName() throws error if argument inherits from EventDispatcher #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.var t:Type = Type.forName("flash.events.EventDispatcher");
2.compile and run
3.see exception in debug trace
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    preinitialize="preinit()"
    layout="absolute"
    minWidth="1024"
    minHeight="768">

    <mx:Script>
        <![CDATA[
            import org.as3commons.reflect.Type;

            private function preinit():void
            {
                var t:Type = Type.forName("flash.events.EventDispatcher");
            }
        ]]>
    </mx:Script>

</mx:Application>

What is the expected output? What do you see instead?

Message: Error #2007: Parameter type must be non-null.
Stack trace: TypeError: Error #2007: Parameter type must be non-null.
    at flash.events::Event()
    at
org.as3commons.lang::ClassUtils$/newInstance()[/home/christophe/IdeaProjects/as3
commons/as3-commons-lang/src/main/actionscript/org/as3commons/lang/ClassUtils.as
:309]
    at
org.as3commons.reflect::Type$/getTypeDescription()[/home/christophe/IdeaProjects
/as3commons/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Typ
e.as:221]
    at
org.as3commons.reflect::Type$/forClass()[/home/christophe/IdeaProjects/as3common
s/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:138]
    at
org.as3commons.reflect::Type$/forName()[/home/christophe/IdeaProjects/as3commons
/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:108]
    at
TypeXmlParser$/parseParameters()[/home/christophe/IdeaProjects/as3commons/as3-co
mmons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:668]
    at
TypeXmlParser$/parseMethodsByModifier()[/home/christophe/IdeaProjects/as3commons
/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:656]
    at
TypeXmlParser$/parseMethods()[/home/christophe/IdeaProjects/as3commons/as3-commo
ns-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:631]
    at
org.as3commons.reflect::Type$/forClass()[/home/christophe/IdeaProjects/as3common
s/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:148]
    at
org.as3commons.reflect::Type$/forName()[/home/christophe/IdeaProjects/as3commons
/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:108]
    at
TypeXmlParser$/parseParameters()[/home/christophe/IdeaProjects/as3commons/as3-co
mmons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:668]
    at
TypeXmlParser$/parseConstructor()[/home/christophe/IdeaProjects/as3commons/as3-c
ommons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:622]
    at
org.as3commons.reflect::Type$/forClass()[/home/christophe/IdeaProjects/as3common
s/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:146]
    at
org.as3commons.reflect::Type$/forName()[/home/christophe/IdeaProjects/as3commons
/as3-commons-reflect/src/main/actionscript/org/as3commons/reflect/Type.as:108]
    at TestReflect/preinit()[C:\Documents and Settings\tpatton\Adobe Flash
Builder Beta\TestReflect\src\TestReflect.mxml:14]
    at TestReflect/___TestReflect_Application1_preinitialize()[C:\Documents
and Settings\tpatton\Adobe Flash Builder
Beta\TestReflect\src\TestReflect.mxml:3]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.x\frameworks\projects\framew
ork\src\mx\core\UIComponent.as:9308]
    at
mx.core::UIComponent/initialize()[C:\autobuild\3.x\frameworks\projects\framework
\src\mx\core\UIComponent.as:5367]
    at
mx.core::Container/initialize()[C:\autobuild\3.x\frameworks\projects\framework\s
rc\mx\core\Container.as:2526]
    at
mx.core::Application/initialize()[C:\autobuild\3.x\frameworks\projects\framework
\src\mx\core\Application.as:846]
    at TestReflect/initialize()[C:\Documents and Settings\tpatton\Adobe Flash
Builder Beta\TestReflect\src\TestReflect.mxml:0]
    at
mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdde
d()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager
.as:2043]
    at
mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.x\framework
s\projects\framework\src\mx\managers\SystemManager.as:3273]
    at
mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameH
andler()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemMa
nager.as:3097]
    at
mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.x\frameworks\projec
ts\framework\src\mx\managers\SystemManager.as:2955]

What version of the product are you using? On what operating system?
as3commons-reflect.1.1.swc
Windows XP SP 2
Flash Builder 4 targeting Flex 3.4 and Flash Plasyer 10.

Please provide any additional information below.
tobiaspatton-at-gmail-dot-com

Original issue reported on code.google.com by tobiaspa...@gmail.com on 25 Sep 2009 at 6:36

GoogleCodeExporter commented 8 years ago
Ignore this bug.

Just noticed this in org.as3commons.reflect.Type:

                    // As the constructor may throw Errors on null arguments arguments 
                    // surround it with a try/catch block
                    try {
                        org.as3commons.lang.ClassUtils.newInstance(clazz, args);
                    } catch (e:Error) {
                        // Logging is set to debug level as any Error ocurring here shouldn't 
                        // cause any problem to the application
                        logger.debug("Error while instantiating class {0} with null arguments in order
to retrieve constructor argument types: {1}, {2}" +
                                     "\nMessage: {3}" + "\nStack trace: {4}", clazz, e.name, e.errorID,
e.message, e.getStackTrace());
                    }

Original comment by tobiaspa...@gmail.com on 25 Sep 2009 at 10:56

GoogleCodeExporter commented 8 years ago

Original comment by christophe.herreman on 5 Oct 2009 at 4:00