Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.1.2, 1.2-RC, 1.2
-
Fix Version/s: 1.2.2
-
Component/s: Aegis Module
-
Labels:None
-
Environment:Xfire 1.1.2
-
Number of attachments :
Description
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.
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.
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)