PDA

View Full Version : NPE when calling show() on Window



walkerr
9 Jul 2008, 5:12 AM
Not sure if this is something peculiar to our usage - but moving from beta5 to latest 1.0 , we're now getting an NPE when we try and show our window:


[ERROR] Uncaught exception escaped
java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.widget.WindowManager$1.compare(WindowManager.java:51)
at com.extjs.gxt.ui.client.widget.WindowManager$1.compare(WindowManager.java:1)
at com.extjs.gxt.ui.client.widget.WindowManager.orderWindows(WindowManager.java:161)
at com.extjs.gxt.ui.client.widget.WindowManager.bringToFront(WindowManager.java:70)
at com.extjs.gxt.ui.client.widget.Window.toFront(Window.java:642)
at com.extjs.gxt.ui.client.widget.Window.afterShow(Window.java:687)
at com.extjs.gxt.ui.client.widget.Window.show(Window.java:627)
at com.ascert.webui.vt.client.LogDetailDialog.setViewActive(LogDetailDialog.java:215)
at com.ascert.webui.vt.client.model.ViewManagerImpl.selectView(ViewManagerImpl.java:145)
at com.ascert.webui.vt.client.model.ViewSelectAction.execute(ViewSelectAction.java:82)

walkerr
9 Jul 2008, 5:41 AM
I'm wondering if this line could be the problem:

Line 160 in WindowManager:


if (accessList.size() > 0) {
Collections.sort(accessList, comparator);


Strikes me this should be a >1 test?

darrellmeyer
9 Jul 2008, 6:18 AM
Please post some test code in this format (http://extjs.com/forum/showthread.php?t=40289).

walkerr
9 Jul 2008, 6:32 AM
Apologies Darrell - our management have said we can't spend time splitting out test code (which is a pretty hefty task).

As it is I've been struggling to justify to them keeping GXT in our technology stack and getting them to approve commercial license purchase.

We've spent a huge amount of time working around odd behaviour in GXT already - plus we started on mygwt, then beta3 thru beta5 - and in every case we've had API breakages which have forced quite a lot of rework.

The full 1.0 didn't break any APIs, but all our uses of Window now break with this NPE - as a result we've been told to fall back to beta5. Not sure if we'll get approval to go any further given the history, or will be asked to back out our GXT usage.

darrellmeyer
9 Jul 2008, 7:24 AM
I looked at the WindowManger code and there is one potential problem. Calling the register method will result in the null pointer. The register method is called automatically when a window is rendered and should not be public. The unregister method should be public.

Are you calling register directly? If yes, can you try without the call.

walkerr
10 Jul 2008, 1:49 AM
We weren't calling register directly - in fact we weren't even aware of WindowManager until it started throwing the NPEs

I tried adding a manual register() into our view manager of anything that was a subclass of Window - but didn't make any difference.

darrellmeyer
10 Jul 2008, 7:54 PM
It is very difficult trying to debug without seeing how you are using Window. You do not have to split out all of your application code. In many cases, you can simply create some test code from scratch. Since you are the only one reporting this issue, it is important to see what you are doing as I am not able to reproduce the exception.

That being said, here is a "hack" that may allow you to get by this issue. Try this line of code immediately after creating your window:


window.setData("date", System.currentTimeMillis());

Let me know if this works for you.