This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 717392 - NPE in code completion
NPE in code completion
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
3.0.1
Unspecified Unspecified
low Severity unspecified (vote)
: ---
: ---
Assigned To: Lukas Krejci
Mike Foley
: Reopened
Depends On: 743379 786976
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-28 14:09 EDT by Ondřej Žižka
Modified: 2012-02-07 14:17 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-02-07 14:17:09 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Ondřej Žižka 2011-06-28 14:09:00 EDT
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 03:20:52 EDT
NPEs are always a bug - is related to (and probably a duplicate of )  BZ 743379
Comment 3 Heiko W. Rupp 2011-10-11 03:44:27 EDT

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 11:44:45 EDT
This should be fixed with the fix for bug 743379
Comment 5 Mike Foley 2011-10-13 10:19:31 EDT
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 02:48:00 EDT
(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 07:52:58 EDT
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 14:17:09 EST
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.