pupsnow / dphibernate

Automatically exported from code.google.com/p/dphibernate
0 stars 0 forks source link

Array serialization issue #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a java service method that returns array type to Flex
2. call this service method from flex and assign the results to
ArrayCollection.
3.

What is the expected output? What do you see instead?
Flex side ArrayCollection should be populated with the data from java
service, but it returns null value.

What version of the product are you using? On what operating system?
latest (1.0.17)

Please provide any additional information below.

HibernateSerializer doesn't validate the array type. Fix for this issue as
below...

Class: HibernateSerializer
Method: private Object translate(Object obj)

Change the following piece of code
===================================
else if (obj instanceof Object 
                && (!isSimple(obj)) 
                && !(obj instanceof ASObject) 
                )
        {
            result = writeBean(obj, result, key);
        } 

===================================

to

==================================
else if (obj instanceof Object 
                && (!isSimple(obj)) 
                && !(obj instanceof ASObject) 
                && !isArrayType(obj.getClass()))
        {
            result = writeBean(obj, result, key);
        } 
==================================

Create a new method isArrayType

================================
private boolean isArrayType(Class desiredClass)
    {

        if (desiredClass.isArray())
        {
            return true;
        }
        else
        {
            return false;
        }       
    }
================================

Original issue reported on code.google.com by kgajula...@gmail.com on 11 May 2009 at 2:41

GoogleCodeExporter commented 9 years ago
Issue resolved a while back (Can't find the rev)

Original comment by martypit...@gtempaccount.com on 6 Jul 2010 at 1:53