Line #601 in Page.java is the only place where versionManager gets set
back to null from what I can tell..
// If we went all the way back to the
original page
if (page != null &&
page.getCurrentVersionNumber() == 0)
{
// remove version info
page.versionManager = null;
}
I am using bookmarkable pages, without an immediate redirect to a Page
instance, do bookmarkable pages stay on version 0 when invoking an ajax
component?
Or should this be set to a new instance of VersionManager instead of null?
Aaron
Johan Compagner wrote:
> this is very strange because as far as i know that flag is only set
> inside that if:
>
> if (!getFlag(FLAG_NEW_VERSION)) <-- this may return false?
> {
> // if we have no version manager
> if (versionManager == null)
> {
> // then install a new version manager
> versionManager = newVersionManager();
> }
>
> // start a new version
>
> versionManager.beginVersion(getRequest().mergeVersion());
> setFlag(FLAG_NEW_VERSION, true);
> }
>
> But i guess versionManager is in some places set to null gain.. Is
> then that flag not reset?
>
> johan
>
>
> On 3/5/07, *Aaron Hiniker * <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> I ran this through my debugger, and my assumptions where correct.
> The FLAG_NEW_VERSION flag is set while versionManager is null.
> I'm, looking around and can't figure out the exact conditions that
> would cause this.
>
> Any thoughts?
>
> Aaron
>
> Aaron Hiniker wrote:
>> Yeah, I know. But I'm not messing with any versioning settings
>> (this is just out-of-the-box ajax components and the like), so
>> really there shouldn't be any of these issues, correct? Here's
>> mayTrackChangesFor() method, I've added a comment regarding my
>> thoughts as to what is causing this:
>>
>> private final boolean mayTrackChangesFor(final Component
>> component, MarkupContainer parent)
>> {
>> // Auto components do not participate in versioning since
>> they are
>> // added during the rendering phase (which is normally
>> illegal).
>> if (component.isAuto() || (parent == null &&
>> !component.isVersioned())
>> || (parent != null && !parent.isVersioned()))
>> {
>> return false;
>> }
>> else
>> {
>> // the component is versioned... are we tracking
>> changes at all?
>> if (getFlag(FLAG_TRACK_CHANGES)) <-- this returns true
>> {
>> // we are tracking changes... do we need to start
>> new version?
>> if (!getFlag(FLAG_NEW_VERSION)) <-- this may
>> return false?
>> {
>> // if we have no version manager
>> if (versionManager == null)
>> {
>> // then install a new version manager
>> versionManager = newVersionManager();
>> }
>>
>> // start a new version
>>
>> versionManager.beginVersion(getRequest().mergeVersion());
>> setFlag(FLAG_NEW_VERSION, true);
>> }
>>
>> // this returns true, even though versionManager
>> is not set because of false check above
>> // return true as we are ready for versioning
>> return true;
>> }
>>
>> // we are not tracking changes or the component not
>> versioned
>> return false;
>> }
>> }
>>
>> Should I specifically be setting versioning/non-versioning for
>> components to avoid this error?
>>
>> Aaron
>>
>> Johan Compagner wrote:
>>> But if it is null then you could have a problem that things
>>> should be versioned but arent..
>>>
>>> So adding null checks is not the fix.
>>>
>>> johan
>>>
>>>
>>> On 3/2/07, * Aaron HIniker* <[EMAIL PROTECTED]
>>> <mailto:[EMAIL PROTECTED]>> wrote:
>>>
>>> That's why I was pointing at mayTrackChangesFor().. I
>>> looked at the method and I can't see a loophole, but there
>>> must be one to generate an NPE, correct?
>>>
>>> When I implemented the not-null check, I noticed exceptions
>>> still being thrown from 2 other methods (if you search
>>> Page.java for versionManager, you can see where there is the
>>> assumption that mayTrackChangesFor() is checked for 'true',
>>> yet versionManager is never initialized in other methods as
>>> well. So after adding the null check to each of these
>>> methods, the application is working fine. Thing is, I've
>>> only seen this exception when dealing with ajax (default not
>>> versioned, right?).
>>>
>>> I will try and run a debugger through mayTrackChangesFor()
>>> with my current app, and see the logic flow and why
>>> versionManager is ending up null.
>>>
>>> Aaron
>>>
>>> Johan Compagner wrote:
>>>> That is because the mayTrackChangesFor() method should only
>>>> return true
>>>> when it makes a version manager. Why is that not the case?
>>>> If that method returns true the version manager can't be
>>>> null because the version info must be tracked.
>>>>
>>>> johan
>>>>
>>>>
>>>> On 3/1/07, *Aaron Hiniker* <[EMAIL PROTECTED]
>>>> <mailto:[EMAIL PROTECTED]>> wrote:
>>>>
>>>> I pulled the latest from trunk. And I am getting this NPE:
>>>>
>>>> 16:30:14,543 ERROR [STDERR] java.lang.NullPointerException
>>>> 16:30:14,544 ERROR [STDERR] at
>>>> wicket.Page.componentStateChanging(Page.java:327)
>>>> 16:30:14,545 ERROR [STDERR] at
>>>> wicket.Component.addStateChange(Component.java:2553)
>>>> 16:30:14,545 ERROR [STDERR] at
>>>> wicket.Component.setModel(Component.java:2191)
>>>> 16:30:14,545 ERROR [STDERR] at
>>>> wicket.MarkupContainer.setModel(MarkupContainer.java :596)
>>>> 16:30:14,546 ERROR [STDERR] at
>>>>
>>>> com.edicorp.erp.web.components.search.ProductSearchPanel.query(ProductSearchPanel.java:144)
>>>> 16:30:14,546 ERROR [STDERR] at
>>>>
>>>> com.edicorp.erp.web.components.search.ProductSearchPanel.onUpdate
>>>> (ProductSearchPanel.java:109)
>>>> 16:30:14,546 ERROR [STDERR] at
>>>>
>>>> com.edicorp.erp.web.components.search.FilterPanel.fireOnChange(FilterPanel.java:74)
>>>> 16:30:14,547 ERROR [STDERR] at
>>>>
>>>> com.edicorp.erp.web.components.search.query.QueryPanel$QueryForm.onSubmit
>>>> (QueryPanel.java:197)
>>>> 16:30:14,547 ERROR [STDERR] at
>>>> wicket.markup.html.form.Form.delegateSubmit(Form.java:680)
>>>> 16:30:14,547 ERROR [STDERR] at
>>>> wicket.markup.html.form.Form.onFormSubmitted(Form.java:396)
>>>>
>>>> 16:30:14,547 ERROR [STDERR] at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>>
>>>> I remember I was getting this NPE before, and I patched
>>>> the source to
>>>> include this null check in Page.java :
>>>>
>>>> final void componentStateChanging(final
>>>> Component component,
>>>> Change change)
>>>> {
>>>> checkHierarchyChange(component);
>>>>
>>>> dirty();
>>>> if (mayTrackChangesFor(component, null))
>>>> {
>>>> if ( versionManager != null )
>>>>
>>>> versionManager.componentStateChanging(change);
>>>> }
>>>> }
>>>>
>>>> It seems that everywhere else in Page.java there is a
>>>> null check for
>>>> versionManager, except in this method. Not sure, but
>>>> perhaps the
>>>> problem lies in the #mayTrackChangesFor() method, but
>>>> in any case if I
>>>> add this null check my code runs fine.
>>>>
>>>> Aaron
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------------
>>>>
>>>> Take Surveys. Earn Cash. Influence the Future of IT
>>>> Join SourceForge.net's Techsay panel and you'll get the
>>>> chance to share your
>>>> opinions on IT & business topics through brief
>>>> surveys-and earn cash
>>>>
>>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>>
>>>> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>>>> _______________________________________________
>>>> Wicket-user mailing list
>>>> Wicket-user@lists.sourceforge.net
>>>> <mailto:Wicket-user@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>> <https://lists.sourceforge.net/lists/listinfo/wicket-user>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> -------------------------------------------------------------------------
>>>> Take Surveys. Earn Cash. Influence the Future of IT
>>>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>>> share your
>>>>
>>>>
>>>> opinions on IT & business topics through brief surveys-and earn
>>>> cash
>>>>
>>>>
>>>>
>>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> Wicket-user mailing list
>>>>
>>>> Wicket-user@lists.sourceforge.net
>>>> <mailto:Wicket-user@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>> <https://lists.sourceforge.net/lists/listinfo/wicket-user>
>>>>
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the
>>> chance to share your
>>> opinions on IT & business topics through brief surveys-and
>>> earn cash
>>>
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>
>>> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>>> _______________________________________________
>>> Wicket-user mailing list
>>> Wicket-user@lists.sourceforge.net
>>> <mailto:Wicket-user@lists.sourceforge.net>
>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>> <https://lists.sourceforge.net/lists/listinfo/wicket-user>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>>> your
>>>
>>> opinions on IT & business topics through brief surveys-and earn cash
>>>
>>>
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Wicket-user mailing list
>>>
>>> Wicket-user@lists.sourceforge.net
>>> <mailto:Wicket-user@lists.sourceforge.net>
>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>> <https://lists.sourceforge.net/lists/listinfo/wicket-user>
>>>
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>>
>> opinions on IT & business topics through brief surveys-and earn cash
>>
>>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Wicket-user mailing list
>>
>> Wicket-user@lists.sourceforge.net
>> <mailto:Wicket-user@lists.sourceforge.net>
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> <https://lists.sourceforge.net/lists/listinfo/wicket-user>
>>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> <mailto:Wicket-user@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> <https://lists.sourceforge.net/lists/listinfo/wicket-user>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user