I attached a patch for this in this email (for 4.x branch).

On Wed, Jun 11, 2014 at 11:41 AM, Mauro Talevi <mauro.tal...@aquilonia.org>
wrote:

> Lazy init may still have some teething issues.  Please provide a patch.
>
>
> > On 11 Jun 2014, at 10:46, Hans Schwäbli <bugs.need.love....@gmail.com>
> wrote:
> >
> > Hello Mauro,
> >
> > today I had a NullPointerException at
> org.jbehave.core.configuration.Configuration.doDryRun(Boolean) with JBehave
> beta-6.
> >
> > It was because this.storyControls was null.
> >
> > Why don't you use storyControls().doDryRun(dryRun) instead of
> this.storyControls.doDryRun(dryRun)?
> >
> > Because the instance variable storyControls is lazy initialized in
> storyControls() method, so a NPE never could occur.
> >
> > My workaround now is first to call storyControls() method and after that
> doDryRun(...)
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
diff --git 
a/jbehave-core/src/main/java/org/jbehave/core/configuration/Configuration.java 
b/jbehave-core/src/main/java/org/jbehave/core/configuration/Configuration.java
old mode 100755
new mode 100644
index 323d16f..12019fe
--- 
a/jbehave-core/src/main/java/org/jbehave/core/configuration/Configuration.java
+++ 
b/jbehave-core/src/main/java/org/jbehave/core/configuration/Configuration.java
@@ -175,7 +175,7 @@
        }
 
     public boolean dryRun() {
-        return storyControls.dryRun();
+        return storyControls().dryRun();
     }
     
     public StoryControls storyControls() {
@@ -317,7 +317,7 @@
     }
 
     public Configuration doDryRun(Boolean dryRun) {
-        this.storyControls.doDryRun(dryRun);
+        storyControls().doDryRun(dryRun);
         return this;
     }
     
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to