private void fillContext(Object contextObject, Map map) {
if (contextObject == null) return;
// Hack: I use jxpath to populate the context object's properties
// in the jexl context
final JXPathBeanInfo bi =
JXPathIntrospector.getBeanInfo(contextObject.getClass());
if (bi.isDynamic()) {
Class cl = bi.getDynamicPropertyHandlerClass();
try {
DynamicPropertyHandler h = (DynamicPropertyHandler) cl.newInstance();
String[] result = h.getPropertyNames(contextObject);
for (int i = 0; i < result.length; i++) {
try {
map.put(result[i], h.getProperty(contextObject, result[i]));
} catch (Exception exc) {
exc.printStackTrace();
}
}
} catch (Exception ignored) {
ignored.printStackTrace();
}
} else {
PropertyDescriptor[] props = bi.getPropertyDescriptors();
for (int i = 0; i < props.length; i++) {
try {
Method read = props[i].getReadMethod();
if (read != null) {
map.put(props[i].getName(),