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 2008/04/19 15:59:06 UTC

[jira] Resolved: (WW-2457) Action boolean properties values are not available to XSLTResult.

     [ https://issues.apache.org/struts/browse/WW-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-2457.
---------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.2
         Assignee: Don Brown

Fixed, thanks for the patch!

> Action boolean properties values are not available to XSLTResult.
> -----------------------------------------------------------------
>
>                 Key: WW-2457
>                 URL: https://issues.apache.org/struts/browse/WW-2457
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.0.10, 2.0.11, 2.1.0
>         Environment: Windows XP, JDK 1.5
>            Reporter: Steve Wolke
>            Assignee: Don Brown
>             Fix For: 2.1.2
>
>
> For instance the action BooleanAction.java:
> ------------------------------------------------------------------
> import com.opensymphony.xwork2.Action;
> public class BooleanAction implements Action{
>     
>     private boolean testFalse = false;
>     
>     public String execute() throws Exception { return this.SUCCESS;}
>     public boolean isTestFalse() { return testFalse; }
>     public void setTestFalse(boolean testFalse) { this.testFalse = testFalse;}
> }
> ------------------------------------------------------------------
> will produce the result:
> <result>
>   <testFalse/>
> </result>
>  but should produce :
> <result>
>   <testFalse>false</testFalse> 
> </result>
> The diff below fixes the problem with org.apache.struts2.views.xslt.AdapterFactory  creating a BeanAdapter for a java.lang.Boolean value:
> Index: AdapterFactory.java
> ===================================================================
> --- AdapterFactory.java (revision 615211)
> +++ AdapterFactory.java (working copy)
> @@ -146,7 +146,7 @@
>          if (valueType.isArray())
>              adapterClass = ArrayAdapter.class;
> -        else if (value instanceof String || value instanceof Number || valueType.isPrimitive())
> +        else if (value instanceof String || value instanceof Number || value instanceof Boolean || valueType.isPrimitive())
>              adapterClass = StringAdapter.class;
>          else if (value instanceof Collection)
>              adapterClass = CollectionAdapter.class;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.