Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5070

Enumeration type fromValue() function update breaks stub compilation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • 1.6.0
    • None
    • codegen
    • None

    Description

      The "fix" in AXIS2-3034 unfortunately breaks WSDL generation in that the fromValue() function is not compilable in certain situations. For example, with the following type:

      <xs:simpleType name="tSomeType">
      <xs:restriction base="xs:int">
      <xs:enumeration value="1">
      <xs:annotation>
      <xs:documentation>Something</xs:documentation>
      </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="2">
      <xs:annotation>
      <xs:documentation>Something else</xs:documentation>
      </xs:annotation>
      </xs:enumeration>
      </xs:restriction>
      </xs:simpleType>

      Corresponding fromValue function now contains:

      public static TSomeType fromValue(int value)
      throws java.lang.IllegalArgumentException {
      TSomeType enumeration = (TSomeType)

      table.get(value + "");

      if ((enumeration == null) && !((value == null) || (value.equals(""))))

      { throw new java.lang.IllegalArgumentException(); }


      return enumeration;
      }

      Since value is of type 'int', the updated if statement results in compilation failure ("int cannot be dereferenced").

      Tested with Axis2 1.6.0 wsdl2java.

      Regards,
      VT

      Attachments

        Issue Links

          Activity

            People

              sagara Sagara Gunathunga
              vilnis.termanis Vilnis Termanis
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: