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

After use -Eiu in wsdl2java.sh, factory classes for enumeration typte log warning erroneously

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.7.4
    • None
    • adb
    • None

    Description

      For this schema,

      <xs:simpleType name="CabinType">
          <xs:restriction base="xs:string">
              <xs:enumeration value="Default"/>
              <xs:enumeration value="Y"/>
              <xs:enumeration value="S"/>
              <xs:enumeration value="C"/>
              <xs:enumeration value="J"/>
              <xs:enumeration value="F"/>
              <xs:enumeration value="P"/>
          </xs:restriction>
      </xs:simpleType>
      

      Without -Eiu, the generated code is

      public static class Factory {
          public static CabinType fromValue(java.lang.String value)
              throws java.lang.IllegalArgumentException {
              CabinType enumeration = (CabinType) _table_.get(value);
      
              // handle unexpected enumeration values properly
              if (enumeration == null) {
                  throw new java.lang.IllegalArgumentException();
              }
              return enumeration;
          }
      

      With -Eiu, the code is

      public static class Factory {
          public static CabinType fromValue(java.lang.String value)
              throws java.lang.IllegalArgumentException {
              CabinType enumeration = (CabinType) _table_.get(value);
      
              // handle unexpected enumeration values properly
              log.warn("Unexpected value " + value +
                  " for enumeration CabinType");
              return enumeration;
          }
      

      Obviously the code above is wrong

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jing.teng@gmail.com Jing Teng
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: