[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 12:22:40 EST 2008


Max Rydahl Andersen wrote:
> ...and we can't verify if an attribute name is incorrect before the put ?
>
> -max
>
>   
Yes, we can. But this already has done in mozilla(moz_extensions.c file 
http://www.koders.com/c/fid74DDEB5DCA77D70A9C73257EBF54EBDD70E67B5F.aspx) 
and if check failed throws exception,
we can move this functionality to our application and check attribute 
name too, before put them into setAttribute method, but problem hasn't 
changed
we just changed *catch and swallowing exception* to* if* block and
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
(NS_ERROR_DOM_INVALID_CHARACTER_ERR=0x80530005) and if it incorrect name 
exception i will ignore it, else I will throw in the first place.
>> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20080116/7cd950f2/attachment.html 


More information about the jbosstools-dev mailing list