NumberFormatException when using pulldata with geotrace/geoshape
- Dominant language
- Java
- Stars
- 13
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
#### Software versions
ODK-Validate-v1.19.2
openjdk 22.0.2 2024-07-16
#### Problem description
ODK Validation fails with the following error when bind type is geotrace or geotrace and its `calculate` attribute directly or indirectly calls `pulldata()`:
Error
```
Validating: /Users/sadiq/Downloads/properties_error.xml
>> Something broke the parser.
java.lang.RuntimeException: Error evaluating field 'property' (/data/general_info[1]/property[1]): For input string: "properties"
at org.javarosa.core.model.TriggerableDag.evaluateTriggerable(TriggerableDag.java:568)
at org.javarosa.core.model.TriggerableDag.doEvaluateTriggerables(TriggerableDag.java:542)
at org.javarosa.core.model.TriggerableDag.initializeTriggerables(TriggerableDag.java:465)
at org.javarosa.core.model.TriggerableDag.initializeTriggerables(TriggerableDag.java:448)
at org.javarosa.core.model.FormDef.initializeTriggerables(FormDef.java:709)
at org.javarosa.core.model.FormDef.initialize(FormDef.java:1111)
at org.opendatakit.validate.FormValidator.validate(FormValidator.java:497)
at org.opendatakit.validate.FormValidator.validate(FormValidator.java:420)
at org.opendatakit.validate.FormValidator.validate(FormValidator.java:392)
at org.opendatakit.validate.FormValidator.validateAndExitWithErrorCode(FormValidator.java:349)
at org.opendatakit.validate.FormValidator.main(FormValidator.java:141)
Caused by: java.lang.NumberFormatException: For input string: "properties"
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.base/java.lang.Double.parseDouble(Double.java:938)
at org.javarosa.core.model.data.GeoPointData.cast(GeoPointData.java:164)
at org.javarosa.core.model.data.GeoShapeData.cast(GeoShapeData.java:172)
at org.javarosa.core.model.data.IAnswerData.wrapData(IAnswerData.java:103)
at org.javarosa.core.model.condition.Recalculate.apply(Recalculate.java:60)
at org.javarosa.core.model.condition.Triggerable.apply(Triggerable.java:127)
at org.javarosa.core.model.QuickTriggerable.apply(QuickTriggerable.java:41)
at org.javarosa.core.model.TriggerableDag.evaluateTriggerable(TriggerableDag.java:566)
... 10 more
The following files failed validation:
/Users/sadiq/Downloads/properties_error.xml
Result: Invalid
```
#### Steps to reproduce the problem
Example Form:
```
properties
52662599
52662599
1054542828
1054542828
General Information
ID Number
Property
```
#### Expected behavior
It should return "Xform is valid!"
#### Other information
Originally posted in the ODK Forum https://forum.getodk.org/t/preload-multiple-polygons-and-display-them-in-the-odk-collection-application/50310/1
This issue is impacting ODK Central and pyxform, however we have a workaround to avoid `pulldata` and use xpath expression for list lookup.
Contributor guide
Research direction
Start by reproducing the failure with the XML form in the issue and the ODK Validate version described. Read GeoPointData.cast, GeoShapeData.cast, IAnswerData.wrapData, and Recalculate.apply from the stack trace. Done means the form validates successfully when a geoshape or geotrace calculation directly or indirectly uses pulldata().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100