Actually I think this is the fix:

            String uri = m_unmarshalContext.getNamespaceUri(i);
            if(prefix == null) {
                Namespace namespace = Namespace.get(uri);
                element.add(namespace);
            } else {
                element.addNamespace(prefix, uri);
            }


On 5/31/09 7:28 PM, "Karim Qazi" <reem...@gmail.com> wrote:

I think I found a possible defect in Dom4JMapperBase related to unmarshalling 
an XML document with a namespace without a prefix.  For instance <foo 
xmlns="http://whoknows";></foo> causes Dom4J to throw a NullPointerException, 
but  <foo xmlns:bar="http://whoknows";></foo> does not.

If you go to line 347 in Dom4JMapperBase you'll see it doesn't do a null check. 
 I modified this 1 line of code to the following which seems to have fixed the 
issue for me:

String prefix = m_unmarshalContext.getNamespacePrefix(i) == null ? "" : 
m_unmarshalContext.getNamespacePrefix(i);




------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to