You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josh Canfield <jo...@gmail.com> on 2010/07/14 02:24:00 UTC

T5.2.0: Unit test using PageTester gets null pointer exception using Flash persistence.

I'm writing a unit test for a patch and I'm getting a
NullPointerException in an interesting place.

I have a property defined like this:

    @Property
    @Persist(org.apache.tapestry5.PersistenceConstants.FLASH)
    private static Map<Integer, TestObject> selected;

and in method

public boolean isObjectSelected() {
        final TestObject obj = getLoopObject();
// This line causes a nullpointerexception
        final boolean notNull = selected != null;

        return notNull && selected.containsKey(obj.getId());
    }

If I use the default Session persistence then I don't get the null
pointer exception. I'm not having any trouble narrowing it down.

Here's the interesting part of the exception:

Caused by: java.lang.NullPointerException
	at org.apache.tapestry5.integration.app2.pages.TestPageForCheckbox.isObjectSelected(TestPageForCheckbox.java:82)
	at $PropertyConduit_129ce4d1f5a.get($PropertyConduit_129ce4d1f5a.java)
	at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:59)

Thoughts?

Josh

-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org