Skip to content

Tripple JsonException while serializing data with JsonStream #125

Closed
@TnTGamesTV

Description

@TnTGamesTV

Hey guys,
I got some exceptions while serializing my instance with JsonStream. I'm not sure what this exception is about because it is too generous. First of all here is the stack trace:

com.jsoniter.spi.JsonException: com.jsoniter.spi.JsonException: com.jsoniter.spi.JsonException: java.lang.reflect.InvocationTargetException
at com.jsoniter.output.ReflectionObjectEncoder.encode(ReflectionObjectEncoder.java:33)
at com.jsoniter.output.JsonStream.writeVal(JsonStream.java:328)
at com.jsoniter.output.JsonStream.serialize(JsonStream.java:351)
at com.jsoniter.output.JsonStream.serialize(JsonStream.java:370)
at com.github.tntgamestv.corganizer.timetable.TimetableProvider.saveTimetable(TimetableProvider.java:88)
at com.github.tntgamestv.corganizer.activities.timetable.edit.TimetableEditActivity$1$1.onClick(TimetableEditActivity.java:233)
[...]

Here is the source code for TimetableProvider#saveTimetable (where the exception is thrown):

String resultA = JsonStream.serialize(timetableWeekA);
String resultB = JsonStream.serialize(timetableWeekB);

//Set data locally
StaticSettingsManager.setTimetableA(resultA);
StaticSettingsManager.setTimetableB(resultB);

//Set data in backend
CloudManager.pushTimetableData(timetableWeekA, timetableWeekB);

'timetableWeekA' and 'timetableWeekB' are both instances of the class 'TimetableBlueprint'. The blueprint is edited and should be saved as a string (aka being serialized).

Here are the three classes that need to be serialized (which will make sense after you read the source code):

TimetableBlueprint: https://pastebin.com/unCiDJrY
Day: https://pastebin.com/wgfKdQVt
Subject: https://pastebin.com/UX3QzLyb

The only thing I know about JsonException is that it has a problem with parsing the instance (e.g. expects String and finds Integer but I'm not sure where in my classes this can happen).

I hope someone will find an error so this great library can parse my classes.

~TnTGamesTV

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