Hello all,
I’m completely stuck with an issue.
There is now some days that I'm struggling about that issue :-(
I need really your help :-)
Same code, 2 different behaviors.
I am using json-simple
I have tested several approaches without success.
I know that JSON is returning a Long object.
But, even with that, why in "Approach 1" the code is working, and not in "Approach 2" ?
With the following code
I get:
APPROACH 1
---> Construct JSON data
{"enthalpyBkgdImg":{"refCurveH1x":140,"enthalpyImageFile":"R22_A4.png"},"nameRefrigerant":"R22","xHmin":140.0}
---> Set the Class Instance with JSON data
{"enthalpyBkgdImg":{"refCurveH1x":140,"enthalpyImageFile":"R22_A4.png"},"nameRefrigerant":"R22","xHmin":140.0}
APPROACH 2
---> Construct JSON data
{"enthalpyBkgdImg":{"refCurveH1x":140,"enthalpyImageFile":"R22_A4.png"},"nameRefrigerant":"R22","xHmin":140.0}
---> Set the Class Instance with JSON data
{"enthalpyBkgdImg":{"refCurveH1x":140,"enthalpyImageFile":"R22_A4.png"},"nameRefrigerant":"R22","xHmin":140.0}
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at pacp.test.HelpJSON$EnthalpyBkgdImg.setJsonObject(HelpJSON.java:93)
at pacp.test.HelpJSON$Enthalpy.setJsonObject(HelpJSON.java:144)
at pacp.test.HelpJSON.main(HelpJSON.java:47)
ISSUE is located on
When I replace that code with
Vice versa "APPROACH 2" is working and not "APPROACH 1"
I become crazy...
How to fix that ?
Many thanks in advance
Regards
Christian