You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Alexander Veit (JIRA)" <ji...@apache.org> on 2006/12/10 23:02:21 UTC

[jira] Created: (WSCOMMONS-139) OMNamespace accepts any namespace URI and prefix; it's not compatible with QName

OMNamespace accepts any namespace URI and prefix; it's not compatible with QName
--------------------------------------------------------------------------------

                 Key: WSCOMMONS-139
                 URL: http://issues.apache.org/jira/browse/WSCOMMONS-139
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
            Reporter: Alexander Veit


OMNamepace does not define a contract on namespace URIs and prefixes. So OMNamespace implementations accept null URIs and prefixes and return these values in the getNamespaceURI() and getPrefix() methods.

This leads to errors as in org.apache.axiom.om.impl.dom.AttrImpl#getQName().

To be compatible with javax.xml.namespace.QName I would suggest to

- throw an IllegalArgumentException if a null namespace URI is given in an OMNamespace constructor,
- throw an IllegalArgumentException if a null namespace prefix is given in an OMNamespace constructor and
- to assign a constant empty String if an empty namespace prefix is given in an OMNamespace constructor or if a constructor without a namespace prefix parameter is called.

Additionally, a hasPrefix() method could help avoiding programming errors.

-- 
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: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-139) OMNamespace accepts any namespace URI and prefix; it's not compatible with QName

Posted by "Alexander Veit (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12485013 ] 

Alexander Veit commented on WSCOMMONS-139:
------------------------------------------

OK, from this point of view it makes sense to allow null namespace prefixes by contract.

However some code needs to be revisited since it is not always clear under which circumstances getPrefix() will or won't return null. E.g. 

 - org.apache.axiom.om.impl.dom.AttrImpl#getQName(),
 - org.apache.axiom.om.impl.llom.OMAttributeImpl#getQName(), or
 - org.apache.axiom.om.util.ElementHelper#resolveQName(String, boolean)

may throw an IllegalArgumentException if OMNamespace has a null prefix (see WSCOMMONS-140).


> OMNamespace accepts any namespace URI and prefix; it's not compatible with QName
> --------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-139
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-139
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Alexander Veit
>         Assigned To: Glen Daniels
>
> OMNamepace does not define a contract on namespace URIs and prefixes. So OMNamespace implementations accept null URIs and prefixes and return these values in the getNamespaceURI() and getPrefix() methods.
> This leads to errors as in org.apache.axiom.om.impl.dom.AttrImpl#getQName().
> To be compatible with javax.xml.namespace.QName I would suggest to
> - throw an IllegalArgumentException if a null namespace URI is given in an OMNamespace constructor,
> - throw an IllegalArgumentException if a null namespace prefix is given in an OMNamespace constructor and
> - to assign a constant empty String if an empty namespace prefix is given in an OMNamespace constructor or if a constructor without a namespace prefix parameter is called.
> Additionally, a hasPrefix() method could help avoiding programming errors.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Resolved: (WSCOMMONS-139) OMNamespace accepts any namespace URI and prefix; it's not compatible with QName

Posted by "Glen Daniels (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Glen Daniels resolved WSCOMMONS-139.
------------------------------------

    Resolution: Fixed

I fixed the namespace URI part of this, because it really makes no sense to have a null URI.

The null prefix actually has meaning in the current OM design (not that you'd know it from the JavaDoc.... :) ).  When an OMNamespace is declared somewhere with a null prefix that tells the serializer to auto-generate a prefix like "axis2-ns1".  You might question whether this is the right way to deal with this, but it is consistent and what's there now, so I didn't change it.

I don't think "hasPrefix" is necessary since it's easy enough to just getPrefix() and decide how to behave based on that.

Marking this fixed for now, please comment if this doesn't meet your needs.


> OMNamespace accepts any namespace URI and prefix; it's not compatible with QName
> --------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-139
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-139
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Alexander Veit
>         Assigned To: Glen Daniels
>
> OMNamepace does not define a contract on namespace URIs and prefixes. So OMNamespace implementations accept null URIs and prefixes and return these values in the getNamespaceURI() and getPrefix() methods.
> This leads to errors as in org.apache.axiom.om.impl.dom.AttrImpl#getQName().
> To be compatible with javax.xml.namespace.QName I would suggest to
> - throw an IllegalArgumentException if a null namespace URI is given in an OMNamespace constructor,
> - throw an IllegalArgumentException if a null namespace prefix is given in an OMNamespace constructor and
> - to assign a constant empty String if an empty namespace prefix is given in an OMNamespace constructor or if a constructor without a namespace prefix parameter is called.
> Additionally, a hasPrefix() method could help avoiding programming errors.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Updated: (WSCOMMONS-139) OMNamespace accepts any namespace URI and prefix; it's not compatible with QName

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davanum Srinivas updated WSCOMMONS-139:
---------------------------------------

    Assignee: Glen Daniels

> OMNamespace accepts any namespace URI and prefix; it's not compatible with QName
> --------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-139
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-139
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Alexander Veit
>         Assigned To: Glen Daniels
>
> OMNamepace does not define a contract on namespace URIs and prefixes. So OMNamespace implementations accept null URIs and prefixes and return these values in the getNamespaceURI() and getPrefix() methods.
> This leads to errors as in org.apache.axiom.om.impl.dom.AttrImpl#getQName().
> To be compatible with javax.xml.namespace.QName I would suggest to
> - throw an IllegalArgumentException if a null namespace URI is given in an OMNamespace constructor,
> - throw an IllegalArgumentException if a null namespace prefix is given in an OMNamespace constructor and
> - to assign a constant empty String if an empty namespace prefix is given in an OMNamespace constructor or if a constructor without a namespace prefix parameter is called.
> Additionally, a hasPrefix() method could help avoiding programming errors.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org