<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Max Rydahl Andersen wrote:
<blockquote cite="mid:op.t402a5ygw1tq5a@vista" type="cite">
<pre wrap="">...and we can't verify if an attribute name is incorrect before the put ?
-max
</pre>
</blockquote>
Yes, we can. But this already has done in mozilla(moz_extensions.c file
<a class="moz-txt-link-freetext" href="http://www.koders.com/c/fid74DDEB5DCA77D70A9C73257EBF54EBDD70E67B5F.aspx">http://www.koders.com/c/fid74DDEB5DCA77D70A9C73257EBF54EBDD70E67B5F.aspx</a>)
and if check failed throws exception, <br>
we can move this functionality to our application and check attribute
name too, before put them into setAttribute method, but problem hasn't
changed <br>
we just changed <b>catch and swallowing exception</b> to<big><b> if</b></big>
block and<br>
in case of checking failed programmer can't be notified about it or in
case of failed our checking we can too throw some kind of exception,
but it's already done in setAttribute method. To ensure that
setAttribute throws exactly incorrect name exception I will add check
for error code<br>
(<font size="-1">NS_ERROR_DOM_INVALID_CHARACTER_ERR=0x80530005) <big>and
if it incorrect name exception i will ignore it, else I will throw in
the first place.</big></font>
<blockquote cite="mid:op.t402a5ygw1tq5a@vista" type="cite">
<pre wrap=""></pre>
<blockquote type="cite">
<pre wrap="">Max Rydahl Andersen wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Max Areshkau,
I'm curious why swallowing the exception is the right way to solve JBIDE-1568 - can't we avoid the exception to be thrown in the first place?
/max
</pre>
</blockquote>
<pre wrap="">I was thinking about such possibility and was look throw places where
function ComponentUtil.copyAttributes(node, node) is used. This function
is used to copy
attributes which was specified on source page and we don't needed
specially process them( they haven't effect on look of the componet in
visual editor or for attributes like style which usually should be just
a copy from source to visual page ). XPCOMException in function
setAttribute throws when we trying to specify an incorrect name of
attribute like("<asdsd asd t valu SomeText1"), attribute
with such name haven't sense and we shouldn't be processed in template.
Such name of attribute exists when we remove symbol ">" in element for
example(JBIDE-1568). We can add process of exceptions for each
template(but process of such exception in each template will be just a
swallowing ) so i think it's better to add this functionality in single
place.
</pre>
<blockquote type="cite">
<pre wrap="">------- Forwarded message -------
From: <a class="moz-txt-link-abbreviated" href="mailto:jbosstools-commits@lists.jboss.org">jbosstools-commits@lists.jboss.org</a>
To: <a class="moz-txt-link-abbreviated" href="mailto:jbosstools-commits@lists.jboss.org">jbosstools-commits@lists.jboss.org</a>
Cc:
Subject: [jbosstools-commits] JBoss Tools SVN: r5733 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces.
Date: Wed, 16 Jan 2008 12:34:04 +0100
Author: mareshkau
Date: 2008-01-16 06:34:04 -0500 (Wed, 16 Jan 2008)
New Revision: 5733
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
Log:
code adjusment
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java        2008-01-16 10:36:39 UTC (rev 5732)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java        2008-01-16 11:34:04 UTC (rev 5733)
@@ -24,6 +24,7 @@
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -248,8 +249,13 @@
                NamedNodeMap namedNodeMap = sourceNode.getAttributes();
                for (int i = 0; i < namedNodeMap.getLength(); i++) {
                        Node attribute = namedNodeMap.item(i);
+                        //added by Max Areshkau fix for JBIDE-1568
+                        try {
                        visualElement.setAttribute(attribute.getNodeName(), attribute
                                        .getNodeValue());
+                        } catch(XPCOMException ex) {
+                                //Just ignore this exception
+                        }
                }
        }
_______________________________________________
jbosstools-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:jbosstools-commits@lists.jboss.org">jbosstools-commits@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/jbosstools-commits">https://lists.jboss.org/mailman/listinfo/jbosstools-commits</a>
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Max Areshkau</pre>
</body>
</html>