You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by ja...@ws.apache.org on 2004/09/02 10:47:11 UTC

[jira] Commented: (JAXME-10) PATCH generated TypeHandler, Overly strict property/element ordering

The following comment has been added to this issue:

     Author: Nacho G. Mac Dowell
    Created: Thu, 2 Sep 2004 1:46 AM
       Body:
I could not reproduce this bug with the following XSD and different XML's against cvs head using the UnmarshalMarshalUnmarshal test.

I relaxed and then relaxed and then relaxed the given xml example and was unable to reproduce. Don't know if this was previously fixed.

Some changes were made to the xsd to make it compilable.

XSD - 
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://commons.dspc.net/activitymodel"
  xmlns="http://commons.dspc.net/activitymodel">
  <xs:element name="TransmissionData">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="sender">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="e-mail" minOccurs="0"
                maxOccurs="1" type="xs:string" />
              <xs:element name="phone" minOccurs="1"
                maxOccurs="1" type="xs:string" />
              <xs:element name="crypt-signature"
                minOccurs="0" maxOccurs="1" type="xs:string" />
            </xs:sequence>
            <xs:attribute name="name" />
            <xs:attribute name="account-id" />
          </xs:complexType>
        </xs:element>
        <xs:element name="recipient">
          <xs:complexType>
            <xs:attribute name="name" type="xs:string" />
            <xs:attribute name="account-id"
              type="xs:string" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="created" />
      <xs:attribute name="mail-id" />
    </xs:complexType>
  </xs:element>
</xs:schema>

XML1 -
<?xml version="1.0" encoding="UTF-8"?>
<p:TransmissionData mail-id="mail456.test-account@dspc.net"
    xmlns:p="http://commons.dspc.net/activitymodel">
    <sender name="Joe Tester" account-id="test-account@dspc.net">
        <e-mail>test- account@bluprints.com</e-mail>
        <phone>0793041414141</phone>
        <crypt-signature />
    </sender>
    <recipient name="Henrik Vendelbo"
        account-id="hvendelbo@bluprints.com" />
</p:TransmissionData>

XML2 -
<?xml version="1.0" encoding="UTF-8"?>
<p:TransmissionData mail-id="mail456.test-account@dspc.net"
    xmlns:p="http://commons.dspc.net/activitymodel">
    <sender name="Joe Tester" account-id="test-account@dspc.net">
        <e-mail>test- account@bluprints.com</e-mail>
        <phone>0793041414141</phone>
    </sender>
    <recipient name="Henrik Vendelbo"
        account-id="hvendelbo@bluprints.com" />
</p:TransmissionData>

XML3 -
<?xml version="1.0" encoding="UTF-8"?>
<p:TransmissionData mail-id="mail456.test-account@dspc.net"
    xmlns:p="http://commons.dspc.net/activitymodel">
    <sender name="Joe Tester" account-id="test-account@dspc.net"/>
    <recipient name="Henrik Vendelbo"
        account-id="hvendelbo@bluprints.com" />
</p:TransmissionData>



---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/JAXME-10?page=comments#action_38037

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/JAXME-10

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JAXME-10
    Summary: PATCH generated TypeHandler, Overly strict property/element ordering
       Type: Bug

     Status: Reopened

    Project: JaxMe
 Components: 
             JaxMe Core
   Versions:
             current (nightly)

   Assignee: JaxMe Developers mailing list
   Reporter: Henrik Vendelbo

    Created: Sat, 1 Nov 2003 1:21 PM
    Updated: Thu, 2 Sep 2004 1:46 AM
Environment: Operating System: Other
Platform: Other

Description:
When I create a JAXB object and only set some of the properties I can marshall 
it without a problem, producing neat XML.

When I then try to unmarshal it I get an exception.

Apparently elements in the sequence must be set in that order, without 
skipping any so that for

<element name="prop1">
<element name="prop2">
<element name="prop3">

An object created and marshalled after setting 2 properties
object.setProp1
object.setProp2

will work fine when unmarshalling.

While
object.setProp1
object.setProp3

will bomb since one was skipped.

To fix it the xxTypeHandler generated code needs to relax the check by changing

switch (__state) {
  case 4:
    __state = 5;

to

switch (__state) {
  case 0:
  case 3:
  case 4:
    __state = 5;

(As far as I can tell, that is)


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org