You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/12/19 23:57:16 UTC
svn commit: r1220988 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
Author: veithen
Date: Mon Dec 19 22:57:15 2011
New Revision: 1220988
URL: http://svn.apache.org/viewvc?rev=1220988&view=rev
Log:
The prefix for an OMAttribute should never be null (see also r1220518).
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1220988&r1=1220987&r2=1220988&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java Mon Dec 19 22:57:15 2011
@@ -50,7 +50,18 @@ public class AttrImpl extends NodeImpl i
/** Attribute type */
private String attrType;
- /** Attribute namespace */
+ /**
+ * The namespace of this attribute. Possible values:
+ * <ul>
+ * <li><code>null</code> (if the attribute has no namespace)
+ * <li>any {@link OMNamespace} instance, with the following exceptions:
+ * <ul>
+ * <li>an {@link OMNamespace} instance with a <code>null</code> prefix
+ * <li>an {@link OMNamespace} instance with an empty prefix (because an unprefixed attribute
+ * never has a namespace)
+ * </ul>
+ * </ul>
+ */
private OMNamespaceImpl namespace;
/** Flag to indicate whether this attr is used or not */
@@ -232,14 +243,9 @@ public class AttrImpl extends NodeImpl i
public QName getQName() {
return (namespace == null) ?
new QName(this.attrName) :
- // This next bit is because QName is kind of stupid, and throws an
- // IllegalArgumentException on null prefix instead of treating it exactly
- // as if no prefix had been passed. Grr.
- (namespace.getPrefix() == null ?
- new QName(namespace.getNamespaceURI(), attrName) :
new QName(namespace.getNamespaceURI(),
attrName,
- namespace.getPrefix()));
+ namespace.getPrefix());
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java?rev=1220988&r1=1220987&r2=1220988&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java Mon Dec 19 22:57:15 2011
@@ -38,7 +38,18 @@ public class OMAttributeImpl implements
/** Field type */
private String type;
- /** Field namespace */
+ /**
+ * The namespace of this attribute. Possible values:
+ * <ul>
+ * <li><code>null</code> (if the attribute has no namespace)
+ * <li>any {@link OMNamespace} instance, with the following exceptions:
+ * <ul>
+ * <li>an {@link OMNamespace} instance with a <code>null</code> prefix
+ * <li>an {@link OMNamespace} instance with an empty prefix (because an unprefixed attribute
+ * never has a namespace)
+ * </ul>
+ * </ul>
+ */
private OMNamespace namespace;
private QName qName;
@@ -79,12 +90,7 @@ public class OMAttributeImpl implements
}
if (namespace != null) {
- // Guard against QName implementation sillyness.
- if (namespace.getPrefix() == null) {
- this.qName = new QName(namespace.getNamespaceURI(), localName);
- } else {
- this.qName = new QName(namespace.getNamespaceURI(), localName, namespace.getPrefix());
- }
+ this.qName = new QName(namespace.getNamespaceURI(), localName, namespace.getPrefix());
} else {
this.qName = new QName(localName);
}