Bug 717392 - NPE in code completion
Summary: NPE in code completion
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 3.0.1
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
: ---
Assignee: Lukas Krejci
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 743379 786976
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-28 18:09 UTC by Ondřej Žižka
Modified: 2012-02-07 19:17 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-07 19:17:09 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 743379 0 high CLOSED CLI fails on running *.js files with error 2021-02-22 00:41:40 UTC

Internal Links: 743379

Description Ondřej Žižka 2011-06-28 18:09:00 UTC
STR:

1) Install CLI
2) Run bin/rhq-client.sh
3) Type rhq.<Tab>

NPE will occur:

RHQ - RHQ Enterprise Remote CLI 3.0.1.GA
unconnected$ rhq.java.lang.NullPointerException
        at org.rhq.enterprise.client.InteractiveJavascriptCompletor.complete(InteractiveJavascriptCompletor.java:131)
        at jline.MultiCompletor.complete(MultiCompletor.java:53)
        at jline.ConsoleReader.complete(ConsoleReader.java:832)
        at jline.ConsoleReader.readLine(ConsoleReader.java:518)
        at jline.ConsoleReader.readLine(ConsoleReader.java:448)
        at org.rhq.enterprise.client.ClientMain.getUserInput(ClientMain.java:189)
        at org.rhq.enterprise.client.ClientMain$1.run(ClientMain.java:237)
        at java.lang.Thread.run(Thread.java:662)

Comment 2 Heiko W. Rupp 2011-10-11 07:20:52 UTC
NPEs are always a bug - is related to (and probably a duplicate of )  BZ 743379

Comment 3 Heiko W. Rupp 2011-10-11 07:44:27 UTC

In org.rhq.enterprise.client.InteractiveJavascriptCompletor#complete (line 131)
                Object rootObject = context.getAttribute(call[0]);

the context is null -- probably because the user is not logged in and so command completion is not yet ready. We nevertheless should not NPE here, but indicate to the user that he needs to log in.

Comment 4 Lukas Krejci 2011-10-11 15:44:45 UTC
This should be fixed with the fix for bug 743379

Comment 5 Mike Foley 2011-10-13 14:19:31 UTC
documenting the verification.  RHQ 10/13/2011 build.

RHQ - RHQ Enterprise Remote CLI 4.1.0-SNAPSHOT
Remote server version is: 4.1.0-SNAPSHOT (81e6d65)
Login successful
rhqadmin@localhost:7080$ rhq.log

login    logout
rhqadmin@localhost:7080$ rhq.l

Comment 6 Lukas Krejci 2011-10-14 06:48:00 UTC
(In reply to comment #5)
> documenting the verification.  RHQ 10/13/2011 build.
> 
> RHQ - RHQ Enterprise Remote CLI 4.1.0-SNAPSHOT
> Remote server version is: 4.1.0-SNAPSHOT (81e6d65)
> Login successful
> rhqadmin@localhost:7080$ rhq.log
> 
> login    logout
> rhqadmin@localhost:7080$ rhq.l

How did you start the CLI? Did you pass the credentials to the rhq-cli.sh directly (as would be suggested by the "Login successful" appearing before the prompt)?

This bug would only manifest itself when trying to use the CLI while not logged on. You need to start the CLI without any parameters so that the prompt at the start says "unconnected$" instead of "username@server$".

Comment 7 Mike Foley 2011-10-14 11:52:58 UTC
documenting verification 

[mfoley@foleymonsterbox1 bin]$ ./rhq-cli.sh 
RHQ - RHQ Enterprise Remote CLI 4.1.0-SNAPSHOT
unconnected$ rhq.log

login    logout
unconnected$ rhq.log

Comment 8 Mike Foley 2012-02-07 19:17:09 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE


Note You need to log in before you can comment on or make changes to this bug.