[ 
http://issues.apache.org/jira/browse/AXIS2C-238?page=comments#action_12437777 ] 
            
Malinda Kaushalye Kapuruge commented on AXIS2C-238:
---------------------------------------------------

This is the code. I fixed this by assigning a default value for the attribute. 
See the "bug fixed" comment. 

////////////////////////////////////////////BEGIN/////////////////////////////////////////////////////////////
AXIS2_EXTERN axiom_node_t* AXIS2_CALL
oxs_token_build_encryption_method_element(const axis2_env_t *env,
        axiom_node_t *parent,
        axis2_char_t* algorithm
                                         )
{
    axiom_node_t *encryption_method_node = NULL;
    axiom_element_t *encryption_method_ele = NULL;
    axiom_attribute_t *algo_attr = NULL;
    int ret;
    axiom_namespace_t *ns_obj = NULL;

    ns_obj = axiom_namespace_create(env, OXS_EncNs,
            OXS_xenc);

    encryption_method_ele = axiom_element_create(env, parent, 
OXS_NodeEncryptionMethod, ns_obj, &encryption_method_node);
    if (!encryption_method_ele)
    {
        oxs_error(ERROR_LOCATION,
                OXS_ERROR_ELEMENT_FAILED, "Error creating encryption method 
element");
        return NULL;
    }
    /*Fixed bug. If kt algorithm is NULL then use the default*/
    if (!algorithm)
    {
        algorithm = (axis2_char_t*)OXS_DEFAULT_KT_ALGO_HREF;
    }

    algo_attr =  axiom_attribute_create(env, OXS_AttrAlgorithm, algorithm, 
NULL);

    ret = AXIOM_ELEMENT_ADD_ATTRIBUTE(encryption_method_ele, env, algo_attr, 
encryption_method_node);

    return encryption_method_node;

}
////////////////////////////////////////////END/////////////////////////////////////////////////////////////

> Unexpected behavior when the value of an axiom_attribute is NULL
> ----------------------------------------------------------------
>
>                 Key: AXIS2C-238
>                 URL: http://issues.apache.org/jira/browse/AXIS2C-238
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: xml/om
>    Affects Versions: Current (Nightly)
>         Environment: Linux, 
>            Reporter: Malinda Kaushalye Kapuruge
>
> While trying to create a new attribute node by calling 
> axiom_attribute_create(), if the attribute value is NULL. Then the parent 
> element of the attribute node is showing unexpected results. 
> The expected behavior should be to insert an empty string for the attribute 
> value.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to