castor
  1. castor
  2. CASTOR-1335

Incorrect java code generated when choice has long and string

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.7
    • Fix Version/s: 1.0.4
    • Component/s: XML code generator
    • Labels:
      None
    • Environment:
      Most
    • Number of attachments :
      2

      Description

      Incorrect java code generated, well maybe should issue an error, with this fragment

      <xs:element name="UniqueID">
      <xs:complexType>
      <xs:choice>
      <xs:element name="OID" type="xs:long"/>
      <xs:element name="Name">
      <xs:annotation>
      <xs:documentation>Only currently supported for locating to topics</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
      <xs:restriction base="xs:string">
      <xs:maxLength value="255"/>
      </xs:restriction>
      </xs:simpleType>
      </xs:element>
      </xs:choice>
      </xs:complexType>

      generates ...

      /**

      • Sets the value of field 'name'. The field 'name' has the
      • following description: Only currently supported for locating
      • to topics
      • @param name the value of field 'name'.
        */
        public void setName(java.lang.String name)
        { this._name = name; this._choiceValue = name; }

        //-- void setName(java.lang.String)

      /**

      • Sets the value of field 'OID'.
      • @param OID the value of field 'OID'.
        */
        public void setOID(long OID)
        { this._OID = OID; this._choiceValue = OID; this._has_OID = true; }

        //-- void setOID(long)

      which fails trying to set choiceValue (Object) to a long ...
      C:\svn-migrate\workspace\XPL_ALL\XPL_EJB\target\castor\src\com\syntegra\sbs\bg\x
      pl\persistence\auto\UniqueID.java:196: incompatible types
      found : long
      required: java.lang.Object
      this._choiceValue = OID;
      ^

      This works on 0.9.5.2

      1. castor-1335.xml
        4 kB
        Martin West
      2. patch.c1335.20060912.txt
        2 kB
        Werner Guttmann

        Issue Links

          Activity

          Hide
          Werner Guttmann added a comment -

          Martin, the XML instance you sent does not match the XML schema for BusGovContent content. Is this on intention ?

          Show
          Werner Guttmann added a comment - Martin, the XML instance you sent does not match the XML schema for BusGovContent content. Is this on intention ?
          Hide
          Martin West added a comment -

          Not exactly, for some reason when I tried to get the file out of the email I sent you it came out zero length and this was a guess as to which file I sent, the algorythm I used was the latest testfile

          Show
          Martin West added a comment - Not exactly, for some reason when I tried to get the file out of the email I sent you it came out zero length and this was a guess as to which file I sent, the algorythm I used was the latest testfile
          Hide
          Edward Kuns added a comment -

          Martin, would it be OK if we use the schema you EMailed Werner as a unit test for Castor? It's a very large schema that exercises a lot of features, so it's a great candidate to be used as a "source generator test case".

          Show
          Edward Kuns added a comment - Martin, would it be OK if we use the schema you EMailed Werner as a unit test for Castor? It's a very large schema that exercises a lot of features, so it's a great candidate to be used as a "source generator test case".
          Hide
          Martin West added a comment -

          I dont see why you shouldnt.

          Show
          Martin West added a comment - I dont see why you shouldnt.
          Hide
          Edward Kuns added a comment -

          Thanks.

          Show
          Edward Kuns added a comment - Thanks.

            People

            • Assignee:
              Werner Guttmann
              Reporter:
              Martin West
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 30 minutes Original Estimate - 30 minutes
                30m
                Remaining:
                Time Spent - 1 hour Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - 1 hour Remaining Estimate - 30 minutes
                1h