You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2019/07/26 08:14:37 UTC
[myfaces] branch master updated: MYFACES-4299
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new 1513421 MYFACES-4299
1513421 is described below
commit 1513421511c33b70d5e25b62a0229e94cbb49138
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri Jul 26 10:14:29 2019 +0200
MYFACES-4299
---
.../myfaces/cdi/managedproperty/ManagedPropertyProducer.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/managedproperty/ManagedPropertyProducer.java b/impl/src/main/java/org/apache/myfaces/cdi/managedproperty/ManagedPropertyProducer.java
index 67c0d98..b8bdcfd 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/managedproperty/ManagedPropertyProducer.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/managedproperty/ManagedPropertyProducer.java
@@ -25,6 +25,7 @@ import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.util.AnnotationLiteral;
+import javax.faces.FacesException;
import javax.faces.annotation.ManagedProperty;
import javax.faces.context.FacesContext;
import org.apache.myfaces.cdi.util.AbstractDynamicProducer;
@@ -79,6 +80,12 @@ public class ManagedPropertyProducer extends AbstractDynamicProducer<Object>
protected Object createManagedProperty(CreationalContext<Object> cc, ManagedPropertyInfo typeInfo)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (facesContext == null)
+ {
+ throw new FacesException("@ManagedProperty(\"" + typeInfo.getExpression()
+ + "\") can only be resolved in a JSF request!");
+ }
+
return facesContext.getApplication().evaluateExpressionGet(
facesContext, typeInfo.getExpression(), getBeanClass());
}