java.lang.NullPointerException

Jenkins JIRA | Joe Hansche | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    As of Cucumber 2.0.1 (cucumber-core 1.2.0), the JSON output format has changed. It now adds a {{before}} array into the {{Background}} element. That causes GherkinCallback.java to crash because it assumes {{before}} will only exist for a Scenario: {noformat} ERROR: Build step failed with exception java.lang.NullPointerException at org.jenkinsci.plugins.cucumber.jsontestsupport.GherkinCallback.before(GherkinCallback.java:221) at gherkin.JSONParser.before(JSONParser.java:82) at gherkin.JSONParser.parse(JSONParser.java:48) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:77) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:43) at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:159) at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:105) at hudson.FilePath.act(FilePath.java:991) at hudson.FilePath.act(FilePath.java:969) at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl.parse(DefaultTestResultParserImpl.java:99) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:99) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver.perform(CucumberTestResultArchiver.java:112) at hudson.plugins.templateproject.ProxyPublisher.perform(ProxyPublisher.java:71) at hudson.tasks.BuildStepMonitor$2.perform(BuildStepMonitor.java:32) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671) at hudson.model.Run.execute(Run.java:1769) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) {noformat} Example feature: {code} Feature: Background: Given I am in the app Scenario: When I do something Then I should see something {code} Example hooks: {code} Before do |scenario| # Do something. end {code} Produces a JSON output similar to: {code} [{ uri: "features/background_before.feature", line: 1, ... elements: [ {keyword: "Background", ... before: [] steps: [] } ] }] {code} When locking cucumber to version 2.0.0, and all else remaining the same, the old JSON format is produced: {code} [{ uri: "features/background_before.feature, ... elements: [ { keyword: "Background", steps: [] }, { keyword: "Scenario", steps: [] } ] }] {code} Note that it does not even have the {{before}} array at all.

    Jenkins JIRA | 2 years ago | Joe Hansche
    java.lang.NullPointerException
  2. 0

    As of Cucumber 2.0.1 (cucumber-core 1.2.0), the JSON output format has changed. It now adds a {{before}} array into the {{Background}} element. That causes GherkinCallback.java to crash because it assumes {{before}} will only exist for a Scenario: {noformat} ERROR: Build step failed with exception java.lang.NullPointerException at org.jenkinsci.plugins.cucumber.jsontestsupport.GherkinCallback.before(GherkinCallback.java:221) at gherkin.JSONParser.before(JSONParser.java:82) at gherkin.JSONParser.parse(JSONParser.java:48) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:77) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:43) at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:159) at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:105) at hudson.FilePath.act(FilePath.java:991) at hudson.FilePath.act(FilePath.java:969) at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl.parse(DefaultTestResultParserImpl.java:99) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:99) at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver.perform(CucumberTestResultArchiver.java:112) at hudson.plugins.templateproject.ProxyPublisher.perform(ProxyPublisher.java:71) at hudson.tasks.BuildStepMonitor$2.perform(BuildStepMonitor.java:32) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671) at hudson.model.Run.execute(Run.java:1769) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) {noformat} Example feature: {code} Feature: Background: Given I am in the app Scenario: When I do something Then I should see something {code} Example hooks: {code} Before do |scenario| # Do something. end {code} Produces a JSON output similar to: {code} [{ uri: "features/background_before.feature", line: 1, ... elements: [ {keyword: "Background", ... before: [] steps: [] } ] }] {code} When locking cucumber to version 2.0.0, and all else remaining the same, the old JSON format is produced: {code} [{ uri: "features/background_before.feature, ... elements: [ { keyword: "Background", steps: [] }, { keyword: "Scenario", steps: [] } ] }] {code} Note that it does not even have the {{before}} array at all.

    Jenkins JIRA | 2 years ago | Joe Hansche
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.jenkinsci.plugins.cucumber.jsontestsupport.GherkinCallback.before()
    2. org.jenkinsci.plugins
      GherkinCallback.before
      1. org.jenkinsci.plugins.cucumber.jsontestsupport.GherkinCallback.before(GherkinCallback.java:221)
      1 frame
    3. Gherkin
      JSONParser.parse
      1. gherkin.JSONParser.before(JSONParser.java:82)
      2. gherkin.JSONParser.parse(JSONParser.java:48)
      2 frames
    4. org.jenkinsci.plugins
      DefaultTestResultParserImpl$ParseResultCallable.invoke
      1. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:77)
      2. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:43)
      3. org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:159)
      4. org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:105)
      4 frames
    5. Hudson
      FilePath.act
      1. hudson.FilePath.act(FilePath.java:991)
      2. hudson.FilePath.act(FilePath.java:969)
      2 frames
    6. org.jenkinsci.plugins
      CucumberTestResultArchiver.perform
      1. org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl.parse(DefaultTestResultParserImpl.java:99)
      2. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:99)
      3. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver.perform(CucumberTestResultArchiver.java:112)
      3 frames
    7. hudson.plugins.templateproject
      ProxyPublisher.perform
      1. hudson.plugins.templateproject.ProxyPublisher.perform(ProxyPublisher.java:71)
      1 frame
    8. Hudson
      Executor.run
      1. hudson.tasks.BuildStepMonitor$2.perform(BuildStepMonitor.java:32)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      3. hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
      4. hudson.model.Build$BuildExecution.post2(Build.java:185)
      5. hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
      6. hudson.model.Run.execute(Run.java:1769)
      7. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      8. hudson.model.ResourceController.execute(ResourceController.java:98)
      9. hudson.model.Executor.run(Executor.java:374)
      9 frames