var x = AvailabilityManager.getCurrentAvailabilityForResource( ... ); x.availabilityType.<tab> Leads to: ava.lang.NullPointerException at org.rhq.enterprise.client.InteractiveJavascriptCompletor.getContextMatches(InteractiveJavascriptCompletor.java:445) at org.rhq.enterprise.client.InteractiveJavascriptCompletor.contextComplete(InteractiveJavascriptCompletor.java:200) at org.rhq.enterprise.client.InteractiveJavascriptCompletor.contextComplete(InteractiveJavascriptCompletor.java:193) at org.rhq.enterprise.client.InteractiveJavascriptCompletor.complete(InteractiveJavascriptCompletor.java:134) 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)
I'm unable to reproduce this using HEAD of the master branch: rhqadmin@localhost:7080$ var x = AvailabilityManager.getCurrentAvailabilityForResource(10001) rhqadmin@localhost:7080$ x Availability: availabilityType: DOWN endTime: id: 12247 resource: Resource[id=10001, type=<null>, key=null, name=null, parent=<null>] startTime: Tue Nov 08 15:16:11 EST 2011 rhqadmin@localhost:7080$ x.availabilityType AvailabilityType: name: DOWN rhqadmin@localhost:7080$ x.availabilityType.<Tab> compareTo declaringClass name ordinal toString valueOf values Even when I set x.availablityType to null and then try the autocompletion again, I still don't get an NPE. I just get an ASCII beep telling me there are no autocompletion matches. Ondra, can you still reproduce this? If so, can you try to give me more detailed reproduction steps that I can use to reproduce? Thanks.
May be related to https://bugzilla.redhat.com/show_bug.cgi?id=717392 and https://bugzilla.redhat.com/show_bug.cgi?id=743379 and thus fixed by one of those.
Ian I see something similar: rhqadmin@localhost:7080$ AlertDefinitionManager.alertDefinition.<TAB> java.lang.NullPointerException at org.rhq.enterprise.client.InteractiveJavascriptCompletor.invoke(InteractiveJavascriptCompletor.java:593) at org.rhq.enterprise.client.InteractiveJavascriptCompletor.contextComplete(InteractiveJavascriptCompletor.java:185) at org.rhq.enterprise.client.InteractiveJavascriptCompletor.complete(InteractiveJavascriptCompletor.java:134) 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:202) at org.rhq.enterprise.client.ClientMain$1.run(ClientMain.java:250) at java.lang.Thread.run(Thread.java:680) This comes from the fact, that we invoke on method being null here. A possible patch: --- modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/InteractiveJavascriptCompletor.java (revision 38bdef17e38c1322d7034f26360420036aedc19c) +++ modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/InteractiveJavascriptCompletor.java (revision ) @@ -182,7 +182,10 @@ Object rootObject = matches.get(next).get(0); if (rootObject instanceof PropertyDescriptor && !(baseObject instanceof Class)) { try { - rootObject = invoke(baseObject, ((PropertyDescriptor) rootObject).getReadMethod()); + Method readMethod = ((PropertyDescriptor) rootObject).getReadMethod(); + if (readMethod==null) + return -1; + rootObject = invoke(baseObject, readMethod); } catch (Exception e) { e.printStackTrace();
Assigning to Lukas for further evaluation. Lukas, do what you think makes sense for this one.
master http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=5f74ac330228be62050d1b387ea2cf9a47639c36 Author: Lukas Krejci <lkrejci> Date: Wed Feb 27 14:40:52 2013 +0100 [BZ 726673] - be more robust against different types of bean properties. Rhino doesn't handle indexed properties automagically as it does normal basic javabean properties, so we should offer no code completion on such advanced property types.
Bulk closing of some old issues