Skip to content

NullPointerException in transform after upgrade from 1.0.10 to 1.0.11 #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mmalmeida opened this issue Oct 1, 2012 · 2 comments
Closed

Comments

@mmalmeida
Copy link
Contributor

After upgrading from 1.0.9 to 1.0.14 I started getting a NPE [1] that I pinpointed to the 1.0.10 to 1.0.11 upgrade.

It happens on a scenario such as this (and with a step def public void the_list_below(String moduleName, List questions) )

    Given the list for module XX:
        |question    |
        | Age         |
        | Height    |
    When foo
    Then bar

I'm attaching a test case (https://github.com/mmalmeida/cucumber-playground/tree/master/cucumber-scenarioObjects), showing the issue. What I was able to find so far was:
1 - It happens on the "given"
2 - It only happens the 2nd time that given is called (ie, if you only have one scenario with "Given the list for module something:" nothing will happen. If you have a 2nd scenario with that you'll get a NPE
3 - The issue only occurs when you have a constructor with a String argument in the transform object (ScenarioQuestion in the example provided). If one removes the one string argument constructor the NPE disappears.
4 - the issue only occurs if the @then has List argument.

[1]
java.lang.NullPointerException
at cucumber.runtime.converters.ClassWithStringConstructorConverter.fromString(ClassWithStringConstructorConverter.java:20)
at cucumber.deps.com.thoughtworks.xstream.converters.SingleValueConverterWrapper.fromString(SingleValueConverterWrapper.java:41)
at cucumber.table.TableConverter.toListOfSingleValue(TableConverter.java:109)
at cucumber.table.TableConverter.convert(TableConverter.java:60)
at cucumber.table.DataTable.convert(DataTable.java:70)
at cucumber.runtime.StepDefinitionMatch.tableArgument(StepDefinitionMatch.java:101)
at cucumber.runtime.StepDefinitionMatch.transformedArgs(StepDefinitionMatch.java:81)
at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:38)
at cucumber.runtime.Runtime.runStep(Runtime.java:267)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:36)
at cucumber.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:76)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:65)
at cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:20)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at cucumber.junit.FeatureRunner.run(FeatureRunner.java:72)
at cucumber.junit.Cucumber.runChild(Cucumber.java:76)
at cucumber.junit.Cucumber.runChild(Cucumber.java:36)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at cucumber.junit.Cucumber.run(Cucumber.java:81)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
at ✽.And a page with a list of questions:(features/questions/multipleChoice.feature:41)

@aslakhellesoy
Copy link
Contributor

See answer in #396

@lock
Copy link

lock bot commented 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.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants