[jbosstools-dev] Re: Fwd: [jbosstools-commits] JBoss Tools SVN: r5733 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces.

Maxim Areshkau mareshkau at exadel.com
Wed Jan 16 09:33:51 EST 2008


Max Rydahl Andersen wrote:
> 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
>
>   
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.

> ------- Forwarded message -------
> From: jbosstools-commits at lists.jboss.org
> To: jbosstools-commits at lists.jboss.org
> 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
> jbosstools-commits at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-commits
>
>
>
>   


-- 
Max Areshkau




More information about the jbosstools-dev mailing list