Json Formatter in 1.1.3 giving Array Out of Bounds exception #476
Copy link
Copy link
Closed
Description
When I run a test with a Before Hook, I am getting an Array out of Bounds exception.
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.get(ArrayList.java:324)
at gherkin.formatter.JSONFormatter.getFeatureElement(JSONFormatter.java:199)
at gherkin.formatter.JSONFormatter.addHook(JSONFormatter.java:156)
at gherkin.formatter.JSONFormatter.before(JSONFormatter.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
The same feature and hook worked with Cucumber JVM 1.1.1 and Cucumber JVM 1.1.2
When I remove the json format from the scenario, the scenario runs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
aslakhellesoy commentedon Mar 11, 2013
I suspect this is a regression introduced by ba049aa. Can you create a test that reproduces this?
joshughes commentedon Mar 11, 2013
I will try to create a test tonight.
I noticed that the commit you mentioned seemed to go into 1.1.2 which I can run without any issue. So I was thinking it was probably one of the commits in 1.1.3 that caused the regression....
#426
SInce this specifically dealt with the json formater I suspect it is the problem. If I do not use the json formater then the tests run fine and the html report looks good.
Thanks
joshughes commentedon Mar 11, 2013
The test has been adjusted to show the issue in this PR
#478
joshughes commentedon Mar 12, 2013
The JSONFormmater has no element to add the Before Hook to... since the senario has not beed added yet.
Moving
format(formatter)Before Move
After Move
in CucumberScenario.java.
This fixes the issue with the JSONFormatter but causes issue in the JUnit Reporter.
So it looks like one of the two will need to be updated to fix the issue.
aslakhellesoy commentedon Mar 16, 2013
This issue seems related to #447
gphilipp commentedon Apr 17, 2013
I think we have the same issue at our place, @aslakhellesoy : does this PR fix the bug ?
MatthiasFraass commentedon Jun 6, 2013
I had to make a SNAPSHOT-build of cucumber-jvm/gherkin in order to fix our builds. But as we're using the Maven-Release-Plugin, which forbids making releases with SNAPSHOT-dependencies, we can't do legal releases anymore.
When will this bugfix go into a release?
aslakhellesoy commentedon Jun 8, 2013
This might be related to cucumber/gherkin#252 as well.
aslakhellesoy commentedon Sep 12, 2013
Isn't this fixed in 1.1.4 and/or 1.1.5-SNAPSHOT?
brasmusson commentedon Sep 12, 2013
Yes, it is fixed in 1.1.4 (which is showed by the merge of #478).
lock commentedon Oct 25, 2018
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.