You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org> on 2006/03/10 03:04:39 UTC
[jira] Resolved: (TAPESTRY-131) NullPointerException when
initialising page property
[ http://issues.apache.org/jira/browse/TAPESTRY-131?page=all ]
Jesse Kuhnert resolved TAPESTRY-131:
------------------------------------
Resolution: Won't Fix
Assign To: (was: Tapestry Developer List)
> NullPointerException when initialising page property
> ----------------------------------------------------
>
> Key: TAPESTRY-131
> URL: http://issues.apache.org/jira/browse/TAPESTRY-131
> Project: Tapestry
> Type: Bug
> Components: Framework
> Versions: 3.0
> Environment: Operating System: Other
> Platform: Other
> Reporter: Petter Måhlén
>
> I got a null pointer exception with the following (partial) stack trace:
> org.apache.tapestry.Tapestry.fireObservedChange(Tapestry.java:1373)
> org.apache.tapestry.AbstractComponent.fireObservedChange
> (AbstractComponent.java:345)
> se.elevance.timer.web.EditTaskPage$Enhance_0.setTask
> (EditTaskPage$Enhance_0.java)
> se.elevance.timer.web.EditTaskPage.initialize(EditTaskPage.java:35)
> org.apache.tapestry.AbstractPage.<init>(AbstractPage.java:165)
> org.apache.tapestry.html.BasePage.<init>(BasePage.java:73)
> se.elevance.timer.web.EditTaskPage.<init>(EditTaskPage.java:31)
> se.elevance.timer.web.EditTaskPage$Enhance_0.<init>
> (EditTaskPage$Enhance_0.java)
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> sun.reflect.NativeConstructorAccessorImpl.newInstance
> (NativeConstructorAccessorImpl.java:39)
> It appears that the following line in Tapestry.java is the problem:
> ChangeObserver observer = component.getPage().getChangeObserver();
> Looking a bit into the code, it would seem that component.getPage() returns
> null for a page. I can see two possible ways to solve this:
> 1. modify the AbstractPage() constructor to:
> public AbstractPage()
> {
> setPage(this);
> initialize();
> }
> 2. Modify the fireObservedChange() methods along the following lines:
> public static void fireObservedChange(
> IComponent component,
> String propertyName,
> Object newValue)
> {
> IPage page = component.getPage(); // will be null for a page
> if (component instanceof IPage) { // maybe only overwrite page if it
> is in fact null?
> page = (IPage) component;
> }
> ChangeObserver observer = page.getChangeObserver();
> if (observer == null)
> return;
> ObservedChangeEvent event = new ObservedChangeEvent(component,
> propertyName, newValue);
> observer.observeChange(event);
> }
> I don't know what the side effects would be of either alternative. In my case,
> the page specification contains the following and the line in
> EditTaskPage.initialize() that is the cause for the exception is a call to
> setTask(null) - which I think should be no problem(?).
> <property-specification name="task"
> type="se.elevance.timer.data.Task" persistent="yes" />
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org