Stack Overflow when parsing a scenario with a very long step

Description

A StackOverflowError occurs when the PatternScenarioParser parses a very long step in a scenario. This happened to us when writing a Given step that included a long table parameter.

This seems to be caused by the well-known regex bug in Java (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6337993). The patternToPullOutSteps method specifies a pattern that contains an alternative wrapped in a star, specifically "(.|
s)*".

We were able to use the same strategy as that used to fix JBEHAVE-242.

One note about the included patch: the test we've added to PatternScenarioParserBehaviour, shouldParseStoryWithVeryLongStep, can sometimes pass incorrectly depending on the order in which the tests from that class are run. If shouldParseLongStoryWithKeywordSplitScenarios runs first, our test passes even without the fix applied. We weren't sure what to do about this, but on our machine the tests reliably ran in the order in which they were defined, so we just kept that one higher up in the file. Possibly there are deeper issues to consider here.

--Moss Collum and Jim Olsen

Assignee

Mauro Talevi

Reporter

Moss Collum

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure