Skip to content

Commit 0f831ec

Browse files
author
Christoph Läubrich
committed
Fallback to node name if not local name is available
Fix #1807
1 parent b7d1ff7 commit 0f831ec

File tree

1 file changed

+3
-1
lines changed
  • jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime

1 file changed

+3
-1
lines changed

jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/BinderImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import org.w3c.dom.Node;
2121
import org.xml.sax.SAXException;
2222

23+
import java.util.Objects;
24+
2325
import javax.xml.namespace.QName;
2426
import javax.xml.validation.Schema;
2527

@@ -178,7 +180,7 @@ public XmlNode updateXML(Object jaxbObject, XmlNode xmlNode) throws JAXBExceptio
178180
// the marshalling successful.
179181
JaxBeanInfo bi = context.getBeanInfo(jaxbObject, true);
180182
if(!bi.isElement())
181-
jaxbObject = new JAXBElement(new QName(e.getNamespaceURI(),e.getLocalName()),bi.jaxbType,jaxbObject);
183+
jaxbObject = new JAXBElement(new QName(e.getNamespaceURI(),Objects.requireNonNullElse(e.getLocalName(), e.getNodeName()),bi.jaxbType,jaxbObject);
182184

183185

184186
getMarshaller().marshal(jaxbObject,p);

0 commit comments

Comments
 (0)