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

Allow forward-compatibility by ignoring unexpected enumeration values

    XMLWordPrintableJSON

Details

    Description

      AXIS2-4859 has been patched adding the -Eiu option to ignore unexpected elements. However, to truly be forward-compatible, generated code should also ignore unexpected enumeration values.
      Here's the snippet necessary for the adb code generation. I opted to return null when an unexpected enumeration is found, as opposed to skip it:

      ADBBeanTemplate-bean.xsl line 2135:

                          // handle unexpected enumeration values properly
                          <xsl:if test="$ignoreunexpected">
                              log.warn("Unexpected value " + value + " for enumeration <xsl:value-of select="$name"/>");
                              return enumeration;
                          </xsl:if>
                          <xsl:if test="not($ignoreunexpected)">
                              if ((enumeration == null) &amp;&amp; !((value == null) || (value.equals("")))) {
                                  throw new java.lang.IllegalArgumentException();
                              }
                              return enumeration;
                          </xsl:if>
      

      Attachments

        1. favoriteCharacters_client_afterPatch.zip
          15 kB
          Cleber Zarate
        2. favoriteCharacters_client_beforePatch.zip
          14 kB
          Cleber Zarate
        3. favoriteCharacters_service_new_enumeration_value.zip
          112 kB
          Cleber Zarate
        4. favoriteCharacters_service_original_enumeration_values.zip
          131 kB
          Cleber Zarate
        5. patch.txt
          1 kB
          Cleber Zarate

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cleber.zarate Cleber Zarate
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: