Quoting Niclas Hedhman <[email protected]>:

Gang,
I am having a strange NPE. The code is;

Property<Integer> slicesProperty = config.configuration().slices();
            if( slicesProperty == null )
            {
                slices = 10;
            }
            else
            {
                slices = slicesProperty.get();
            }

and I get NPE on slices=slicesProperty.get();

I have -Dqi4j.compacttrace=off

And the NPE stack trace is still as simple as it gets;
Caused by: java.lang.NullPointerException
at org.qi4j.entitystore.file.FileEntityStoreMixin.activate(FileEntityStoreMixin.java:98)
        at org.qi4j.runtime.composite.MixinModel.activate(MixinModel.java:316)
at org.qi4j.runtime.composite.AbstractMixinsModel.activate(AbstractMixinsModel.java:294)
        at org.qi4j.runtime.service.ServiceModel.activate(ServiceModel.java:338)
at org.qi4j.runtime.service.ServiceInstance.activate(ServiceInstance.java:48)


Now, if I singlestep, the get() (goes to EntityPropertyInstance) is
invoked, completed (and returns null) and the debugger comes back to
my "slices=slicesProperty.get()" line, and when stepping again, the
NPE happens.

From the JVM's point of view, I doubt that this can happen. So what is
going on?? Rickard, is there some kind of ASM trick going on to
delegate the assignment elsewhere, or what?

Hmm, shouldn't you be checking

slicesProperty.get() == null

instead?


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to