Description of problem: I am getting NPE on codecompletion Version-Release number of selected component (if applicable): RHQ-4.5.0 master How reproducible: always Steps to Reproduce: 1.execute following steps in CLI: var a = [1,2,3]; a.0.<pres tab for code completion> Actual results: java.lang.NullPointerException at org.rhq.scripting.javascript.JavascriptCompletor.getContextMatches(JavascriptCompletor.java:451) at org.rhq.scripting.javascript.JavascriptCompletor.contextComplete(JavascriptCompletor.java:203) at org.rhq.scripting.javascript.JavascriptCompletor.contextComplete(JavascriptCompletor.java:196) at org.rhq.scripting.javascript.JavascriptCompletor.complete(JavascriptCompletor.java:131) at org.rhq.enterprise.client.utility.CodeCompletionCompletorWrapper.complete(CodeCompletionCompletorWrapper.java:34) 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:278) at org.rhq.enterprise.client.ClientMain$1.run(ClientMain.java:319) at java.lang.Thread.run(Thread.java:636) Expected results: Additional info: I think than code-completion is incorrect in the way then if you type a<tab> you get a. and pressing another tab you get a.{0,1,2} - indexes of array which is kinda invalid, you should get a[{0,1,2}] to access member of array.
Our code completion is far from perfect and modifying it to differentiate between objects and arrays and offer different completion hints for each would only open up more questions for the missing features like, for example, the missing completions on the javascript's built-in functions and objects. I.e. one could argue that both "." and "[" are valid "continuations" for an expression for all objects and that code completion on "a." should return all the built-in methods of the Array object, while completion on "a[" should return the quoted names of the built-in methods + the indices. To better understand the above, consider following examples: var a = [1,2,3]; a.length; a["length"]; a[0]; To avoid such complexity for which our code completion is just not ready, I've modified the completor to not offer the array indices as a completion hint on "a." type of expressions. commit http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=af81247744ec551bd411435d2f3d0913bfe0ee95 Author: Lukas Krejci <lkrejci> Date: Wed Jan 2 11:57:44 2013 +0100 [BZ 844475] - Don't try to do code completion on native javascript arrays.
Bulk close of old bugs in VERIFIED state.