NumberFormatException when using pulldata with geotrace/geoshape
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- java
- Domain
- backend, testing-qa
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.
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:
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms"
xmlns:odk="http://www.opendatakit.org/xforms">
<h:head>
<h:title>properties</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="properties_error" version="20241024131522">
<general_info>
<id />
<cal_polygon />
<property />
</general_info>
<meta>
<instanceID />
</meta>
</data>
</instance>
<instance id="properties" src="jr://file-csv/properties.csv" />
<instance id="ced">
<root>
<item>
<name>52662599</name>
<label>52662599</label>
</item>
<item>
<name>1054542828</name>
<label>1054542828</label>
</item>
</root>
</instance>
<bind nodeset="/data/general_info/id" type="string" required="true()" />
<bind nodeset="/data/general_info/cal_polygon" type="string"
calculate="pulldata('properties', 'polygon', 'id', /data/general_info/id )" />
<bind nodeset="/data/general_info/property" type="geoshape" readonly="true()"
calculate=" /data/general_info/cal_polygon " />
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid" />
</model>
</h:head>
<h:body>
<group ref="/data/general_info">
<label>General Information</label>
<select1 ref="/data/general_info/id">
<label>ID Number</label>
<itemset nodeset="instance('ced')/root/item">
<value ref="name" />
<label ref="label" />
</itemset>
</select1>
<input appearance="hide-input" ref="/data/general_info/property">
<label>Property</label>
</input>
</group>
</h:body>
</h:html>
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.
- Dominant language
- Java
- Stars
- 14
- Forks
- 32
- Avg merge
- 14h 15m
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from getodk/validate
-
Document java version requirement / upgrade gradle / allow modern JDKs / containerise buildPossibly taken @alxndrsn claimed this 18 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Accept bytes from stdin as alternative to reading file from diskPossibly taken @alxndrsn claimed this 18 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
RegistryExceptionHandler uses self-referencing basePackageClasses instead of a controller classOpenbug finsim-registry good-first-issue
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
status:pending type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug level:trivial
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
exoego/keycloak-fuhito#666 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
hammy275/immersive-mc#669 ·