struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34849] - Expression Language Field Validator
Date Thu, 26 May 2005 14:52:09 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34849>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34849





------- Additional Comments From lukasz_public@racon.pl  2005-05-26 16:52 -------
About copying the ArrayUtils and StringUtils - I would prefer to avoid the
implementation freze – I mean if we copy the implementation we would have to
keep it up to date whenever someone changes something in these classes in
commons.lang.

I would prefer conditional inclusion that would not create dependency on lang:

Instead of
            jc.getVars().put("arrayUtils", new ArrayUtils());
we can replace it with the:

        try {
            Class arrayUtilsClass =
Class.forName("org.apache.commons.lang.ArrayUtils");
            jc.getVars().put("arrayUtils", arrayUtilsClass.newInstance());
        } catch (ClassNotFoundException e) {
            log.warn("org.apache.commons.lang.ArrayUtils not found. The
'arrayUtils' object will not be available in ExpressionValidator context.");
        } catch (InstantiationException e) {
            log.warn("org.apache.commons.lang.ArrayUtils not found. The
'arrayUtils' object will not be available in ExpressionValidator context.");
        } catch (IllegalAccessException e) {
            log.warn("org.apache.commons.lang.ArrayUtils not found. The
'arrayUtils' object will not be available in ExpressionValidator context.");
        }

Which means if user includes commons lang the arrayUtils will be available, if
not user will not have this object. The same can be done with the StringUtils,
although we need to copy two methods that are used in the code. It allows us to
avoid lang package but we will need to document it a little better since it will
be confusing for the users. 

Another thing that should be done when we agree that the class discovery is the
correct approach - the object should be created/discovered during the startup,
not upon every call to validate method - the static block (that instantiates the
arrayUtils/stringUtils) and static variable should be the best approach.

Also to avoid collection dependency I would include EnumeratedMap as private
class of ExpressionValidator and IteratorEnumeration as private class in
PageContextImpl.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message