|
[xstream-dev] [jira] Closed: (XSTR-97) Duplicate elements should cause an e: msg#00022java.xstream.devel
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://jira.codehaus.org/browse/XSTR-97 Here is an overview of the issue: --------------------------------------------------------------------- Key: XSTR-97 Summary: Duplicate elements should cause an exception Type: New Feature Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: XStream Components: Converters Fix Fors: 1.0.2 Assignee: Reporter: Joe Walnes Created: Tue, 29 Jun 2004 5:36 PM Updated: Sun, 25 Jul 2004 5:44 AM Description: --- From Tom Ayerst --- In our current xml marshalling/unmarshalling scheme we have code to spot duplicate elements in the xml (something historically managed to corrupt the xml). XStream deals with this silently: import com.thoughtworks.xstream.XStream; import junit.framework.TestCase; public class DuplicateElementTest extends TestCase { protected XStream converter = new XStream(); public void testUniqueId() { String xml = "<TestFixture>" + "<uniqueId>1</uniqueId>" + "</TestFixture>"; TestFixture fixture = (TestFixture)converter.fromXML(xml); assertEquals(1, fixture.uniqueId); } public void testCorruptXml() { String xml = "<TestFixture>" + "<uniqueId>1</uniqueId>" + "<uniqueId>2</uniqueId>" + "</TestFixture>"; /** * I would expect some kind of exception here, xml does not conform to * class definition */ TestFixture fixture = (TestFixture)converter.fromXML(xml); assertEquals(1, fixture.uniqueId); } } class TestFixture { public int uniqueId; } testCorruptXml produces: junit.framework.AssertionFailedError: expected:<1> but was:<2> I would like to spot this with some kind of invalid mapping exception (to convince my team that XStream is better than our current solution (It is very, very much better!) ). Is this specified XStream behaviour? Does it already do it? I'm guessing that this behaviour helps deal with versioning issues etc. but the example above cannot be valid, can it? Cheers Tom --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [xstream-dev] [jira] Closed: (XSTR-86) Cannot correctly convert Calendar classes, jira-yCVjj/EcxBJg9hUCZPvPmw |
|---|---|
| Next by Date: | [xstream-dev] [jira] Updated: (XSTR-92) No treatment of specialized serialization, jira-yCVjj/EcxBJg9hUCZPvPmw |
| Previous by Thread: | [xstream-dev] [jira] Closed: (XSTR-86) Cannot correctly convert Calendar classes, jira-yCVjj/EcxBJg9hUCZPvPmw |
| Next by Thread: | [xstream-dev] [jira] Updated: (XSTR-92) No treatment of specialized serialization, jira-yCVjj/EcxBJg9hUCZPvPmw |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |