You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Nandika Jayawardana (JIRA)" <ji...@apache.org> on 2009/09/06 18:51:57 UTC

[jira] Resolved: (AXIS2C-1392) axiom_element_find_namespace() can erroneously return NULL with default namespaces

     [ https://issues.apache.org/jira/browse/AXIS2C-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nandika Jayawardana resolved AXIS2C-1392.
-----------------------------------------

       Resolution: Fixed
    Fix Version/s: Current (Nightly)

Patch applied, thanks for the patch

> axiom_element_find_namespace() can erroneously return NULL with default namespaces
> ----------------------------------------------------------------------------------
>
>                 Key: AXIS2C-1392
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1392
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: 1.6.0
>         Environment: $ uname -a
> Linux clearwater 2.6.18-8.el5 #1 SMP Thu Mar 15 19:46:53 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
> $ gcc --version
> gcc (GCC) 4.2.2
> Copyright (C) 2007 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>            Reporter: Russell Tempero
>            Assignee: Nandika Jayawardana
>             Fix For: Current (Nightly)
>
>         Attachments: om_element.c.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.