Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-1392

axiom_element_find_namespace() can erroneously return NULL with default namespaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 1.7.0
    • core/clientapi
    • None

    Description

      The recursive function axiom_element_find_namespace() can erroneously return NULL when it encounters an element that has a default namespace. The problem is in the following block of code contained within axiom_element_find_namespace():

      default_ns = axiom_element_get_default_namespace(om_element,
      env, element_node);
      if (default_ns)
      {
      axis2_char_t *default_uri = NULL;
      default_uri = axiom_namespace_get_uri(default_ns, env);

      if (axutil_strcmp(uri, default_uri) == 0)

      { return default_ns; }

      else

      { return NULL; }

      }

      I am assuming that this code exists as an optimization to potentially avoid the for-loop a few lines farther down. The original intent appears to be to check if the needed namespace is equal to the default and, if so, return that and avoid the for-loop. However, instead of returning NULL if the default namespace is not equal to the desired namespace, the code should then continue on to the for-loop.

      Please review and test my attached fix (om_element.c.diff) for possible inclusion in the Axis2/C project. Let me know if I have drawn any incorrect conclusions or if something is not clear.

      Thanks,
      Russell

      Attachments

        1. om_element.c.diff
          0.5 kB
          Russell Tempero

        Activity

          People

            nandika Korale Gamaralalage Nandika Chandrasiri Jayawardana
            russell.tempero Russell Tempero
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified