Two NPE's fixed

This forum is for general discussions about bugs. Actual bugs should be reported to the bug tracker to allow them to be properly processed and followed up.

Two NPE's fixed

Postby Johann » Sun May 31, 2009 9:19 am

Hi,

today i've encountered two NPE's. The first prevents the PreferencesDialog to open, the other one crashes muc on start (during the splash screen). Both are in the current HEAD, maybe even in the nightly build.

Quick fix:

Code: Select all
Index: source/com/mucommander/ui/dialog/pref/general/ShortcutsTable.java
===================================================================
--- source/com/mucommander/ui/dialog/pref/general/ShortcutsTable.java   (revision 3170)
+++ source/com/mucommander/ui/dialog/pref/general/ShortcutsTable.java   (working copy)
@@ -231,6 +231,10 @@
      // Convert the action-classes to MuAction instances

      List list = Collections.list(actionClasses);

      

+      if (list == null) {

+         return new Object[0][NUM_OF_COLUMNS];

+      }

+

      // Sort actions by their labels

      Collections.sort(list, new Comparator() {

         public int compare(Object o1, Object o2) {

Index: source/com/mucommander/ui/helper/MenuToolkit.java
===================================================================
--- source/com/mucommander/ui/helper/MenuToolkit.java   (revision 3170)
+++ source/com/mucommander/ui/helper/MenuToolkit.java   (working copy)
@@ -133,7 +133,7 @@
     private static JMenuItem addMenuItem(JMenu menu, MuAction action, MnemonicHelper mnemonicHelper, boolean createCheckBoxMenuItem) {
         JMenuItem menuItem = createCheckBoxMenuItem?new JCheckBoxMenuItem(action):new JMenuItem(action);

-        if(mnemonicHelper!=null) {
+        if(mnemonicHelper!=null && action != null) {
             char mnemonic = mnemonicHelper.getMnemonic(action.getLabel());
             if(mnemonic!=0)
                 menuItem.setMnemonic(mnemonic);



Another problem: I cannot login to the trac installation to file the bug. My forum login/password combi is rejected :(

Johann
Johann
 
Posts: 15
Joined: Mon Sep 22, 2008 8:12 am

Re: Two NPE's fixed

Postby Nicolas » Sun May 31, 2009 9:38 am

Hey Johann,

Thanks for the submission! I'll make sure Maxence has a look and integrates it if it's correct.

As for your trac login, the most common issue is that forums logins are case-insensitive while trac loings are case-sensitive. Did you try case-variations on your user name?

Nicolas
User avatar
Nicolas
 
Posts: 831
Joined: Mon Oct 02, 2006 10:36 pm
Location: France

Re: Two NPE's fixed

Postby Johann » Sun May 31, 2009 9:42 am

Nicolas wrote:As for your trac login, the most common issue is that forums logins are case-insensitive while trac loings are case-sensitive. Did you try case-variations on your user name?


Oh hell... Maybe someone should add a big fat warning to the trac login form :)
Johann
 
Posts: 15
Joined: Mon Sep 22, 2008 8:12 am

Re: Two NPE's fixed

Postby Nicolas » Sun May 31, 2009 11:39 am

To be honest, I thought we had :)
Soon as I work out how we it's done, I'll add it.

Nicolas
User avatar
Nicolas
 
Posts: 831
Joined: Mon Oct 02, 2006 10:36 pm
Location: France

Re: Two NPE's fixed

Postby maxence » Sun May 31, 2009 1:04 pm

I have just fixed the login case-sensitiveness issue ( see http://trac-hacks.org/ticket/5285 ), you should now be able to login using the wildest case variations ;)

Thanks a lot for looking into the NPEs and suggesting a fix! Before trying to workaround the exceptions, I'd like to understand what's causing them. It seems that a `null` action instance is passed to MenuToolkit#addMenuItem, which should never happen under normal circumstances. Those issues might have to do with a recent factoring of the action API.

Would you be so kind and file two bugs (one for each NPE) and attach the exception's stack trace as well as your action_keymap.xml file ? That would help a lot.

Thanks!
Maxence
User avatar
maxence
Site Admin
 
Posts: 436
Joined: Wed Aug 21, 2002 8:18 pm

Re: Two NPE's fixed

Postby Johann » Sun May 31, 2009 1:32 pm

maxence wrote:I have just fixed the login case-sensitiveness issue ( see http://trac-hacks.org/ticket/5285 ), you should now be able to login using the wildest case variations ;)

Thanks!

maxence wrote:Before trying to workaround the exceptions, I'd like to understand what's causing them. It seems that a `null` action instance is passed to MenuToolkit#addMenuItem, which should never happen under normal circumstances.


Full ack. I was in a hurry tomorrow, so i just fixed that in the dirty way.

maxence wrote:Would you be so kind and file two bugs (one for each NPE) and attach the exception's stack trace as well as your action_keymap.xml file ? That would help a lot.


Sure.


EDIT:
Strange: atm i cannot reproduce the NPE on startup. My WC and the current nightly works well. Later i will try to track down this issue.
Bug #204: NPE when opening the preferences dialog
Johann
 
Posts: 15
Joined: Mon Sep 22, 2008 8:12 am

Re: Two NPE's fixed

Postby maxence » Sun May 31, 2009 2:53 pm

Thanks for the bug report! I've assigned it to Arik who's been doing a lot of work on the action API and implemented the shortcuts editor.

Johann wrote:Full ack. I was in a hurry tomorrow, so i just fixed that in the dirty way.

Wow, you live in the future!

Cheers,
Maxence
User avatar
maxence
Site Admin
 
Posts: 436
Joined: Wed Aug 21, 2002 8:18 pm

Re: Two NPE's fixed

Postby Johann » Sun May 31, 2009 2:55 pm

maxence wrote:Wow, you live in the future!


Damn. this morning, of course :)
Johann
 
Posts: 15
Joined: Mon Sep 22, 2008 8:12 am


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron