You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Chris Dolan (Created) (JIRA)" <ji...@apache.org> on 2011/10/04 20:17:34 UTC

[jira] [Created] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Omitted @Command on Gogo plugin is hard to debug because of NPE
---------------------------------------------------------------

                 Key: KARAF-913
                 URL: https://issues.apache.org/jira/browse/KARAF-913
             Project: Karaf
          Issue Type: Bug
          Components: karaf-shell
    Affects Versions: 2.2.2
            Reporter: Chris Dolan
            Priority: Minor


If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:

    Error executing command: java.lang.NullPointerException

The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:

                    Command command = action.getClass().getAnnotation(Command.class);

is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
 1) add null checks
 2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jean-Baptiste Onofré (Resolved JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré resolved KARAF-913.
----------------------------------------

    Resolution: Fixed
    
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.6, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Closed] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jamie goodyear (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jamie goodyear closed KARAF-913.
--------------------------------

    
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.6, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Assigned] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jean-Baptiste Onofré (Assigned JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré reassigned KARAF-913:
------------------------------------------

    Assignee: Jean-Baptiste Onofré
    
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.5, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jean-Baptiste Onofré (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13121963#comment-13121963 ] 

Jean-Baptiste Onofré commented on KARAF-913:
--------------------------------------------

This part is not related to Karaf, it's in Felix Gogo. Anyway, I'm going to submit a patch to Gogo.
                
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.5, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Andreas Pieber (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13160747#comment-13160747 ] 

Andreas Pieber commented on KARAF-913:
--------------------------------------

is there a link to the gogo issue?
                
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.5, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jean-Baptiste Onofré (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré updated KARAF-913:
---------------------------------------

    Fix Version/s: 3.0.0
                   2.2.5
    
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.5, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Work started] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jean-Baptiste Onofré (Work started JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on KARAF-913 started by Jean-Baptiste Onofré.

> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.6, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jean-Baptiste Onofré (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13227539#comment-13227539 ] 

Jean-Baptiste Onofré commented on KARAF-913:
--------------------------------------------

In fact, a simple workaround could be done in the DefaultActionPreparator in Karaf (not related to Gogo). 

I do it.
                
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.6, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (KARAF-913) Omitted @Command on Gogo plugin is hard to debug because of NPE

Posted by "Jean-Baptiste Onofré (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré updated KARAF-913:
---------------------------------------

    Fix Version/s:     (was: 2.2.5)
                   2.2.6
    
> Omitted @Command on Gogo plugin is hard to debug because of NPE
> ---------------------------------------------------------------
>
>                 Key: KARAF-913
>                 URL: https://issues.apache.org/jira/browse/KARAF-913
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.2
>            Reporter: Chris Dolan
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 2.2.6, 3.0.0
>
>
> If you forget to put a @Command annotation on your OsgiCommandSupport subclass, and you try to execute that command with a syntax error (perhaps you forget an argument) then you'll get the following under-informative error in the shell:
>     Error executing command: java.lang.NullPointerException
> The root cause (discovered by stepping in the debugger) is in DefaultActionPreparer.prepare() line 291 where this line of code:
>                     Command command = action.getClass().getAnnotation(Command.class);
> is not followed by a null check. In fact, there are several places in that method where the result of getAnnotation() is not checked. I propose one of the following two solutions:
>  1) add null checks
>  2) throw an informative exception in CommandProcessorImpl.addCommand() if the @Command is missing

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira