You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IA5String SIZE(0..10) would check if the length of string is between 0 and 10. IA5String SIZE(10) would check if the length of string is exactly 10. INTEGER(0..10) would check if the value is between 0 and 10. INTEGER(10) would check if the value is exactly 10.
Now, my issue is what would happen if it fails? We will most likely know it as runtime, right? Would it be possible to catch this constraint error as an user of the library? If not, then I really have no idea how one would handle the bounds check errors besides just simply crashing. In any case, it should definitely should be possible to do this, just throw an error in the generated Java code in the decode method, so when the user of the library attempts to decode data that fits the specification but say, a value is higher than N, then it should throw a range error or something.
Hello.
For example:
IA5String SIZE(0..10)
would check if the length of string is between 0 and 10.IA5String SIZE(10)
would check if the length of string is exactly 10.INTEGER(0..10)
would check if the value is between 0 and 10.INTEGER(10)
would check if the value is exactly 10.Now, my issue is what would happen if it fails? We will most likely know it as runtime, right? Would it be possible to catch this constraint error as an user of the library? If not, then I really have no idea how one would handle the bounds check errors besides just simply crashing. In any case, it should definitely should be possible to do this, just throw an error in the generated Java code in the decode method, so when the user of the library attempts to decode data that fits the specification but say, a value is higher than N, then it should throw a range error or something.
Easy-to-digest information about it here: https://stackoverflow.com/a/24238356/15088101
While we are at it, type checking would be pretty cool, too. :)
The text was updated successfully, but these errors were encountered: