@Override @SuppressWarnings("deprecation") public Object getValue(ELContext context, Object base, Object property) throws ELException { // Don't call into the chain unless it's been decorated. if (legacyVR instanceof ChainAwareVariableResolver) { return null; } if (base != null) { return null; } if (base == null && property == null) { String message = MessageUtils.getExceptionMessageString( MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "base and property"); // ????? throw new PropertyNotFoundException(message); } context.setPropertyResolved(true); Object result = null; FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); String propString = property.toString(); Map<String, Object> stateMap = RequestStateManager.getStateMap(facesContext); try { // If we are already in the midst of an expression evaluation // that touched this resolver... //noinspection unchecked List<String> varNames = (List<String>) stateMap.get(RequestStateManager.REENTRANT_GUARD); if (varNames != null && !varNames.isEmpty() && varNames.contains(propString)) { // take no action and return. context.setPropertyResolved(false); return null; } // Make sure subsequent calls don't take action. if (varNames == null) { varNames = new ArrayList<>(); stateMap.put(RequestStateManager.REENTRANT_GUARD, varNames); } varNames.add(propString); result = legacyVR.resolveVariable(facesContext, propString); } catch (EvaluationException ex) { context.setPropertyResolved(false); throw new ELException(ex); } finally { // Make sure to remove the guard after the call returns //noinspection unchecked List<String> varNames = (List<String>) stateMap.get(RequestStateManager.REENTRANT_GUARD); if (varNames != null && !varNames.isEmpty()) { varNames.remove(propString); } // Make sure that the ELContext "resolved" indicator is set // in accordance wth the result of the resolution. context.setPropertyResolved(result != null); } return result; }