summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Krejci <lkrejci@redhat.com>2013-02-27 13:40:52 (GMT)
committerLukas Krejci <lkrejci@redhat.com>2013-02-27 13:42:04 (GMT)
commit5f74ac330228be62050d1b387ea2cf9a47639c36 (patch)
tree4478089b4bfc832ba30ae38b7df443559ac273d9
parent244a9489ab126f59fc7559f6547a7949b3c0b2dd (diff)
downloadrhq-5f74ac330228be62050d1b387ea2cf9a47639c36.zip
rhq-5f74ac330228be62050d1b387ea2cf9a47639c36.tar.gz
rhq-5f74ac330228be62050d1b387ea2cf9a47639c36.tar.xz
[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.
-rw-r--r--modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java b/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
index f33e029..0d5e25d 100644
--- a/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
+++ b/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
@@ -191,9 +191,20 @@ public class JavascriptCompletor implements CodeCompletion {
Object rootObject = nextList.get(0);
if (rootObject instanceof PropertyDescriptor && !(baseObject instanceof Class)) {
try {
- rootObject = invoke(baseObject, ((PropertyDescriptor) rootObject).getReadMethod());
+ Method readMethod = ((PropertyDescriptor) rootObject).getReadMethod();
+ //the read method might be null for for example indexed bean properties.
+ //Rhino doesn't interpret any more complex bean properties.
+ if (readMethod != null) {
+ rootObject = invoke(baseObject, readMethod);
+ } else {
+ return -1;
+ }
} catch (Exception e) {
- e.printStackTrace();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception while reading a java bean property.", e);
+ }
+
+ return -1;
}
} else if (rootObject instanceof Method) {
rootObject = ((Method) rootObject).getReturnType();