You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Oscar Bou (JIRA)" <ji...@apache.org> on 2016/05/14 08:38:13 UTC

[jira] [Updated] (ISIS-1401) NPE when wrapping call to FixtureScripts#runFixtureScript for a newly instantiated FixtureScript

     [ https://issues.apache.org/jira/browse/ISIS-1401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oscar Bou updated ISIS-1401:
----------------------------
    Description: 
The 

When executing something like:
this.wrap(this.fixtureScripts).runFixtureScript(
		    new MyFixtureScript(), null);

A NullPointerException is thrown, as for the execution on DomainObjectInvokationHandler#handleActionMethod requires to create an adapter for the contributee (line 590):
[java]
contributeeAdapter = adapterFor(contributed);
[/java]

As the MyFixtureScript is a ViewModel, this will be delegated to FixtureScript#viewModelMemento() which in fact will contain:

[java]
    @Programmatic
    @Override
    public String viewModelMemento() {
        return fixtureScripts.mementoFor(this);
    }
[/java]

Being "fixtureScripts" null.

Not sure how to solve this, as basically the FixtureScript requires to be injected before executing it.
As perhaps this will be the only method that can potentially been invoked before the FixtureScript being wrapped on the "FixtureScripts" service, an easy solution would be to check if the "fixtureScript" variable is null and, in that case, inject its own instance on this same method.


  was:
When executing something like:
this.wrap(this.fixtureScripts).runFixtureScript(
		    new MyFixtureScript(), null);

A NullPointerException is thrown, as for the execution on DomainObjectInvokationHandler#handleActionMethod requires to create an adapter for the contributee (line 590):
[java]
contributeeAdapter = adapterFor(contributed);
[/java]

As the MyFixtureScript is a ViewModel, this will be delegated to FixtureScript#viewModelMemento() which in fact will contain:

[java]
    @Programmatic
    @Override
    public String viewModelMemento() {
        return fixtureScripts.mementoFor(this);
    }
[/java]

Being "fixtureScripts" null.

Not sure how to solve this, as basically the FixtureScript requires to be injected before executing it.
As perhaps this will be the only method that can potentially been invoked before the FixtureScript being wrapped on the "FixtureScripts" service, an easy solution would be to check if the "fixtureScript" variable is null and, in that case, inject its own instance on this same method.



> NPE when wrapping call to FixtureScripts#runFixtureScript for a newly instantiated FixtureScript 
> -------------------------------------------------------------------------------------------------
>
>                 Key: ISIS-1401
>                 URL: https://issues.apache.org/jira/browse/ISIS-1401
>             Project: Isis
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.12.1
>            Reporter: Oscar Bou
>            Assignee: Dan Haywood
>             Fix For: 1.13.0
>
>
> The 
> When executing something like:
> this.wrap(this.fixtureScripts).runFixtureScript(
> 		    new MyFixtureScript(), null);
> A NullPointerException is thrown, as for the execution on DomainObjectInvokationHandler#handleActionMethod requires to create an adapter for the contributee (line 590):
> [java]
> contributeeAdapter = adapterFor(contributed);
> [/java]
> As the MyFixtureScript is a ViewModel, this will be delegated to FixtureScript#viewModelMemento() which in fact will contain:
> [java]
>     @Programmatic
>     @Override
>     public String viewModelMemento() {
>         return fixtureScripts.mementoFor(this);
>     }
> [/java]
> Being "fixtureScripts" null.
> Not sure how to solve this, as basically the FixtureScript requires to be injected before executing it.
> As perhaps this will be the only method that can potentially been invoked before the FixtureScript being wrapped on the "FixtureScripts" service, an easy solution would be to check if the "fixtureScript" variable is null and, in that case, inject its own instance on this same method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)