Details
Description
I created an event by giving values to OutcomeTax, ActionTax attributes. OutcomeTax is set to IN_PROGRESS and ActionTax is set to NO_DEFINED. (As it is the only allowed value). Then i assigned some conventional values to other attributes. The resulting JSON string is as follows,
{"Version": "http://www.opengroup.com/xdas/2008" ,"Action": {"Name": "listUsers" ,"Message": "view users with filter - *" ,"Id": "QUERY_DATA_ITEM_CONTENTS" ,"Time": "Tue Jun 08 09:37:02 MVT 2010" ,"OutcomeTax":
{null} ,"ActionTax": {null},"Count": "1"} ,"Initiators": [{"Host": {"Name": "testhost" ,"Addresses": [
{"Ipv4": "127.0.1.1"}]} ,"Services": [{"Name": "UI" ,"Component": "servlet/jsp" ,"ServiceTax": {null}}] ,"Account":
{"Name": "admin" ,"Id": "admin" ,"Domain": "xxxx"},"Account": {"Name": "admin" ,"Id": "admin" ,"Domain": "xxxx"}}] ,"Observer": {"Services": [{"Name": "org.wso2.carbon.core.audit.component.xdas4j.XDAS4JLoggerTest" ,"Component": "org.wso2.carbon.core.audit.component.xdas4j.XDAS4JLoggerTest" ,"ServiceTax": {null}}]} ,"Targets": [{"DataObject": {"Id": "users"}}]}
As you can see almost all enumeration values are serialized as "null". (Including ActionTax, ServiceTax etc ...). After bit of debugging i realized that recursive function org.codehaus.xdas4j.logger.XDASJSONLayout is ignoring processing whenever the object type is an enumeration. This is mainly due to the condition "if(m.getName().startsWith("get") && ! m.getName().contains("Instance") && ! m.getName().contains("Class"))". I believe this is the cause. Appreciate if you all can fix this issue.
Thank you.
The attached diff contains a fix for this issue.
The diff is created from trunk.