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

Bug 315786

Summary: MOXy - Need to handle double quote char in attributes and text nodes
Product: z_Archived Reporter: David McCann <david.mccann>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: adrian.goerler, polly.c.chang
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Contains proposed fix + test case modifications for the 1.1 stream
none
Contains proposed fix + test case modifications for the 1.2 stream
none
Contains proposed fix + test case modifications for the 2.0 stream
none
Contains proposed fix + test case modifications for the 2.1 stream none

Description David McCann CLA 2010-06-04 11:19:25 EDT
We need to replace the '"' character with '&quot;' when marshalling.  We will currently marshal the attribute string: 

"A\"B"

like:

myAttribute="A"B"

which will cause unmarshal exceptions.

We should write out:

"A&quot;B"

The fix will need to be done in WriterRecord and OutputStreamRecord.  We already escape '<' and '&' in the writeValue method; we will need to add a case for '"'.
Comment 1 David McCann CLA 2010-06-04 11:19:57 EDT
This fix is required in the 1.1.0 branch, and will also be merged into subsequent branches.
Comment 2 David McCann CLA 2010-06-04 13:41:20 EDT
Created attachment 171137 [details]
Contains proposed fix + test case modifications for the 1.1 stream

This patch is for the 1.1 stream.
Comment 3 David McCann CLA 2010-06-04 15:05:55 EDT
Checked in fix for 1.1 stream.

Reviewed by:  matt.macivor@oracle.com
Tests: all unit tests pass as expected; oxm/mappings/directtofield/identifiedbyname/xmlattribute/DirectToXMLAttributeIdentifiedByNameSpecialCharactersTestCases; oxm/mappings/directtofield/identifiedbyname/xmlelement/DirectToXMLElementIdentifiedByNameSpecialCharactersTestCases
Comment 4 David McCann CLA 2010-06-04 15:06:34 EDT
Created attachment 171150 [details]
Contains proposed fix + test case modifications for the 1.2 stream
Comment 5 David McCann CLA 2010-06-04 15:06:59 EDT
Created attachment 171151 [details]
 Contains proposed fix + test case modifications for the 2.0 stream
Comment 6 David McCann CLA 2010-06-04 15:07:23 EDT
Created attachment 171152 [details]
 Contains proposed fix + test case modifications for the 2.1 stream
Comment 7 Adrian Goerler CLA 2010-06-09 03:21:56 EDT
To me, the patch seems to miss escaping '>' (&gt;)  and '\'' (&apos;).
Comment 8 David McCann CLA 2010-06-09 08:51:30 EDT
(In reply to comment #7)
> To me, the patch seems to miss escaping '>' (&gt;)  and '\'' (&apos;).

This bug deals specifically with '"'.  We currently have no plans to escape characters other than '&' (&amp;), '<' (&lt;), and '"' (&quot;).  If this is something you require, you may want to file a bug and we can investigate further.
Comment 9 David McCann CLA 2010-06-09 10:51:47 EDT
Fix checked into the 2.2 stream.  Only 2.1 stream remains...
Comment 10 David McCann CLA 2010-06-15 15:24:28 EDT
Fix was also checked into the 1.2 stream...
Comment 11 David McCann CLA 2010-06-23 14:21:44 EDT
Fix checked into the 2.1 stream.

Reviewed by: matt.macivor@oracle.com, blaise.doughan@oracle.com 
Tests: all unit tests pass as expected; jaxb/xmlelement/XmlElementTestCases; oxm/mappings/directtofield/identifiedbyname/xmlattribute/DirectToXMLAttributeIdentifiedByNameSpecialCharactersTestCases; oxm/mappings/directtofield/identifiedbyname/xmlelement/DirectToXMLElementIdentifiedByNameSpecialCharactersTestCases
Comment 12 Eclipse Webmaster CLA 2022-06-09 10:14:07 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 13 Eclipse Webmaster CLA 2022-06-09 10:35:25 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink