Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319028 - Empty String ("") value incorrectly marshalled to XML
Summary: Empty String ("") value incorrectly marshalled to XML
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-06 12:00 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:23 EDT (History)
3 users (show)

See Also:


Attachments
MOXy - Test Cases (5.93 KB, patch)
2010-07-06 14:18 EDT, Blaise Doughan CLA
no flags Details | Diff
MOXy - Fix (644 bytes, patch)
2010-07-06 14:18 EDT, Blaise Doughan CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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