You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Don Brown (JIRA)" <ji...@apache.org> on 2006/06/14 07:35:16 UTC

[jira] Resolved: (WW-799) OgnlValueStackDataSource Field Name X Description Bug

     [ http://issues.apache.org/struts/browse/WW-799?page=all ]
     
Don Brown resolved WW-799:
--------------------------

    Fix Version:     (was: 2.0.0)
     Resolution: Not A Problem

I don't think this a WebWork/Struts Action 2 bug.  I can't find an OgnlValueStackDataSource class in WW/SAF2 or XWork.  If it is from OGNL itself, please file a ticket in its bug tracker.

> OgnlValueStackDataSource Field Name X Description Bug
> -----------------------------------------------------
>
>          Key: WW-799
>          URL: http://issues.apache.org/struts/browse/WW-799
>      Project: Struts Action 2
>         Type: Bug

>     Versions: WW 2.1.7
>  Environment: WebWork, Spring, Hibernate, SiteMesh, Acegi, Freemarker, Tomcat
>     Reporter: Luis Eduardo Villares Matta

>
> I am filling as a bug because this is really strange. 
> The problem is that OgnlValueStackDataSource prefers description of fields to their names when searching the OGNL Stack. I can see the value of triyng to find using the description IF the search using the name was not succesfull.
> So I would do (sorry but I can not access CVS from work, and I actually dont know how to make diffs (I use subversion)):
> public Object getFieldValue(JRField field) throws JRException {
>         //TODO: move the code to return a OgnlValueStackDataSource to a seperate
>         //      method when and if the JRDataSource interface is updated to support
>         //      this.
>         String expression = field.getName();
>         Object value = valueStack.findValue(expression);
>         if (value == null) {//I don not know if this is correct, the line above may throw an exception if expression is not found
>             expression = field.getDescription();
>             if (expression != null) {
>                 value = valueStack.findValue(expression);
>              }
>         }
>         if (log.isDebugEnabled()) {
>             log.debug("field: " + field.getName() + "/" + value);
>         }
>         if (MakeIterator.isIterable(value)) {
>             //                return new OgnlValueStackDataSource(this.valueStack, field.getName());
>             return new OgnlValueStackDataSource(this.valueStack, expression);
>         } else {
>             return value;
>         }
>     }
> Regards

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira