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 ru...@apache.org on 2006/10/05 20:32:46 UTC
svn commit: r453309 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/
axiom-tests/src/test/java/org/apache/axiom/om/
Author: ruchithf
Date: Thu Oct 5 11:32:46 2006
New Revision: 453309
URL: http://svn.apache.org/viewvc?view=rev&rev=453309
Log:
Make sure a created DocumentFragment is "done"
Prevent NPE in child node by checking for a null parent before checking its completness
Fix for WSCOMMONS-105 - Thanks C Corvin
Serialize a soap 12 fault with normally with serilization logic inherited from ElementImpl - possible fix for WSCOMMONS-106
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-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.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?view=diff&rev=453309&r1=453308&r2=453309
==============================================================================
--- 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 Thu Oct 5 11:32:46 2006
@@ -149,7 +149,7 @@
// /
public String getName() {
return (this.namespace == null) ? this.attrName
- : OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName;
+ : (OMConstants.XMLNS_NS_PREFIX.equals(this.attrName) ? this.attrName : OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName);
}
/**
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java?view=diff&rev=453309&r1=453308&r2=453309
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java Thu Oct 5 11:32:46 2006
@@ -42,7 +42,7 @@
}
public OMNode getNextOMSibling() throws OMException {
- while ((nextSibling == null) && !this.parentNode.done) {
+ while (nextSibling == null && this.parentNode != null && !this.parentNode.done) {
this.parentNode.buildNext();
}
return nextSibling;
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java?view=diff&rev=453309&r1=453308&r2=453309
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java Thu Oct 5 11:32:46 2006
@@ -31,6 +31,7 @@
*/
public DocumentFragmentimpl(DocumentImpl ownerDocument, OMFactory factory) {
super(ownerDocument, factory);
+ this.done = true;
}
/*
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?view=diff&rev=453309&r1=453308&r2=453309
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java Thu Oct 5 11:32:46 2006
@@ -296,6 +296,10 @@
ChildNode newDomChild = (ChildNode) newChild;
ChildNode oldDomChild = (ChildNode) oldChild;
+ if(newChild == null) {
+ return this.removeChild(oldChild);
+ }
+
if (this == newChild || !isAncestor(newChild)) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
DOMMessageFormatter.formatMessage(
@@ -303,7 +307,7 @@
"HIERARCHY_REQUEST_ERR", null));
}
- if (!this.ownerNode.equals(newDomChild.ownerNode)) {
+ if (newDomChild != null && !this.ownerNode.equals(newDomChild.ownerNode)) {
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
@@ -326,13 +330,13 @@
DocumentFragmentimpl docFrag =
(DocumentFragmentimpl) newDomChild;
ChildNode child = (ChildNode) docFrag.getFirstChild();
- child.parentNode = this;
this.replaceChild(child, oldChild);
+ if(child != null) {
+ child.parentNode = this;
+ }
} else {
if (this.firstChild == oldDomChild) {
- newDomChild.parentNode = this;
-
if(this.firstChild.nextSibling != null) {
this.firstChild.nextSibling.previousSibling = newDomChild;
newDomChild.nextSibling = this.firstChild.nextSibling;
@@ -358,10 +362,9 @@
this.lastChild = newDomChild;
}
- if (newDomChild.parentNode == null) {
- newDomChild.parentNode = this;
- }
}
+
+ newDomChild.parentNode = this;
}
found = true;
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java?view=diff&rev=453309&r1=453308&r2=453309
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java Thu Oct 5 11:32:46 2006
@@ -76,46 +76,4 @@
SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
}
- protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
- // select the builder
- short builderType = PULL_TYPE_BUILDER; // default is pull type
- if (builder != null) {
- builderType = this.builder.getBuilderType();
- }
- if ((builderType == PUSH_TYPE_BUILDER)
- && (builder.getRegisteredContentHandler() == null)) {
- builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
- }
-
- if (!cache) {
- //No caching
- if (this.firstChild != null) {
- OMSerializerUtil.serializeStartpart(this, writer);
- firstChild.internalSerializeAndConsume(writer);
- OMSerializerUtil.serializeEndpart(writer);
- } else if (!this.done) {
- if (builderType == PULL_TYPE_BUILDER) {
- OMSerializerUtil.serializeByPullStream(this, writer);
- } else {
- OMSerializerUtil.serializeStartpart(this, writer);
- builder.setCache(cache);
- builder.next();
- OMSerializerUtil.serializeEndpart(writer);
- }
- } else {
- OMSerializerUtil.serializeNormal(this, writer, cache);
- }
- // do not serialise the siblings
-
-
- } else {
- //Cached
- OMSerializerUtil.serializeNormal(this, writer, cache);
-
- // do not serialise the siblings
- }
-
-
- }
-
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java?view=diff&rev=453309&r1=453308&r2=453309
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java Thu Oct 5 11:32:46 2006
@@ -40,6 +40,7 @@
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i].isFile() && files[i].getName().endsWith(".xml") && !files[i].getName().startsWith("wrong")) {
+ System.out.println(files[i].getAbsolutePath());
SOAPEnvelope soapEnvelope = (SOAPEnvelope) OMTestUtils.getOMBuilder(
files[i])
.getDocumentElement();
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org