History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-673
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Diephouse
Reporter: Andres Bernasconi
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XFire

CLONE -Arrays of Collections do not map correctly [Patch Included] - Not Fixed

Created: 26/Sep/06 04:28 PM   Updated: 06/Oct/06 02:30 AM
Component/s: Aegis Module
Affects Version/s: 1.2-RC, 1.2, 1.1.2
Fix Version/s: 1.2.2

Time Tracking:
Not Specified

Environment: Xfire 1.1.2


 Description  « Hide
If I have a Service that returns an array of Collections / Map XFire fails saying that the keytype and componentType are not defined.

The problem seems to be that when an array is returned, XFire creates a new TypeInfo for the nested List / Map which does not inherit the keyType and componentType defined in the aegis mapping.

Here is an example

interface ArrayService{
    	public Map[] getMapArray();

	public List[] getArrayOfListsOfDoubles();
}
<mappings>
    <mapping>
                 <method name="getMapArray">
			<return-type keyType="java.lang.Double" componentType="java.lang.Double" />
		</method>

		<method name="getArrayOfListsOfDoubles">
			<return-type componentType="java.lang.Double" />
		</method>
    </mapping>
</mappings>

The problem was found at AbstractTypeCreator line 310. This was modified so now it looks like the following:

TypeClassInfo nestedInfo = createBasicClassInfo(componentType);
            nestedInfo.setKeyType(info.getKeyType());
            nestedInfo.setGenericType(info.getGenericType());

        	type = createTypeForClass(nestedInfo);
            getTypeMapping().register(type);

We will try to add the testcase for these scenarios.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Andres Bernasconi - 26/Sep/06 04:35 PM
Sorry for this clone, could not reopen the issue.

I am having the exact same problem on XFire 1.2.1 so I think this issue it is not closed.

Here are the details.

XMLTypeCreator.java:359
the KeyType for the InfoBean is still null, that is, it is not being "inherited" from the parent info bean which is an ArrayType. This makes XFire create a 'default' type in line 366, which returns an ObjecType. This object, in turn, has no typeMapping defined and causes my program to crash dramatically at:

Caused by: java.lang.NullPointerException
        at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:102)
        at org.codehaus.xfire.aegis.type.collection.MapType.readObject(MapType.java:70)
        at org.codehaus.xfire.aegis.type.basic.ArrayType.readCollection(ArrayType.java:80)
        at org.codehaus.xfire.aegis.type.basic.ArrayType.readObject(ArrayType.java:48)
        at org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:180)
        at org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:155)
        at org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206)
        at org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50)
        at org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)

Don't know if this is a problem affecting anybody else but me but...

Best Regards,
Andres Bernasconi.


Dan Diephouse - 27/Sep/06 09:44 PM
OK, I'll check into this for 1.2.2

Dan Diephouse - 29/Sep/06 01:15 PM
Have you tried this format?

<mapping>
<method name="getMapArray">
<return-type componentType="#map" />
</method>

<component name="map" class="java.util.Map" typeName="SomeMap" keyType="java.lang.Double" componentType="java.lang.Double" />
</mapping>

Its documented here:

http://xfire.codehaus.org/Mapping+collections

Going to check into the NPE some more though...


Dan Diephouse - 29/Sep/06 04:27 PM
I think I've fixed an issues in SVN. Here is a patched build:

http://snapshots.repository.codehaus.org/org/codehaus/xfire/xfire-all/1.2-SNAPSHOT/xfire-all-1.2-20060929.210820-24.jar

You'll want to use that syntax I outlined in my last comment though.


Dieter Bachmann - 06/Oct/06 02:30 AM
I'm not shure, if my actual problem is related to this issue: Using xfire 1.2.2 on Java 5 with annotations.

The strcture we are using contains of a a class that contains a List of an other class. The second class contains another list of a class. It's more or less a two-dimensional dynamic array.

the wsdl created contains only the second list. the first list is ignored.

<code java>
public class a{
private List<b> bList;

// getters and setters....
}

public class b{
private List<c> cList
// getters and setters ....
}

public class c{
//members..
//getters and setters...
}
</code>

The resulting WSDL holds a complex-type ArrayOfc but shows b instead of Arrayfb

any ideas, where this comes from or how to resolve this problem?

best regards
dieter