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

Bug 319028

Summary: Empty String ("") value incorrectly marshalled to XML
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.oxm-inbox, rick.barkhouse, tomlee
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
MOXy - Test Cases
none
MOXy - Fix none

Description Blaise Doughan CLA 2010-07-06 12:00:34 EDT
Given the following object:

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Customer {

    private String name;

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}


If the name is set to "", then the document should marshal as:

<customer><name></name></customer>

But is currently being marshalled as:

<customer/>
Comment 1 Blaise Doughan CLA 2010-07-06 14:18:10 EDT
Created attachment 173581 [details]
MOXy - Test Cases
Comment 2 Blaise Doughan CLA 2010-07-06 14:18:45 EDT
Created attachment 173582 [details]
MOXy - Fix
Comment 3 Blaise Doughan CLA 2010-07-07 10:43:48 EDT
Fix checked into 2.1.1 at rev:  7755
Fix checked into trunk at rev:  7756

Code reviewed by:  Matt MacIvor
Comment 4 T Lee CLA 2013-04-29 17:50:39 EDT
I'm seeing some behavior quite similar to this in a recent bug-fix release:

org.eclipse.persistence.moxy_2.4.2.v20121206-a9d0e8d.jar
org.eclipse.persistence.core_2.4.2.v20121206-a9d0e8d.jar
Specifically, the parser handles

 <constant xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string"> </constant> 

(a blank) but fails on 

<constant xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string"></constant>

(an empty string). 


Is there a chance that this bug has crept into the above interim release somehow? 
If there isn't a clear immediate resolution I'll post a new bug.

Tom
Comment 5 Rick Barkhouse CLA 2013-04-30 09:45:43 EDT
Hi Tom,

From the information you've provided it's not clear that your issue is related to this bug fix.  Could you please enter a new bug describing the problem that you are seeing, and please include as much information as possible.  A standalone test case showing the issue is preferable, but if that is not possible, please send us more information about your object model, the XML being processed, and any stack traces that you are seeing.
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:23:07 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink