Skip to content

Entry.get(field) prints stacktrace even if it is expected the field to be absent.  #32

@oscarryz

Description

@oscarryz

We have an optional boolean field which defaults to false

As expected, the payload doesn't contain the value unless it has been explicitly set.

When the method: entry.getBoolean("my_field") is called, the correct value (false) is returned but the log gets polluted with the stacktrace even when this is totally expected. This creates a lot of noise.

org.json.JSONException: JSONObject["my_field"] not found.
	at org.json.JSONObject.get(JSONObject.java:472)
	at com.contentstack.sdk.Entry.get(Entry.java:302)
	at com.contentstack.sdk.Entry.getBoolean(Entry.java:348)
        ....

And the stack trace is quite large. In our case is 100 lines, and we have 10 records (very small) in 10 different locales, that's 10k lines pure noise added to the log every just by fetching 10 rows of data.

Please remove it, or put it into a logger so we can turn if off.

Reference

https://github.com/contentstack/contentstack-java/blob/master/src/main/java/com/contentstack/sdk/Entry.java#L307

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions