[ 
https://issues.apache.org/jira/browse/AXIOM-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13611732#comment-13611732
 ] 

Andreas Veithen commented on AXIOM-374:
---------------------------------------

The fix for the existing methods is actually trivial (replacing 
qname.getPrefix() != null by qname.getPrefix().length() != 0). The primary 
reason why this has not been implemented yet is that since it changes the 
behavior of DOOM, it may have unexpected side effects on Apache Rampart. Before 
doing this change, it is therefore necessary to check (at least) that there are 
no test failures in Rampart and even better (since the code coverage of the 
Rampart test suite is not very high), review the Rampart code to determine how 
it uses the problematic methods and to check that changing the behavior will 
not break anything.

Please also note that changes submitted to Axiom are expected to have test 
coverage. For the issue described here, unit tests actually already exist, but 
they are excluded for DOOM. They can be enabled by removing the corresponding 
exclusion from org.apache.axiom.om.impl.dom.OMImplementationTest.
                
> Behavior of OMFactory#createOMElement(QName [, OMContainer]) is inconsistent 
> between LLOM and DOOM
> --------------------------------------------------------------------------------------------------
>
>                 Key: AXIOM-374
>                 URL: https://issues.apache.org/jira/browse/AXIOM-374
>             Project: Axiom
>          Issue Type: Bug
>          Components: DOOM
>    Affects Versions: 1.2.12
>            Reporter: Andreas Veithen
>            Assignee: Andreas Veithen
>             Fix For: 1.2.15
>
>         Attachments: prefix.patch
>
>
> The createOMElement(String, OMNamespace), createOMElement(String, 
> OMNamespace, OMContainer) and createOMElement(String, String, String) methods 
> support auto-generating a namespace prefix (by passing a null prefix) and 
> creating an element in the default namespace (by passing an empty string as 
> prefix). This choice doesn't exist for the createOMElement(QName) and 
> createOMElement(QName, OMContainer) methods because the prefix in a QName 
> object can never be null. There is an inconsistency in the behavior of LLOM 
> and DOOM when an empty prefix is passed in the QName object. LLOM will 
> auto-generate a prefix, while DOOM will create an element in the default 
> namespace.
> In the case of DOOM, this appears to be a bug because the corresponding 
> createOMElement method contains the following condition:
> qname.getPrefix() != null
> However, the return value of QName#getPrefix() is never null, and the code 
> that would auto-generate a prefix is unreachable.
> On the other hand, the desired behavior depends on the use case, and there 
> are situations where one would like to create an element in the default 
> namespace if the prefix in the QName is an empty string.
> Proposed solution:
> 1. Make sure that DOOM has the same behavior as LLOM, i.e. auto-generate a 
> prefix if QName#getPrefix() returns an empty string.
> 2. Add additional methods to OMFactory that create an element from a QName, 
> but that allow to specify the intended behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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