Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333505

Summary: Namespace Issue with StaX and TypeMappingInfo
Product: z_Archived Reporter: Matt MacIvor <matt.macivor>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matt MacIvor CLA 2011-01-04 13:43:25 EST
Due to the order of processing, EclipseLink JAXB will sometimes use a defaultNamespace even when it shouldn't. If there are global elements with a namespace of "", then a defaultNamespace other than "" shouldn't be used. The processing to check for this however is done BEFORE global elements from TypeMappingInfo are created, so they aren't included in the check.

This causes a problem when marshalling into an XMLStreamWriter or XMLEventWriter that already has a default namespace declared. EclipseLink will do special code to cancel out that declaration. However if this happens when the EclipseLink NamespaceResolver has a defaultNamespace, EclipseLink will try to declare the defaultNamespace twice on the same element which causes an exception.
Comment 1 Matt MacIvor CLA 2011-01-07 15:05:54 EST
Fix checked into main as of revision 8789
Reviewed by David McCann. 

Added a check for "" namespace on Root-Level elements defined on TypeMappingInfo objects. If there's a root element with "" namespace, then a default namespace of something other than "" should never be used.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:36:05 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink