Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 22421 invoked from network); 21 Jun 2006 09:02:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jun 2006 09:02:03 -0000 Received: (qmail 2692 invoked by uid 500); 21 Jun 2006 09:01:59 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 2235 invoked by uid 500); 21 Jun 2006 09:01:56 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 2222 invoked by uid 99); 21 Jun 2006 09:01:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jun 2006 02:01:56 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jun 2006 02:01:55 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 509F27141F1 for ; Wed, 21 Jun 2006 09:00:31 +0000 (GMT) Message-ID: <9661226.1150880431326.JavaMail.jira@brutus> Date: Wed, 21 Jun 2006 09:00:31 +0000 (GMT+00:00) From: =?utf-8?Q?Ulrich_K=C3=BCster_=28JIRA=29?= To: axis-dev@ws.apache.org Subject: [jira] Created: (AXIS-2507) org.apache.axis.message.Text needs cloneNode-implementation OR org.apache.axis.message.MessageElement.getElementsNS needs to be fixed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N org.apache.axis.message.Text needs cloneNode-implementation OR org.apache.a= xis.message.MessageElement.getElementsNS needs to be fixed ---------------------------------------------------------------------------= ---------------------------------------------------------- Key: AXIS-2507 URL: http://issues.apache.org/jira/browse/AXIS-2507 Project: Apache Axis Type: Bug Components: Basic Architecture =20 Versions: 1.4 =20 Reporter: Ulrich K=C3=BCster When you clone a Node using cloneNode(true) and later invoke getElementsByT= agNameNS a class cast exception is thrown in getElementNS. The reason for this is that getElementNS casts to Element if the object und= er inspection is not an instance of Text. However, org.apache.axis.message.= Text does not override NodeImpl.cloneNode(boolean deep). Thus, when I clone= d my Node all Text nodes got replaced by NodeImpl nodes as the NodeImpl.clo= neNode method was called (and this method returns instances of type NodeImp= l). Thus my clone contained nodes which were neither of type Element nore of ty= pe Text but of type NodeImpl. Thus the class cast exception in getElementNS= (which assumes a node is of type Element if it's not of type Text). I suggest so resolve this issue by implementing cloneNode in Text in a simi= lar fashion it is implemented in NodeImpl: /** * Returns a duplicate of this node, i.e., serves as a generic copy * constructor for nodes. The duplicate node has no parent; ( * parentNode is null.). *
Cloning an Element copies all attributes and their * values, including those generated by the XML processor to represent * defaulted attributes, but this method does not copy any text it * contains unless it is a deep clone, since the text is contained in a * child Text node. Cloning an Attribute * directly, as opposed to be cloned as part of an Element * cloning operation, returns a specified attribute ( * specified is true). Cloning any other type * of node simply returns a copy of this node. *
Note that cloning an immutable subtree results in a mutable copy= , * but the children of an EntityReference clone are readon= ly * . In addition, clones of unspecified Attr nodes are * specified. And, cloning Document, * DocumentType, Entity, and * Notation nodes is implementation dependent. *=20 * @param deep If true, recursively clone the subtree unde= r * the specified node; if false, clone only th= e node * itself (and its attributes, if it is an Element). * @return The duplicate node. */ public Node cloneNode(boolean deep) { return new Text(textRep); } --=20 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: axis-dev-unsubscribe@ws.apache.org For additional commands, e-mail: axis-dev-help@ws.apache.org