Closed TheSilentPro closed 3 years ago
Hey TheSilentPro,
this seems to happen since the values in your List are not represented as a Long internally. Since Lists in Java can only store primitives and the Wrappers of primitive types can't be casted to each other this exception is thrown.
We have implemented behavior to handle this in our primitive getters but not yet in Lists. If you have any suggestion on how to improve SimplixStorage in this regard I would be more than happy to implement it.
Maybe some sort of a getList: List
If you feel like it is helpful to chat with us in realtime to get this improved feel free to join our discord: discord.simplixsoft.com.
Regards, Leonhard
Any further questions?
Nope, that would be all, just want to be notified when this is fixed :)
I am sorry for the late response - I am currently in my final exams in school. I still don't exactly understand where this is an issue of SimplixStorage. What exactly do you want to change? The exception you are currently getting is caused by the way the data is read by the background library SimplixStorage is using - It seems to be recognized as an Integer, not as a Long. As stated above we would need to convert every value in the List manually which would require some computation time.
Regards, Leonhard
No problem i am also doing finals soon and i dont actually fully remember what the issue is. I think i was trying to use the longs you get from longList and loop through them but since they are read by integers it looks like its throwing that error.
And wouldn't this be a problem if it is an actual long but it recognizes it as an Integer. Because longs can be higher than integers so wouldn't that be somewhat an issue
Basically i am trying to get a list of longs but it looks like its returning a list of Integers instead. Trying to loop through them causes those errors.
Well it looks like its just of a different data type. getIntergerList should do the job.
Well it looks like its just of a different data type. getIntergerList should do the job.
not all longs can be an interger though? So storing a long that isn't an int when trying to retrieve it will result in an error..
Describe the bug getLongList seems to return an integer list?
List<Long> legacy = userdata.getLongList(profile.getPk() + ".followers");
When trying to loop through it i getException in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
Here is an example of the list: https://paste.md-5.net/mitokajuni.json Yes the list is getting returned as is, not empty.To Reproduce Steps to reproduce the behavior: Create a List using #getLongList()
Loop through it using for (long entry : list), throws this error
Expected behavior it should loop but i think it's casting Integer while creating the loop or something?
Screenshots N/A
Desktop (please complete the following information):
Additional context N/A