Handle the case of Arrays and how they are mapped.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/99c8fc47 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/99c8fc47 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/99c8fc47 Branch: refs/heads/2.7.x-fixes Commit: 99c8fc4791f9c91b4adba6f2633e956aa481d4e2 Parents: f911912 Author: Daniel Kulp <[email protected]> Authored: Thu Mar 27 01:14:14 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Wed Apr 2 02:12:26 2014 -0400 ---------------------------------------------------------------------- .../cxf/common/jaxb/SchemaCollectionContextProxy.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/99c8fc47/api/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java b/api/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java index b150fd0..c5e7d65 100644 --- a/api/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java +++ b/api/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java @@ -125,6 +125,12 @@ public class SchemaCollectionContextProxy implements JAXBContextProxy { } public Object getBeanInfo(Class<?> cls) { + Class<?> origCls = cls; + String postfix = ""; + while (cls.isArray()) { + cls = cls.getComponentType(); + postfix += "Array"; + } XmlRootElement xre = cls.getAnnotation(XmlRootElement.class); String name = xre == null ? "##default" : xre.name(); String namespace = xre == null ? "##default" : xre.namespace(); @@ -143,20 +149,20 @@ public class SchemaCollectionContextProxy implements JAXBContextProxy { namespace = defaultNamespace; } } - final QName qname = new QName(namespace, name); + final QName qname = new QName(namespace, name + postfix); final XmlSchemaElement el = schemas.getElementByQName(qname); XmlSchemaType type = null; if (el != null) { type = el.getSchemaType(); } if (type == null) { - type = schemas.getTypeByQName(getTypeQName(cls, namespace)); + type = schemas.getTypeByQName(getTypeQName(origCls, namespace)); if (type == null) { type = schemas.getTypeByQName(qname); } } if (type == null) { - type = mapToSchemaType(cls, namespace); + type = mapToSchemaType(origCls, namespace); /* if (type == null) { type = mapToSchemaType(cls, namespace);
