You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/01/17 16:49:10 UTC
(axis-axis2-c-core) 02/02: Remove prefix from QName serialization for correct hash lookups (AXIS2C-787)
This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git
commit 565c89e4e89a726b56258c8fd260b2e2a89e0d4d
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Sat Jan 17 06:48:17 2026 -1000
Remove prefix from QName serialization for correct hash lookups (AXIS2C-787)
QName equality is defined by {namespace_uri}localpart only - prefixes
are just namespace aliases. Including prefix in axutil_qname_to_string()
caused hash lookups to fail when the same QName used different prefixes.
Before: "localpart|namespace_uri|prefix"
After: "localpart|namespace_uri"
This fixes axiom_element_get_attribute() failing for attributes with
different prefixes but the same namespace URI.
Co-Authored-By: Claude Opus 4.5 <no...@anthropic.com>
---
util/src/qname.c | 30 +++++-------------------------
1 file changed, 5 insertions(+), 25 deletions(-)
diff --git a/util/src/qname.c b/util/src/qname.c
index 49b2069cd..b817ab306 100644
--- a/util/src/qname.c
+++ b/util/src/qname.c
@@ -244,43 +244,23 @@ axutil_qname_to_string(
return qname->qname_string;
}
+ /* AXIS2C-787: Do not include prefix in serialized string.
+ * QName equality is defined by {namespace_uri}localpart only.
+ * Prefixes are just aliases and should not affect equality or hash lookups.
+ * Format: "localpart" or "localpart|namespace_uri" */
if(!(qname->namespace_uri) || axutil_strcmp(qname->namespace_uri, "") == 0)
{
qname->qname_string = axutil_strdup(env, qname->localpart);
}
- else if(!(qname->prefix) || axutil_strcmp(qname->prefix, "") == 0)
- {
- axis2_char_t *temp_string1 = NULL;
- temp_string1 = axutil_stracat(env, qname->localpart, "|");
- qname->qname_string = axutil_stracat(env, temp_string1, qname->namespace_uri);
- if(temp_string1)
- {
- AXIS2_FREE(env->allocator, temp_string1);
- }
- }
else
{
axis2_char_t *temp_string1 = NULL;
- axis2_char_t *temp_string2 = NULL;
- axis2_char_t *temp_string3 = NULL;
-
temp_string1 = axutil_stracat(env, qname->localpart, "|");
- temp_string2 = axutil_stracat(env, temp_string1, qname->namespace_uri);
- temp_string3 = axutil_stracat(env, temp_string2, "|");
- qname->qname_string = axutil_stracat(env, temp_string3, qname->prefix);
-
+ qname->qname_string = axutil_stracat(env, temp_string1, qname->namespace_uri);
if(temp_string1)
{
AXIS2_FREE(env->allocator, temp_string1);
}
- if(temp_string2)
- {
- AXIS2_FREE(env->allocator, temp_string2);
- }
- if(temp_string3)
- {
- AXIS2_FREE(env->allocator, temp_string3);
- }
}
return qname->qname_string;
}