[ODK Community] Error in regex evaluator

That's new. Please open an issue:
http://code.google.com/p/opendatakit/issues/list

We will probably 'fix' this by updating documentation.

Android has a fairly small execution stack. It appears the length
restriction is implemented within the regex as a recursive call, causing
the stack to overflow its limit.

You can instead write the constraint as:

constraint="regex(.,'^[\w\W]*$') and string-length(.) < 256"

This will enforce that all the characters are whitespace or word
characters, and that the overall length is less that 256.
string-length() does not consume the stack like regex() does, which is why
this will work.

Mitch

ยทยทยท On Thu, Nov 8, 2012 at 6:56 AM, wrote:

Hello,

I am doing a form which has a text input that must be smaller than 255
chars.
The problem is that the next constraint throws StackOverflow =>
jr:constraint="regex(.,'^[\w\W]{0,255}$')".
The problems happens when you put in the field a lot of chars.

11-08 12:55:06.514: E/AndroidRuntime(24168): FATAL EXCEPTION: main
11-08 12:55:06.514: E/AndroidRuntime(24168): java.lang.StackOverflowError
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchNodes(RE.java:752)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.matchAt(RE.java:1253)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.match(RE.java:1329)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.match(RE.java:1272)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
me.regexp.RE.match(RE.java:1367)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.javarosa.xpath.expr.XPathFuncExpr.regex(XPathFuncExpr.java:879)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.javarosa.xpath.expr.XPathFuncExpr.eval(XPathFuncExpr.java:250)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.javarosa.xpath.XPathConditional.evalRaw(XPathConditional.java:68)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.javarosa.xpath.XPathConditional.eval(XPathConditional.java:72)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.javarosa.core.model.FormDef.evaluateConstraint(FormDef.java:725)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.javarosa.form.api.FormEntryController.answerQuestion(FormEntryController.java:89)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.odk.collect.android.logic.FormController.answerQuestion(FormController.java:403)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.odk.collect.android.logic.FormController.saveAllScreenAnswers(FormController.java:674)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.odk.collect.android.activities.FormEntryActivity.saveAnswersForCurrentScreen(FormEntryActivity.java:666)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.odk.collect.android.activities.FormEntryActivity.showNextView(FormEntryActivity.java:909)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.odk.collect.android.activities.FormEntryActivity.onFling(FormEntryActivity.java:1977)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
android.view.GestureDetector.onTouchEvent(GestureDetector.java:568)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
org.odk.collect.android.activities.FormEntryActivity.dispatchTouchEvent(FormEntryActivity.java:892)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1727)
11-08 12:55:06.514: E/AndroidRuntime(24168): at
android.view.ViewRoot.deliverPointerEvent(ViewRoot.jav

Are you noticed of this issue?

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com