{
StreamSource source = new StreamSource(entityStream);
JAXBContext ctx = finder.findCacheContext(mediaType, annotations, JaxbMap.class, JaxbMap.Entry.class, valueType);
JAXBElement<JaxbMap> ele = ctx.createUnmarshaller().unmarshal(source, JaxbMap.class);
WrappedMap wrapped = FindAnnotation.findAnnotation(annotations, WrappedMap.class);
if (wrapped != null)
{
if (!wrapped.map().equals(ele.getName().getLocalPart()))
{
throw new JAXBUnmarshalException("Map wrapping failed, expected root element name of " + wrapped.map() + " got " + ele.getName().getLocalPart());
}
if (!wrapped.namespace().equals(ele.getName().getNamespaceURI()))
{
throw new JAXBUnmarshalException("Map wrapping failed, expect namespace of " + wrapped.namespace() + " got " + ele.getName().getNamespaceURI());
}
}
jaxbMap = ele.getValue();
HashMap map = new HashMap();
Unmarshaller unmarshaller = ctx.createUnmarshaller();
unmarshaller = AbstractJAXBProvider.decorateUnmarshaller(valueType, annotations, mediaType, unmarshaller);
for (int i = 0; i < jaxbMap.getValue().size(); i++)
{
Element element = (Element) jaxbMap.getValue().get(i);
NamedNodeMap attributeMap = element.getAttributes();
String keyValue = null;
if (wrapped != null)
{
keyValue = element.getAttribute(wrapped.key());
}
else
{
if (attributeMap.getLength() == 0)