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

Comments

Projects
None yet
3 participants
@sakno

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

Unable to serialize empty TabularData rhuss#200
 - empty TabularData -> empty JSON object
@nevenr

This comment has been minimized.

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

Cleaned up a bit fix for #200
and added to changes.xml

@rhuss rhuss added this to the 1.3.3 milestone Jan 18, 2016

@rhuss

This comment has been minimized.

Owner

rhuss commented Jan 18, 2016

Fixed in master

@rhuss rhuss closed this Jan 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment