@@ -8141,8 +8141,13 @@ subroutine json_get_integer(json, me, value)
8141
8141
value = me% int_value
8142
8142
else
8143
8143
if (json% strict_type_checking) then
8144
- call json% throw_exception(' Error in json_get_integer:' // &
8145
- ' Unable to resolve value to integer: ' // me% name)
8144
+ if (allocated (me% name)) then
8145
+ call json% throw_exception(' Error in json_get_integer:' // &
8146
+ ' Unable to resolve value to integer: ' // me% name)
8147
+ else
8148
+ call json% throw_exception(' Error in json_get_integer:' // &
8149
+ ' Unable to resolve value to integer' )
8150
+ end if
8146
8151
else
8147
8152
! type conversions
8148
8153
select case (me% var_type)
@@ -8158,13 +8163,24 @@ subroutine json_get_integer(json, me, value)
8158
8163
call string_to_integer(me% str_value,value,status_ok)
8159
8164
if (.not. status_ok) then
8160
8165
value = 0_IK
8161
- call json% throw_exception(' Error in json_get_integer:' // &
8162
- ' Unable to convert string value to integer: me.' // &
8163
- me% name// ' = ' // trim (me% str_value))
8166
+ if (allocated (me% name)) then
8167
+ call json% throw_exception(' Error in json_get_integer:' // &
8168
+ ' Unable to convert string value to integer: ' // &
8169
+ me% name// ' = ' // trim (me% str_value))
8170
+ else
8171
+ call json% throw_exception(' Error in json_get_integer:' // &
8172
+ ' Unable to convert string value to integer: ' // &
8173
+ trim (me% str_value))
8174
+ end if
8164
8175
end if
8165
8176
case default
8166
- call json% throw_exception(' Error in json_get_integer:' // &
8167
- ' Unable to resolve value to integer: ' // me% name)
8177
+ if (allocated (me% name)) then
8178
+ call json% throw_exception(' Error in json_get_integer:' // &
8179
+ ' Unable to resolve value to integer: ' // me% name)
8180
+ else
8181
+ call json% throw_exception(' Error in json_get_integer:' // &
8182
+ ' Unable to resolve value to integer' )
8183
+ end if
8168
8184
end select
8169
8185
end if
8170
8186
end if
@@ -8354,8 +8370,13 @@ subroutine json_get_real(json, me, value)
8354
8370
value = me% dbl_value
8355
8371
else
8356
8372
if (json% strict_type_checking) then
8357
- call json% throw_exception(' Error in json_get_real:' // &
8358
- ' Unable to resolve value to real: ' // me% name)
8373
+ if (allocated (me% name)) then
8374
+ call json% throw_exception(' Error in json_get_real:' // &
8375
+ ' Unable to resolve value to real: ' // me% name)
8376
+ else
8377
+ call json% throw_exception(' Error in json_get_real:' // &
8378
+ ' Unable to resolve value to real' )
8379
+ end if
8359
8380
else
8360
8381
! type conversions
8361
8382
select case (me% var_type)
@@ -8371,9 +8392,15 @@ subroutine json_get_real(json, me, value)
8371
8392
call string_to_real(me% str_value,json% use_quiet_nan,value,status_ok)
8372
8393
if (.not. status_ok) then
8373
8394
value = 0.0_RK
8374
- call json% throw_exception(' Error in json_get_real:' // &
8375
- ' Unable to convert string value to real: me.' // &
8376
- me% name// ' = ' // trim (me% str_value))
8395
+ if (allocated (me% name)) then
8396
+ call json% throw_exception(' Error in json_get_real:' // &
8397
+ ' Unable to convert string value to real: ' // &
8398
+ me% name// ' = ' // trim (me% str_value))
8399
+ else
8400
+ call json% throw_exception(' Error in json_get_real:' // &
8401
+ ' Unable to convert string value to real: ' // &
8402
+ trim (me% str_value))
8403
+ end if
8377
8404
end if
8378
8405
case (json_null)
8379
8406
if (ieee_support_nan(value) .and. json% null_to_real_mode/= 1_IK ) then
@@ -8388,13 +8415,22 @@ subroutine json_get_real(json, me, value)
8388
8415
value = 0.0_RK
8389
8416
end select
8390
8417
else
8391
- call json% throw_exception(' Error in json_get_real:' // &
8392
- ' Cannot convert null to NaN: ' // me% name)
8418
+ if (allocated (me% name)) then
8419
+ call json% throw_exception(' Error in json_get_real:' // &
8420
+ ' Cannot convert null to NaN: ' // me% name)
8421
+ else
8422
+ call json% throw_exception(' Error in json_get_real:' // &
8423
+ ' Cannot convert null to NaN' )
8424
+ end if
8393
8425
end if
8394
8426
case default
8395
-
8396
- call json% throw_exception(' Error in json_get_real:' // &
8397
- ' Unable to resolve value to real: ' // me% name)
8427
+ if (allocated (me% name)) then
8428
+ call json% throw_exception(' Error in json_get_real:' // &
8429
+ ' Unable to resolve value to real: ' // me% name)
8430
+ else
8431
+ call json% throw_exception(' Error in json_get_real:' // &
8432
+ ' Unable to resolve value to real' )
8433
+ end if
8398
8434
end select
8399
8435
end if
8400
8436
end if
@@ -8844,9 +8880,14 @@ subroutine json_get_logical(json, me, value)
8844
8880
value = me% log_value
8845
8881
else
8846
8882
if (json% strict_type_checking) then
8847
- call json% throw_exception(' Error in json_get_logical: ' // &
8848
- ' Unable to resolve value to logical: ' // &
8849
- me% name)
8883
+ if (allocated (me% name)) then
8884
+ call json% throw_exception(' Error in json_get_logical: ' // &
8885
+ ' Unable to resolve value to logical: ' // &
8886
+ me% name)
8887
+ else
8888
+ call json% throw_exception(' Error in json_get_logical: ' // &
8889
+ ' Unable to resolve value to logical' )
8890
+ end if
8850
8891
else
8851
8892
! type conversions
8852
8893
select case (me% var_type)
@@ -8857,9 +8898,14 @@ subroutine json_get_logical(json, me, value)
8857
8898
case (json_string)
8858
8899
value = (me% str_value == true_str)
8859
8900
case default
8860
- call json% throw_exception(' Error in json_get_logical: ' // &
8861
- ' Unable to resolve value to logical: ' // &
8862
- me% name)
8901
+ if (allocated (me% name)) then
8902
+ call json% throw_exception(' Error in json_get_logical: ' // &
8903
+ ' Unable to resolve value to logical: ' // &
8904
+ me% name)
8905
+ else
8906
+ call json% throw_exception(' Error in json_get_logical: ' // &
8907
+ ' Unable to resolve value to logical' )
8908
+ end if
8863
8909
end select
8864
8910
end if
8865
8911
end if
@@ -9046,8 +9092,13 @@ subroutine json_get_string(json, me, value)
9046
9092
else
9047
9093
9048
9094
if (json% strict_type_checking) then
9049
- call json% throw_exception(' Error in json_get_string:' // &
9050
- ' Unable to resolve value to string: ' // me% name)
9095
+ if (allocated (me% name)) then
9096
+ call json% throw_exception(' Error in json_get_string:' // &
9097
+ ' Unable to resolve value to string: ' // me% name)
9098
+ else
9099
+ call json% throw_exception(' Error in json_get_string:' // &
9100
+ ' Unable to resolve value to string' )
9101
+ end if
9051
9102
else
9052
9103
9053
9104
select case (me% var_type)
@@ -9094,11 +9145,14 @@ subroutine json_get_string(json, me, value)
9094
9145
value = null_str
9095
9146
9096
9147
case default
9097
-
9098
- call json% throw_exception(' Error in json_get_string: ' // &
9099
- ' Unable to resolve value to characters: ' // &
9100
- me% name)
9101
-
9148
+ if (allocated (me% name)) then
9149
+ call json% throw_exception(' Error in json_get_string: ' // &
9150
+ ' Unable to resolve value to characters: ' // &
9151
+ me% name)
9152
+ else
9153
+ call json% throw_exception(' Error in json_get_string: ' // &
9154
+ ' Unable to resolve value to characters' )
9155
+ end if
9102
9156
end select
9103
9157
9104
9158
end if
0 commit comments