DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17728>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17728

EvalHelper should not throw NullAttributeException, it's too slow

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |



------- Additional Comments From [EMAIL PROTECTED]  2003-03-06 15:37 -------
You're wrong,

Look at the code, I even ran it through a profiler and this identifies the 
bottleneck.

public final class EvalHelper
{
    private EvalHelper() {}

    public static Object eval(String      tagName,
                              String      attrName,
                              String      attrValue,
                              Class       attrType,
                              Tag         tagObject,
                              PageContext pageContext)
        throws JspException, NullAttributeException
    {
        Object result   =
            ExpressionUtil.evalNotNull(tagName, attrName, attrValue,
                                       attrType, tagObject, pageContext);
        if (result == null)
            throw new NullAttributeException(attrName, tagName);
        return (result);
    }
}


When ExpressionUtil returns null, a NullAttributeException is thrown.  The EL 
Tags call this for every attribute, catch the NullAttributeException and enter 
a default.  For example, here is a snippet from the ELSizeTag.java

        try {
            setName((String) evalAttr("name", getName(), String.class));
        } catch (NullAttributeException ex) {
            setName(null);
        }


Name is an optional attribute since you can specify collection.  If you use the 
collection object on this tag it will always throw at least 2 
NullAttributeException  exceptions since name and property aren't filled in.  
The overhead of the exception in both creating an I18N string and and also 
additional garbage collection is uneeded.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to