Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to serialize empty TabularData #200

Closed
sakno opened this issue Jun 8, 2015 · 2 comments
Closed

Unable to serialize empty TabularData #200

sakno opened this issue Jun 8, 2015 · 2 comments

Comments

@sakno
Copy link

sakno commented Jun 8, 2015

Jolokia can't serialize TabularDataSupport with empty set of rows. In this case value field in the HTTP response contains null value:

{"timestamp":1433455091,"status":200,"request":{"mbean":"helloworld:type=SimpleMBean","attribute":"simpleAttribute","type":"read"},"value":null}

I found the reason. Look at this line of code:
TabularDataExtractor.java L200

When TabularData is empty the loop never iterates and found local variable will set to false. So AttributeFilteredException will cause to unwind call stack and catched in ObjectToJsonConverter.extractObjectWithContext method.

try {
            jsonResult = extractObject(pValue, pExtraArgs, pJsonify);
        } catch (ValueFaultHandler.AttributeFilteredException exp) {
            jsonResult = null;
        } finally {
            clearContext();
        }

Here, jsonResult always set to null if AttributeFilteredException exception occurred.

nevenr added a commit to nevenr/jolokia that referenced this issue Oct 10, 2015
 - empty TabularData -> empty JSON object
@nevenr
Copy link
Contributor

nevenr commented Oct 10, 2015

Hi,

I assumed that empty TabularData should respond to empty JSON object.
Fix is nevenr@73afe34.
This commit will be included in #220.

Regards,
N.

rhuss added a commit that referenced this issue Jan 18, 2016
and added to changes.xml
@rhuss rhuss added this to the 1.3.3 milestone Jan 18, 2016
@rhuss
Copy link
Member

rhuss commented Jan 18, 2016

Fixed in master

@rhuss rhuss closed this as completed Jan 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants