Details
Description
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;