Author: ajith
Date: Sun Apr 30 23:43:15 2006
New Revision: 398537
URL: http://svn.apache.org/viewcvs?rev=398537&view=rev
Log:
1. Findnamespace implementation throws a NPE if there are no declared
namespaces in the current elements. Fixed this by skipping the search in the
current element if the namespaces map is null.
2. The setParent(null) caused the element to be completely built. The intention
of the user when calling setparent with null is to remove the parent. Hence
specialcased the setParent implementation for null.
Modified:
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java
Modified:
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=398537&r1=398536&r2=398537&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
Sun Apr 30 23:43:15 2006
@@ -782,7 +782,10 @@
}
public OMNamespace findNamespaceURI(String prefix) {
- OMNamespace ns = (OMNamespace) this.namespaces.get(prefix);
+ OMNamespace ns = this.namespaces==null?
+ null:
+ (OMNamespace)this.namespaces.get(prefix);
+
if (ns == null && this.parentNode instanceof OMElement) {
// try with the parent
ns = ((OMElement) this.parentNode).findNamespaceURI(prefix);
Modified:
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=398537&r1=398536&r2=398537&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
Sun Apr 30 23:43:15 2006
@@ -244,7 +244,7 @@
child.previousSibling = null;
} else {
child.previousSibling = (OMNodeImpl) lastChild;
- ((OMNodeImpl) lastChild).nextSibling = child;
+ ((OMNodeImpl) lastChild).nextSibling = child;
}
child.nextSibling = null;
@@ -369,7 +369,10 @@
}
public OMNamespace findNamespaceURI(String prefix) {
- OMNamespace ns = (OMNamespace) this.namespaces.get(prefix);
+ OMNamespace ns = this.namespaces==null?
+ null:
+ (OMNamespace)this.namespaces.get(prefix);
+
if (ns == null && this.parent instanceof OMElement) {
// try with the parent
ns = ((OMElement) this.parent).findNamespaceURI(prefix);
Modified:
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java?rev=398537&r1=398536&r2=398537&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java
(original)
+++
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java
Sun Apr 30 23:43:15 2006
@@ -64,7 +64,7 @@
* Field nodeType
*/
protected int nodeType;
-
+
protected OMFactory factory;
/**
@@ -112,11 +112,15 @@
//If we are asked to assign a new parent in place
//of an existing one. We should detach this node
- //from the aegis of previous parent.
- if (this.parent != null) {
- this.detach();
+ //from the previous parent.
+ if (element!=null){
+ if (this.parent != null) {
+ this.detach();
+ }
+ this.parent = (OMContainerEx) element;
+ }else{
+ this.parent = null;
}
- this.parent = (OMContainerEx) element;
}
/**