You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/06/16 00:38:35 UTC
svn commit: r1136229 [1/2] - in
/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces:
application/ el/ el/convert/ el/unified/ el/unified/resolver/
el/unified/resolver/implicitobject/
Author: lu4242
Date: Wed Jun 15 22:38:34 2011
New Revision: 1136229
URL: http://svn.apache.org/viewvc?rev=1136229&view=rev
Log:
MYFACES-3158 Memory Leak related to ThreadLocal with org.apache.myfaces.el.convert.VariableResolverToELResolver (backport issue MYFACES 2942) and synch el stuff with 2.0 branch
Modified:
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/CompositeELResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullPropertyResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullVariableResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToPropertyResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToVariableResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/MethodExpressionToMethodBinding.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ValueExpressionToValueBinding.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/VariableResolverToELResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/CustomFirstELResolverComparator.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/FacesELContext.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderBase.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForJSP.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/GuiceResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ManagedBeanResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ScopedAttributeResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/ApplicationImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/ApplicationScopeImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/CookieImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/FacesContextImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/HeaderImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/HeaderValuesImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/ImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/ImplicitObjectResolver.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/InitParamImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/ParamImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/ParamValuesImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/RequestImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/RequestScopeImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/SessionImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/SessionScopeImplicitObject.java
myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/ViewImplicitObject.java
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java Wed Jun 15 22:38:34 2011
@@ -175,7 +175,8 @@ public class ApplicationImpl extends App
@Override
public final ELResolver getELResolver()
{
- // we don't need synchronization here since it is ok to have multiple instances of the elresolver
+ // we don't need synchronization here since it is ok to have multiple
+ // instances of the elresolver
if (elResolver == null)
{
elResolver = createFacesResolver();
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/CompositeELResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/CompositeELResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/CompositeELResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/CompositeELResolver.java Wed Jun 15 22:38:34 2011
@@ -34,24 +34,31 @@ import javax.el.ELResolver;
*/
public class CompositeELResolver extends javax.el.CompositeELResolver
{
- private Collection<ELResolver> _elResolvers = Collections.EMPTY_LIST;
+ private Collection<ELResolver> _elResolvers;
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object base)
{
- return new CompositeIterator(context, base, _elResolvers.iterator());
+ Collection<ELResolver> resolvers = _elResolvers;
+ if (resolvers == null)
+ {
+ resolvers = Collections.emptyList();
+ }
+
+ return new CompositeIterator(context, base, resolvers.iterator());
}
/**
* @param elResolver
*/
- public final void add(final ELResolver elResolver)
+ @Override
+ public final synchronized void add(final ELResolver elResolver)
{
super.add(elResolver);
- if (_elResolvers == Collections.EMPTY_LIST)
+ if (_elResolvers == null)
{
- _elResolvers = new ArrayList();
+ _elResolvers = new ArrayList<ELResolver>();
}
_elResolvers.add(elResolver);
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullPropertyResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullPropertyResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullPropertyResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullPropertyResolver.java Wed Jun 15 22:38:34 2011
@@ -35,40 +35,48 @@ public final class NullPropertyResolver
public NullPropertyResolver() {
}
+ @Override
public boolean isReadOnly(Object base, int index) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
return false;
}
+ @Override
public boolean isReadOnly(Object base, Object property) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
return false;
}
+ @Override
public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
return null;
}
+ @Override
public Object getValue(Object base, Object property) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
return null;
}
+ @Override
public Class getType(Object base, int index) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
return null;
}
- public Class getType(Object base, Object property) throws EvaluationException, PropertyNotFoundException {
+ @Override
+ public Class getType(Object base, Object property) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
return null;
}
+ @Override
public void setValue(Object base, Object property, Object value) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
}
+ @Override
public void setValue(Object base, int index, Object value) throws EvaluationException, PropertyNotFoundException {
elContext().setPropertyResolved(false);
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullVariableResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullVariableResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullVariableResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/NullVariableResolver.java Wed Jun 15 22:38:34 2011
@@ -23,22 +23,24 @@ import javax.faces.el.EvaluationExceptio
import javax.faces.el.VariableResolver;
/**
- * This is the default VariableResolver. See JSF 1.2 spec section 5.8.1
- *
+ * This is the default VariableResolver. See JSF 1.2 spec section 5.8.1
+ *
* @author Stan Silvert
*/
-public class NullVariableResolver extends VariableResolver {
-
+public class NullVariableResolver extends VariableResolver
+{
+
/** Creates a new instance of NullVariableResolver */
- public NullVariableResolver() {
+ public NullVariableResolver()
+ {
}
- public Object resolveVariable(FacesContext facesContext, String name)
- throws EvaluationException {
-
+ @Override
+ public Object resolveVariable(FacesContext facesContext, String name) throws EvaluationException
+ {
facesContext.getELContext().setPropertyResolved(false);
-
+
return null;
}
-
+
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java Wed Jun 15 22:38:34 2011
@@ -41,10 +41,19 @@ public final class PropertyResolverImpl
@Override
public Object getValue(final Object base, final Object property) throws EvaluationException,
- PropertyNotFoundException
+ PropertyNotFoundException
{
+ if (base == null)
+ {
+ return null;
+ }
+ if (property == null)
+ {
+ return null;
+ }
return invokeResolver(new ResolverInvoker<Object>(base, property)
{
+ @Override
public Object invoke(ELResolver resolver, ELContext context)
{
return getELResolver().getValue(getELContext(), base, property);
@@ -60,11 +69,11 @@ public final class PropertyResolverImpl
@Override
public void setValue(final Object base, final Object property, final Object newValue) throws EvaluationException,
- PropertyNotFoundException
+ PropertyNotFoundException
{
- if (base == null || property == null)
+ if (base == null || property == null || isReadOnly (base, property))
throw new PropertyNotFoundException();
-
+
invokeResolver(new ResolverInvoker<Object>(base, property)
{
@Override
@@ -87,17 +96,22 @@ public final class PropertyResolverImpl
{
if (base == null)
throw new PropertyNotFoundException();
-
- if (base instanceof Object[]) {
- if (index < 0 || index>=((Object[])base).length) {
+
+ if (base instanceof Object[])
+ {
+ if (index < 0 || index >= ((Object[])base).length)
+ {
throw new PropertyNotFoundException();
}
- } else if (base instanceof List) {
- if (index < 0 || index>=((List)base).size()) {
+ }
+ else if (base instanceof List)
+ {
+ if (index < 0 || index >= ((List<?>)base).size())
+ {
throw new PropertyNotFoundException();
}
}
-
+
setValue(base, Integer.valueOf(index), newValue);
}
@@ -106,6 +120,7 @@ public final class PropertyResolverImpl
{
return invokeResolver(new ResolverInvoker<Boolean>(base, property)
{
+ @Override
public Boolean invoke(ELResolver resolver, ELContext context)
{
return Boolean.valueOf(getELResolver().isReadOnly(getELContext(), base, property));
@@ -124,10 +139,11 @@ public final class PropertyResolverImpl
{
if (base == null || property == null)
throw new PropertyNotFoundException();
-
- return invokeResolver(new ResolverInvoker<Class>(base, property)
+
+ return invokeResolver(new ResolverInvoker<Class<?>>(base, property)
{
- public Class invoke(final ELResolver resolver, final ELContext context)
+ @Override
+ public Class<?> invoke(final ELResolver resolver, final ELContext context)
{
return resolver.getType(context, base, property);
}
@@ -139,20 +155,25 @@ public final class PropertyResolverImpl
{
if (base == null)
throw new PropertyNotFoundException();
-
- if (base instanceof Object[]) {
- if (index < 0 || index>=((Object[])base).length) {
+
+ if (base instanceof Object[])
+ {
+ if (index < 0 || index >= ((Object[])base).length)
+ {
throw new PropertyNotFoundException();
}
- } else if (base instanceof List) {
- if (index < 0 || index>=((List)base).size()) {
+ }
+ else if (base instanceof List)
+ {
+ if (index < 0 || index >= ((List<?>)base).size())
+ {
throw new PropertyNotFoundException();
}
}
-
+
return getType(base, Integer.valueOf(index));
}
-
+
// ~ Internal Helper Methods
// ------------------------------------------------
@@ -180,7 +201,7 @@ public final class PropertyResolverImpl
catch (javax.el.PropertyNotFoundException e)
{
throw new PropertyNotFoundException("property not found: " + invoker.getMessage() + ": " + e.getMessage(),
- e);
+ e);
}
catch (ELException e)
{
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToPropertyResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToPropertyResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToPropertyResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToPropertyResolver.java Wed Jun 15 22:38:34 2011
@@ -27,122 +27,174 @@ import javax.faces.el.PropertyNotFoundEx
import javax.faces.el.PropertyResolver;
/**
- *
+ *
* @author Stan Silvert
*/
-public final class ELResolverToPropertyResolver extends PropertyResolver {
-
+public final class ELResolverToPropertyResolver extends PropertyResolver
+{
+
private final ELResolver elResolver;
-
+
/**
* Creates a new instance of ELResolverToPropertyResolver
*/
- public ELResolverToPropertyResolver(final ELResolver elResolver) {
+ public ELResolverToPropertyResolver(final ELResolver elResolver)
+ {
this.elResolver = elResolver;
}
- public boolean isReadOnly(final Object base, final int index)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+ @Override
+ public boolean isReadOnly(final Object base, final int index) throws EvaluationException, PropertyNotFoundException
+ {
+
+ try
+ {
return elResolver.isReadOnly(elContext(), base, Integer.valueOf(index));
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
-
+
}
-
- public boolean isReadOnly(final Object base, final Object property)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+
+ @Override
+ public boolean isReadOnly(final Object base, final Object property) throws EvaluationException, PropertyNotFoundException
+ {
+
+ try
+ {
return elResolver.isReadOnly(elContext(), base, property);
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
-
+
}
- public Object getValue(final Object base, final int index)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+ @Override
+ public Object getValue(final Object base, final int index) throws EvaluationException, PropertyNotFoundException
+ {
+
+ try
+ {
return elResolver.getValue(elContext(), base, Integer.valueOf(index));
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
-
+
}
- public Object getValue(final Object base, final Object property)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+ @Override
+ public Object getValue(final Object base, final Object property) throws EvaluationException, PropertyNotFoundException
+ {
+
+ try
+ {
return elResolver.getValue(elContext(), base, property);
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
}
-
- public Class getType(final Object base, int index)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+
+ @Override
+ public Class getType(final Object base, int index) throws EvaluationException, PropertyNotFoundException
+ {
+
+ try
+ {
return elResolver.getType(elContext(), base, Integer.valueOf(index));
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
}
-
- public Class getType(final Object base, final Object property)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+
+ @Override
+ public Class getType(final Object base, final Object property) throws EvaluationException, PropertyNotFoundException
+ {
+
+ try
+ {
return elResolver.getType(elContext(), base, property);
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
}
- public void setValue(final Object base, final Object property, final Object value)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+ @Override
+ public void setValue(final Object base, final Object property, final Object value) throws EvaluationException,
+ PropertyNotFoundException
+ {
+
+ try
+ {
elResolver.setValue(elContext(), base, property, value);
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
}
- public void setValue(final Object base, int index, final Object value)
- throws EvaluationException, PropertyNotFoundException {
-
- try {
+ @Override
+ public void setValue(final Object base, int index, final Object value) throws EvaluationException, PropertyNotFoundException
+ {
+
+ try
+ {
elResolver.setValue(elContext(), base, Integer.valueOf(index), value);
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.PropertyNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
-
+
}
- private ELContext elContext() {
+ private ELContext elContext()
+ {
return FacesContext.getCurrentInstance().getELContext();
}
-
+
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToVariableResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToVariableResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToVariableResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ELResolverToVariableResolver.java Wed Jun 15 22:38:34 2011
@@ -26,32 +26,41 @@ import javax.faces.el.EvaluationExceptio
import javax.faces.el.VariableResolver;
/**
- * Provides ELResolver wrapper so that legacy apps which rely on a
- * VariableResolver can still work.
- *
+ * Provides ELResolver wrapper so that legacy apps which rely on a VariableResolver can still work.
+ *
* @author Stan Silvert
*/
-public final class ELResolverToVariableResolver extends VariableResolver {
-
+public final class ELResolverToVariableResolver extends VariableResolver
+{
+
private final ELResolver elResolver;
-
+
/**
* Creates a new instance of ELResolverToVariableResolver
*/
- public ELResolverToVariableResolver(final ELResolver elResolver) {
- if (elResolver == null) throw new NullPointerException();
+ public ELResolverToVariableResolver(final ELResolver elResolver)
+ {
+ if (elResolver == null)
+ throw new NullPointerException();
this.elResolver = elResolver;
}
- public Object resolveVariable(final FacesContext facesContext, final String name) throws EvaluationException {
-
- try {
+ @Override
+ public Object resolveVariable(final FacesContext facesContext, final String name) throws EvaluationException
+ {
+
+ try
+ {
return elResolver.getValue(facesContext.getELContext(), null, name);
- } catch (PropertyNotFoundException e) {
+ }
+ catch (PropertyNotFoundException e)
+ {
throw new EvaluationException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e);
}
}
-
+
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/MethodExpressionToMethodBinding.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/MethodExpressionToMethodBinding.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/MethodExpressionToMethodBinding.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/MethodExpressionToMethodBinding.java Wed Jun 15 22:38:34 2011
@@ -27,75 +27,91 @@ import javax.faces.el.MethodBinding;
import javax.faces.el.MethodNotFoundException;
/**
- * Converts a MethodExpression to a MethodBinding.
- * See JSF 1.2 spec section 5.8.4
- *
- * ATTENTION: If you make changes to this class, treat
- * javax.faces.component._MethodExpressionToMethodBinding
+ * Converts a MethodExpression to a MethodBinding. See JSF 1.2 spec section 5.8.4
+ *
+ * ATTENTION: If you make changes to this class, treat javax.faces.component._MethodExpressionToMethodBinding
* accordingly.
- *
+ *
* @author Stan Silvert
* @see javax.faces.component._MethodExpressionToMethodBinding
*/
-public final class MethodExpressionToMethodBinding extends MethodBinding implements StateHolder {
-
+public final class MethodExpressionToMethodBinding extends MethodBinding implements StateHolder
+{
+
private MethodExpression methodExpression;
-
+
private boolean isTransient = false;
-
- public MethodExpressionToMethodBinding() {
+
+ public MethodExpressionToMethodBinding()
+ {
methodExpression = null;
}
/** Creates a new instance of MethodExpressionToMethodBinding */
- public MethodExpressionToMethodBinding(final MethodExpression methodExpression) {
+ public MethodExpressionToMethodBinding(final MethodExpression methodExpression)
+ {
this.methodExpression = methodExpression;
}
-
+
@Override
public String getExpressionString()
{
return methodExpression.getExpressionString();
}
- public Class getType(FacesContext facesContext)
- throws MethodNotFoundException {
-
- try {
+ @Override
+ public Class getType(FacesContext facesContext) throws MethodNotFoundException
+ {
+
+ try
+ {
return methodExpression.getMethodInfo(facesContext.getELContext()).getReturnType();
- } catch (javax.el.MethodNotFoundException e) {
+ }
+ catch (javax.el.MethodNotFoundException e)
+ {
throw new javax.faces.el.MethodNotFoundException(e);
}
}
- public Object invoke(final FacesContext facesContext, final Object[] params)
- throws EvaluationException, MethodNotFoundException {
-
- try {
+ @Override
+ public Object invoke(final FacesContext facesContext, final Object[] params) throws EvaluationException,
+ MethodNotFoundException
+ {
+
+ try
+ {
return methodExpression.invoke(facesContext.getELContext(), params);
- } catch (javax.el.MethodNotFoundException e) {
+ }
+ catch (javax.el.MethodNotFoundException e)
+ {
throw new javax.faces.el.MethodNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new EvaluationException(e.getCause());
}
}
-// -------- StateHolder methods -------------------------------------------
-
- public void restoreState(final FacesContext context, final Object state) {
- methodExpression = (MethodExpression)state;
+ // -------- StateHolder methods -------------------------------------------
+
+ public void restoreState(final FacesContext context, final Object state)
+ {
+ methodExpression = (MethodExpression) state;
}
- public Object saveState(final FacesContext context) {
+ public Object saveState(final FacesContext context)
+ {
return methodExpression;
}
- public void setTransient(final boolean newTransientValue) {
+ public void setTransient(final boolean newTransientValue)
+ {
isTransient = newTransientValue;
}
- public boolean isTransient() {
+ public boolean isTransient()
+ {
return isTransient;
}
-
+
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ValueExpressionToValueBinding.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ValueExpressionToValueBinding.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ValueExpressionToValueBinding.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/ValueExpressionToValueBinding.java Wed Jun 15 22:38:34 2011
@@ -200,8 +200,7 @@ public class ValueExpressionToValueBindi
else
{
Object[] stateArray = (Object[]) state;
- _valueExpression = (ValueExpression) ClassUtils.newInstance((String) stateArray[0],
- ValueExpression.class);
+ _valueExpression = (ValueExpression) ClassUtils.newInstance((String) stateArray[0], ValueExpression.class);
((StateHolder) _valueExpression).restoreState(facesContext, stateArray[1]);
}
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/VariableResolverToELResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/VariableResolverToELResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/VariableResolverToELResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/convert/VariableResolverToELResolver.java Wed Jun 15 22:38:34 2011
@@ -26,7 +26,6 @@ import javax.el.PropertyNotWritableExcep
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.VariableResolver;
-
import java.beans.FeatureDescriptor;
import java.util.Collection;
import java.util.HashSet;
@@ -44,13 +43,32 @@ public final class VariableResolverToELR
{
// holds a flag to check if this instance is already called in current thread
- private static final ThreadLocal<Collection<String>> propertyGuard = new ThreadLocal<Collection<String>>() {
- @Override
- protected Collection<String> initialValue()
+ private static final ThreadLocal<Collection<String>> propertyGuardThreadLocal
+ = new ThreadLocal<Collection<String>>();
+
+ /**
+ * Gets the Collection<String> value of the propertyGuardThreadLocal.
+ * If the value from the ThreadLocal ist null, a new Collection<String>
+ * will be created.
+ *
+ * NOTE that we should not accomplish this by setting an initialValue on the
+ * ThreadLocal, because this will automatically be set on the ThreadLocalMap
+ * and thus can propably cause a memory leak.
+ *
+ * @return
+ */
+ private static Collection<String> getPropertyGuard()
+ {
+ Collection<String> propertyGuard = propertyGuardThreadLocal.get();
+
+ if (propertyGuard == null)
{
- return new HashSet<String>();
+ propertyGuard = new HashSet<String>();
+ propertyGuardThreadLocal.set(propertyGuard);
}
- };
+
+ return propertyGuard;
+ }
private VariableResolver variableResolver;
@@ -70,6 +88,7 @@ public final class VariableResolverToELR
return variableResolver;
}
+ @Override
public Object getValue(ELContext context, Object base, Object property) throws NullPointerException,
PropertyNotFoundException, ELException
{
@@ -86,12 +105,14 @@ public final class VariableResolverToELR
final String strProperty = (String) property;
+ Collection<String> propertyGuard = getPropertyGuard();
+
Object result = null;
try
{
// only call the resolver if we haven't done it in current stack
- if(!propertyGuard.get().contains(strProperty)) {
- propertyGuard.get().add(strProperty);
+ if(!propertyGuard.contains(strProperty)) {
+ propertyGuard.add(strProperty);
result = variableResolver.resolveVariable(facesContext(context), strProperty);
}
}
@@ -112,7 +133,15 @@ public final class VariableResolverToELR
}
finally
{
- propertyGuard.get().remove(strProperty);
+ propertyGuard.remove(strProperty);
+
+ // if the propertyGuard is empty, remove the ThreadLocal
+ // in order to prevent a memory leak
+ if (propertyGuard.isEmpty())
+ {
+ propertyGuardThreadLocal.remove();
+ }
+
// set property resolved to false in any case if result is null
context.setPropertyResolved(result != null);
}
@@ -126,6 +155,7 @@ public final class VariableResolverToELR
return (FacesContext) context.getContext(FacesContext.class);
}
+ @Override
public Class<?> getCommonPropertyType(ELContext context, Object base)
{
if (base != null)
@@ -134,6 +164,7 @@ public final class VariableResolverToELR
return String.class;
}
+ @Override
public void setValue(ELContext context, Object base, Object property, Object value) throws NullPointerException,
PropertyNotFoundException, PropertyNotWritableException, ELException
{
@@ -142,6 +173,7 @@ public final class VariableResolverToELR
throw new PropertyNotFoundException();
}
+ @Override
public boolean isReadOnly(ELContext context, Object base, Object property) throws NullPointerException,
PropertyNotFoundException, ELException
{
@@ -152,6 +184,7 @@ public final class VariableResolverToELR
return false;
}
+ @Override
public Class<?> getType(ELContext context, Object base, Object property) throws NullPointerException,
PropertyNotFoundException, ELException
{
@@ -162,6 +195,7 @@ public final class VariableResolverToELR
return null;
}
+ @Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base)
{
return null;
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/CustomFirstELResolverComparator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/CustomFirstELResolverComparator.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/CustomFirstELResolverComparator.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/CustomFirstELResolverComparator.java Wed Jun 15 22:38:34 2011
@@ -44,7 +44,7 @@ public class CustomFirstELResolverCompar
public int compare(ELResolver r1, ELResolver r2)
{
List<ELResolver> facesConfigResolvers = _getFacesConfigElResolvers();
-
+
if (facesConfigResolvers == null)
{
// no el-resolvers in faces-config
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/FacesELContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/FacesELContext.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/FacesELContext.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/FacesELContext.java Wed Jun 15 22:38:34 2011
@@ -26,44 +26,53 @@ import javax.faces.context.FacesContext;
/**
* ELContext used for JSF.
- *
+ *
* @author Stan Silvert
*/
-public class FacesELContext extends ELContext {
-
+public class FacesELContext extends ELContext
+{
+
private ELResolver _elResolver;
private FunctionMapper _functionMapper;
private VariableMapper _variableMapper;
-
- public FacesELContext(ELResolver elResolver,
- FacesContext facesContext) {
+
+ public FacesELContext(ELResolver elResolver, FacesContext facesContext)
+ {
this._elResolver = elResolver;
putContext(FacesContext.class, facesContext);
-
+
// TODO: decide if we need to implement our own FunctionMapperImpl and
- // VariableMapperImpl instead of relying on Tomcat's version.
- //this.functionMapper = new FunctionMapperImpl();
- //this.variableMapper = new VariableMapperImpl();
+ // VariableMapperImpl instead of relying on Tomcat's version.
+ // this.functionMapper = new FunctionMapperImpl();
+ // this.variableMapper = new VariableMapperImpl();
}
-
- public VariableMapper getVariableMapper() {
+
+ @Override
+ public VariableMapper getVariableMapper()
+ {
return _variableMapper;
}
- public void setVariableMapper(VariableMapper varMapper) {
+ public void setVariableMapper(VariableMapper varMapper)
+ {
_variableMapper = varMapper;
}
- public FunctionMapper getFunctionMapper() {
+ @Override
+ public FunctionMapper getFunctionMapper()
+ {
return _functionMapper;
}
- public void setFunctionMapper(FunctionMapper functionMapper) {
+ public void setFunctionMapper(FunctionMapper functionMapper)
+ {
_functionMapper = functionMapper;
}
- public ELResolver getELResolver() {
+ @Override
+ public ELResolver getELResolver()
+ {
return _elResolver;
}
-
+
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderBase.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderBase.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderBase.java Wed Jun 15 22:38:34 2011
@@ -18,11 +18,11 @@
*/
package org.apache.myfaces.el.unified;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.el.convert.PropertyResolverToELResolver;
-import org.apache.myfaces.el.convert.VariableResolverToELResolver;
-import org.apache.myfaces.shared_impl.util.ClassUtils;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.el.CompositeELResolver;
import javax.el.ELResolver;
@@ -31,11 +31,12 @@ import javax.faces.context.ExternalConte
import javax.faces.context.FacesContext;
import javax.faces.el.PropertyResolver;
import javax.faces.el.VariableResolver;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+import org.apache.myfaces.config.RuntimeConfig;
+import org.apache.myfaces.el.convert.PropertyResolverToELResolver;
+import org.apache.myfaces.el.convert.VariableResolverToELResolver;
+import org.apache.myfaces.shared_impl.util.ClassUtils;
/**
* @author Mathias Broekelmann (latest modification by $Author$)
@@ -46,11 +47,11 @@ public class ResolverBuilderBase
{
private static final Logger log = Logger.getLogger(ResolverBuilderBase.class.getName());
-
+
@JSFWebConfigParam(since = "1.2.10, 2.0.2",
desc = "The Class of an Comparator<ELResolver> implementation.")
public static final String EL_RESOLVER_COMPARATOR = "org.apache.myfaces.EL_RESOLVER_COMPARATOR";
-
+
private final RuntimeConfig _config;
public ResolverBuilderBase(RuntimeConfig config)
@@ -102,7 +103,7 @@ public class ResolverBuilderBase
}
}
}
-
+
/**
* Sort the ELResolvers with a custom Comparator provided by the user.
* @param resolvers
@@ -111,18 +112,18 @@ public class ResolverBuilderBase
@SuppressWarnings("unchecked")
protected void sortELResolvers(List<ELResolver> resolvers)
{
- ExternalContext externalContext
+ ExternalContext externalContext
= FacesContext.getCurrentInstance().getExternalContext();
-
+
String comparatorClass = externalContext
.getInitParameter(EL_RESOLVER_COMPARATOR);
-
+
if (comparatorClass != null && !"".equals(comparatorClass))
{
// the user provided the parameter.
-
+
// if we already have a cached instance, use it
- Comparator<ELResolver> comparator
+ Comparator<ELResolver> comparator
= (Comparator<ELResolver>) externalContext.
getApplicationMap().get(EL_RESOLVER_COMPARATOR);
try
@@ -130,23 +131,23 @@ public class ResolverBuilderBase
if (comparator == null)
{
// get the comparator class
- Class<Comparator<ELResolver>> clazz
+ Class<Comparator<ELResolver>> clazz
= ClassUtils.classForName(comparatorClass);
-
+
// create the instance
comparator = clazz.newInstance();
-
+
// cache the instance, because it will be used at least two times
externalContext.getApplicationMap()
.put(EL_RESOLVER_COMPARATOR, comparator);
}
-
+
// sort the resolvers
Collections.sort(resolvers, comparator);
}
catch (Exception e)
{
- log.log(Level.WARNING,
+ log.log(Level.WARNING,
"Could not sort ELResolvers with custom Comparator", e);
}
}
@@ -162,4 +163,4 @@ public class ResolverBuilderBase
return new PropertyResolverToELResolver(resolver);
}
-}
\ No newline at end of file
+}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java Wed Jun 15 22:38:34 2011
@@ -18,16 +18,23 @@
*/
package org.apache.myfaces.el.unified;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.el.ArrayELResolver;
+import javax.el.BeanELResolver;
+import javax.el.CompositeELResolver;
+import javax.el.ELResolver;
+import javax.el.ListELResolver;
+import javax.el.MapELResolver;
+import javax.el.ResourceBundleELResolver;
+
import org.apache.myfaces.config.RuntimeConfig;
import org.apache.myfaces.el.unified.resolver.ManagedBeanResolver;
import org.apache.myfaces.el.unified.resolver.ResourceBundleResolver;
import org.apache.myfaces.el.unified.resolver.ScopedAttributeResolver;
import org.apache.myfaces.el.unified.resolver.implicitobject.ImplicitObjectResolver;
-import javax.el.*;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Create the el resolver for faces. see 1.2 spec section 5.6.2
*
@@ -58,16 +65,16 @@ public class ResolverBuilderForFaces ext
list.add(new ListELResolver());
list.add(new ArrayELResolver());
list.add(new BeanELResolver());
-
+
// give the user a chance to sort the resolvers
sortELResolvers(list);
-
+
// add the resolvers from the list to the CompositeELResolver
for (ELResolver resolver : list)
{
compositeElResolver.add(resolver);
}
-
+
// the ScopedAttributeResolver has to be the last one in every
// case, because it always sets propertyResolved to true (per the spec)
compositeElResolver.add(new ScopedAttributeResolver());
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForJSP.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForJSP.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForJSP.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForJSP.java Wed Jun 15 22:38:34 2011
@@ -18,16 +18,17 @@
*/
package org.apache.myfaces.el.unified;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.el.CompositeELResolver;
+import javax.el.ELResolver;
+
import org.apache.myfaces.config.RuntimeConfig;
import org.apache.myfaces.el.unified.resolver.ManagedBeanResolver;
import org.apache.myfaces.el.unified.resolver.ResourceBundleResolver;
import org.apache.myfaces.el.unified.resolver.implicitobject.ImplicitObjectResolver;
-import javax.el.CompositeELResolver;
-import javax.el.ELResolver;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* build the el resolver for jsp. see 1.2 spec section 5.6.1
*
@@ -46,16 +47,16 @@ public class ResolverBuilderForJSP exten
{
// add the ELResolvers to a List first to be able to sort them
List<ELResolver> list = new ArrayList<ELResolver>();
-
+
list.add(ImplicitObjectResolver.makeResolverForJSP());
list.add(new ManagedBeanResolver());
list.add(new ResourceBundleResolver());
addFromRuntimeConfig(list);
-
+
// give the user a chance to sort the resolvers
sortELResolvers(list);
-
+
// add the resolvers from the list to the CompositeELResolver
for (ELResolver resolver : list)
{
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java Wed Jun 15 22:38:34 2011
@@ -55,7 +55,7 @@ public final class FacesCompositeELResol
}
public static final String SCOPE = "org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.Scope";
-
+
public FacesCompositeELResolver(final Scope scope)
{
if (scope == null)
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/GuiceResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/GuiceResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/GuiceResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/GuiceResolver.java Wed Jun 15 22:38:34 2011
@@ -65,49 +65,50 @@ import com.google.inject.Injector;
* @author Dennis Byrne
*/
-public class GuiceResolver extends ManagedBeanResolver {
+public class GuiceResolver extends ManagedBeanResolver
+{
public static final String KEY = "oam." + Injector.class.getName();
-
+
@Override
- public Object getValue(ELContext ctx, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
-
- if (base != null || !(property instanceof String))
+ public Object getValue(ELContext ctx, Object base, Object property) throws NullPointerException,
+ PropertyNotFoundException, ELException
+ {
+
+ if (base != null || !(property instanceof String))
return null;
if (property == null)
throw new PropertyNotFoundException();
- FacesContext fctx = (FacesContext) ctx.getContext(FacesContext.class);
-
- if(fctx == null)
+ FacesContext fctx = (FacesContext)ctx.getContext(FacesContext.class);
+
+ if (fctx == null)
return null;
-
+
ExternalContext ectx = fctx.getExternalContext();
-
- if (ectx == null ||
- ectx.getRequestMap().containsKey(property) ||
- ectx.getSessionMap().containsKey(property) ||
- ectx.getApplicationMap().containsKey(property) )
+
+ if (ectx == null || ectx.getRequestMap().containsKey(property) || ectx.getSessionMap().containsKey(property)
+ || ectx.getApplicationMap().containsKey(property))
return null;
-
+
ManagedBean managedBean = runtimeConfig(ctx).getManagedBean((String)property);
-
+
return managedBean == null ? null : getValue(ctx, ectx, managedBean.getManagedBeanClass());
}
- private Object getValue(ELContext ctx, ExternalContext ectx, Class managedBeanClass) {
-
- Injector injector = (Injector) ectx.getApplicationMap().get(KEY);
-
- if(injector == null)
- throw new FacesException("Could not find an instance of " + Injector.class.getName()
+ private Object getValue(ELContext ctx, ExternalContext ectx, Class<?> managedBeanClass)
+ {
+
+ Injector injector = (Injector)ectx.getApplicationMap().get(KEY);
+
+ if (injector == null)
+ throw new FacesException("Could not find an instance of " + Injector.class.getName()
+ " in application scope using key '" + KEY + "'");
-
+
Object value = injector.getInstance(managedBeanClass);
ctx.setPropertyResolved(true);
return value;
}
-}
\ No newline at end of file
+}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ManagedBeanResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ManagedBeanResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ManagedBeanResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ManagedBeanResolver.java Wed Jun 15 22:38:34 2011
@@ -18,283 +18,355 @@
*/
package org.apache.myfaces.el.unified.resolver;
-import java.beans.FeatureDescriptor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import org.apache.myfaces.config.ManagedBeanBuilder;
+import org.apache.myfaces.config.RuntimeConfig;
+import org.apache.myfaces.config.element.ManagedBean;
+import org.apache.myfaces.context.servlet.StartupServletExternalContextImpl;
+
import javax.el.ELContext;
import javax.el.ELException;
import javax.el.ELResolver;
import javax.el.PropertyNotFoundException;
import javax.el.PropertyNotWritableException;
+import javax.faces.FacesException;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.config.ManagedBeanBuilder;
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.config.element.ManagedBean;
+import java.beans.FeatureDescriptor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
/**
* See JSF 1.2 spec section 5.6.1.2
- *
+ *
* @author Stan Silvert
*/
-public class ManagedBeanResolver extends ELResolver {
+public class ManagedBeanResolver extends ELResolver
+{
private static final Log log = LogFactory.getLog(ManagedBeanResolver.class);
- private static final String BEANS_UNDER_CONSTRUCTION = "org.apache.myfaces.el.unified.resolver.managedbean.beansUnderConstruction";
-
+ private static final String BEANS_UNDER_CONSTRUCTION =
+ "org.apache.myfaces.el.unified.resolver.managedbean.beansUnderConstruction";
+
// adapted from Manfred's JSF 1.1 VariableResolverImpl
- protected static final Map s_standardScopes = new HashMap(16);
- static {
- s_standardScopes.put(
- "request",
- new Scope()
+ protected static final Map<String, Scope> s_standardScopes = new HashMap<String, Scope>(16);
+
+ static
+ {
+ s_standardScopes.put("request", new Scope()
+ {
+ public void put(FacesContext facesContext, ExternalContext extContext, String name, Object obj)
{
- public void put(ExternalContext extContext, String name, Object obj)
- {
- extContext.getRequestMap().put(name, obj);
- }
- });
- s_standardScopes.put(
- "session",
- new Scope()
+ extContext.getRequestMap().put(name, obj);
+ }
+ });
+
+ s_standardScopes.put("session", new Scope()
+ {
+ public void put(FacesContext facesContext, ExternalContext extContext, String name, Object obj)
{
- public void put(ExternalContext extContext, String name, Object obj)
- {
- extContext.getSessionMap().put(name, obj);
- }
- });
- s_standardScopes.put(
- "application",
- new Scope()
+ extContext.getSessionMap().put(name, obj);
+ }
+ });
+
+ s_standardScopes.put("application", new Scope()
+ {
+ public void put(FacesContext facesContext, ExternalContext extContext, String name, Object obj)
{
- public void put(ExternalContext extContext, String name, Object obj)
- {
- extContext.getApplicationMap().put(name, obj);
- }
- });
- s_standardScopes.put(
- "none",
- new Scope()
+ extContext.getApplicationMap().put(name, obj);
+ }
+ });
+
+ s_standardScopes.put("none", new Scope()
+ {
+ public void put(FacesContext facesContext, ExternalContext extContext, String name, Object obj)
{
- public void put(ExternalContext extContext, String name, Object obj)
- {
- // do nothing
- }
- });
+ // do nothing
+ }
+ });
}
/**
* Stores all scopes defined for this instance of <code>VariableResolver</code>
* <p>
- * Can store instances of <code>Scope</code> which have the ability to
- * dynamically resolve against ExternalContext for put operations.
+ * Can store instances of <code>Scope</code> which have the ability to dynamically resolve against ExternalContext
+ * for put operations.
* </p>
* <p>
- * WARNING: this implementation is not serialized as it is thread safe because
- * it does not update/add to _scopes after object initialization.
- * If you need to add your own scopes, either extend and add more
- * in an initialization block, or add proper sychronization
+ * WARNING: this implementation is not serialized as it is thread safe because it does not update/add to _scopes
+ * after object initialization. If you need to add your own scopes, either extend and add more in an initialization
+ * block, or add proper sychronization
* </p>
*/
- protected final Map _scopes = new HashMap(16);
+ protected final Map<String, Scope> _scopes = new HashMap<String, Scope>(16);
{
_scopes.putAll(s_standardScopes);
}
-
+
/**
- * RuntimeConfig is instantiated once per servlet and never changes--we can
- * safely cache it
+ * RuntimeConfig is instantiated once per servlet and never changes--we can safely cache it
*/
private RuntimeConfig runtimeConfig;
-
+
private ManagedBeanBuilder beanBuilder = new ManagedBeanBuilder();
-
+
/** Creates a new instance of ManagedBeanResolver */
- public ManagedBeanResolver() {
+ public ManagedBeanResolver()
+ {
}
+ @Override
public void setValue(final ELContext context, final Object base, final Object property, final Object value)
- throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
-
- if ( (base == null) && (property == null)) {
+ throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException
+ {
+
+ if ((base == null) && (property == null))
+ {
throw new PropertyNotFoundException();
}
-
+
}
+ @Override
public boolean isReadOnly(final ELContext context, final Object base, final Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
-
- if ( (base == null) && (property == null)) {
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+
+ if ((base == null) && (property == null))
+ {
throw new PropertyNotFoundException();
}
-
+
return false;
}
+ @Override
+ @SuppressWarnings("unchecked")
public Object getValue(final ELContext context, final Object base, final Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
-
- if (base != null) return null;
-
- if (property == null) {
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ // we only resolve ManagedBean instances, not properties of those
+ if (base != null)
+ {
+ return null;
+ }
+
+ if (property == null)
+ {
throw new PropertyNotFoundException();
}
+
+ final FacesContext facesContext = facesContext(context);
+ if (facesContext == null)
+ {
+ return null;
+ }
+ final ExternalContext extContext = facesContext.getExternalContext();
+ if (extContext == null)
+ {
+ return null;
+ }
+
+ final boolean startup = (extContext instanceof StartupServletExternalContextImpl);
- final ExternalContext extContext = externalContext(context);
-
- if (extContext == null) return null;
- if (extContext.getRequestMap().containsKey(property)) return null;
- if (extContext.getSessionMap().containsKey(property)) return null;
- if (extContext.getApplicationMap().containsKey(property)) return null;
-
- if ( !(property instanceof String) ) return null;
-
- final String strProperty = (String)property;
-
+ // request scope (not available at startup)
+ if (!startup)
+ {
+ if (extContext.getRequestMap().containsKey(property))
+ {
+ return null;
+ }
+ }
+
+ // session scope (not available at startup)
+ if (!startup)
+ {
+ if (extContext.getSessionMap().containsKey(property))
+ {
+ return null;
+ }
+ }
+
+ // application scope
+ if (extContext.getApplicationMap().containsKey(property))
+ {
+ return null;
+ }
+
+ // not found in standard scopes - get ManagedBean metadata object
+ // In order to get the metadata object, we need property to be the managed bean name (--> String)
+ if (!(property instanceof String))
+ {
+ return null;
+ }
+ final String strProperty = (String) property;
+
final ManagedBean managedBean = runtimeConfig(context).getManagedBean(strProperty);
Object beanInstance = null;
- if (managedBean != null) {
- FacesContext facesContext = facesContext(context);
+ if (managedBean != null)
+ {
context.setPropertyResolved(true);
+
beanInstance = createManagedBean(managedBean, facesContext);
}
-
+
return beanInstance;
}
-
- // Create a managed bean. If the scope of the bean is "none" then
- // return it right away. Otherwise store the bean in the appropriate
+
+ // Create a managed bean. If the scope of the bean is "none" then
+ // return it right away. Otherwise store the bean in the appropriate
// scope and return null.
//
// adapted from Manfred's JSF 1.1 VariableResolverImpl
- private Object createManagedBean(final ManagedBean managedBean,
- final FacesContext facesContext)
- throws ELException {
-
+ @SuppressWarnings("unchecked")
+ private Object createManagedBean(final ManagedBean managedBean, final FacesContext facesContext) throws ELException
+ {
+
final ExternalContext extContext = facesContext.getExternalContext();
final Map requestMap = extContext.getRequestMap();
-
+
// check for cyclic references
- List beansUnderConstruction = (List)requestMap.get(BEANS_UNDER_CONSTRUCTION);
- if (beansUnderConstruction == null) {
- beansUnderConstruction = new ArrayList();
+ List beansUnderConstruction = (List<String>) requestMap.get(BEANS_UNDER_CONSTRUCTION);
+ if (beansUnderConstruction == null)
+ {
+ beansUnderConstruction = new ArrayList<String>();
requestMap.put(BEANS_UNDER_CONSTRUCTION, beansUnderConstruction);
}
final String managedBeanName = managedBean.getManagedBeanName();
- if (beansUnderConstruction.contains(managedBeanName)) {
- throw new ELException( "Detected cyclic reference to managedBean " + managedBeanName);
+ if (beansUnderConstruction.contains(managedBeanName))
+ {
+ throw new ELException("Detected cyclic reference to managedBean " + managedBeanName);
}
beansUnderConstruction.add(managedBeanName);
-
+
Object obj = null;
- try {
+ try
+ {
obj = beanBuilder.buildManagedBean(facesContext, managedBean);
- } finally {
+ }
+ finally
+ {
beansUnderConstruction.remove(managedBeanName);
}
- putInScope(managedBean, extContext, obj);
-
+ putInScope(managedBean, facesContext, extContext, obj);
+
return obj;
}
-
- private void putInScope(final ManagedBean managedBean, final ExternalContext extContext, final Object obj) {
+
+ @SuppressWarnings("unchecked")
+ private void putInScope(final ManagedBean managedBean, final FacesContext facesContext,
+ final ExternalContext extContext, final Object obj)
+ {
final String managedBeanName = managedBean.getManagedBeanName();
-
- if (obj == null) {
+
+ if (obj == null)
+ {
if (log.isDebugEnabled())
log.debug("Variable '" + managedBeanName + "' could not be resolved.");
- } else {
-
+ }
+ else
+ {
final String scopeKey = managedBean.getManagedBeanScope();
// find the scope handler object
- final Scope scope = (Scope) _scopes.get(scopeKey);
- if (scope == null) {
+ final Scope scope = _scopes.get(scopeKey);
+ if (scope != null)
+ {
+ scope.put(facesContext, extContext, managedBeanName, obj);
+ }
+ else
+
+ {
log.error("Managed bean '" + managedBeanName + "' has illegal scope: " + scopeKey);
- } else {
- scope.put(extContext, managedBeanName, obj);
}
}
}
-
+
// get the FacesContext from the ELContext
- private static FacesContext facesContext(final ELContext context) {
+ private static FacesContext facesContext(final ELContext context)
+ {
return (FacesContext)context.getContext(FacesContext.class);
}
-
- private static ExternalContext externalContext(final ELContext context) {
- final FacesContext facesContext = facesContext(context);
-
- return facesContext != null ? facesContext.getExternalContext() : null;
- }
+ @Override
public Class<?> getType(final ELContext context, final Object base, final Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
-
- if ( (base == null) && (property == null)) {
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+
+ if ((base == null) && (property == null))
+ {
throw new PropertyNotFoundException();
}
-
+
return null;
}
- public Iterator getFeatureDescriptors(final ELContext context, final Object base) {
-
- if (base != null) return null;
-
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object base)
+ {
+
+ if (base != null)
+ return null;
+
final ArrayList<FeatureDescriptor> descriptors = new ArrayList<FeatureDescriptor>();
-
+
final Map<String, ManagedBean> managedBeans = runtimeConfig(context).getManagedBeans();
- for (Map.Entry<String, ManagedBean> managedBean : managedBeans.entrySet()) {
+ for (Map.Entry<String, ManagedBean> managedBean : managedBeans.entrySet())
+ {
descriptors.add(makeDescriptor(managedBean.getKey(), managedBean.getValue()));
}
-
+
return descriptors.iterator();
}
-
- private static FeatureDescriptor makeDescriptor(final String beanName, final ManagedBean managedBean) {
+
+ private static FeatureDescriptor makeDescriptor(final String beanName, final ManagedBean managedBean)
+ {
final FeatureDescriptor fd = new FeatureDescriptor();
fd.setValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
fd.setValue(ELResolver.TYPE, managedBean.getManagedBeanClass());
fd.setName(beanName);
fd.setDisplayName(beanName);
- fd.setShortDescription(managedBean.getDescription());
+ fd.setShortDescription(managedBean.getDescription());
fd.setExpert(false);
fd.setHidden(false);
fd.setPreferred(true);
return fd;
}
- protected RuntimeConfig runtimeConfig(final ELContext context) {
+ protected RuntimeConfig runtimeConfig(final ELContext context)
+ {
final FacesContext facesContext = facesContext(context);
-
+
// application-level singleton - we can safely cache this
- if (this.runtimeConfig == null) {
+ if (this.runtimeConfig == null)
+ {
this.runtimeConfig = RuntimeConfig.getCurrentInstance(facesContext.getExternalContext());
}
-
+
return runtimeConfig;
}
-
- public Class<?> getCommonPropertyType(final ELContext context, final Object base) {
-
- if (base != null) return null;
-
- return Object.class;
+
+ @Override
+ public Class<?> getCommonPropertyType(final ELContext context, final Object base)
+ {
+ if (base == null)
+ {
+ return Object.class;
+ }
+
+ return null;
}
-
- interface Scope {
- public void put(ExternalContext extContext, String name, Object obj);
+
+ interface Scope
+ {
+ public void put(FacesContext facesContext, ExternalContext extContext, String name, Object obj);
}
-
}
Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java?rev=1136229&r1=1136228&r2=1136229&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java Wed Jun 15 22:38:34 2011
@@ -35,135 +35,174 @@ import org.apache.myfaces.config.Runtime
/**
* See JSF 1.2 spec section 5.6.1.4
- *
+ *
* @author Stan Silvert
*/
-public final class ResourceBundleResolver extends ELResolver {
-
+public final class ResourceBundleResolver extends ELResolver
+{
+
/**
- * RuntimeConfig is instantiated once per servlet and never changes--we can
- * safely cache it
+ * RuntimeConfig is instantiated once per servlet and never changes--we can safely cache it
*/
private RuntimeConfig runtimeConfig;
-
+
/** Creates a new instance of ResourceBundleResolver */
- public ResourceBundleResolver() {
+ public ResourceBundleResolver()
+ {
}
+ @Override
public void setValue(final ELContext context, final Object base, final Object property, final Object value)
- throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
-
- if ((base == null) && (property == null)) throw new PropertyNotFoundException();
+ throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException
+ {
+
+ if ((base == null) && (property == null))
+ throw new PropertyNotFoundException();
+
+ if (!(property instanceof String))
+ return;
- if (!(property instanceof String)) return;
-
final ResourceBundle bundle = getResourceBundle(context, (String)property);
-
- if (bundle != null) {
+
+ if (bundle != null)
+ {
throw new PropertyNotWritableException("ResourceBundles are read-only");
}
}
+ @Override
public boolean isReadOnly(final ELContext context, final Object base, final Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
-
- if (base != null) return false;
- if (property == null) throw new PropertyNotFoundException();
- if (!(property instanceof String)) return false;
-
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+
+ if (base != null)
+ return false;
+ if (property == null)
+ throw new PropertyNotFoundException();
+ if (!(property instanceof String))
+ return false;
+
final ResourceBundle bundle = getResourceBundle(context, (String)property);
-
- if (bundle != null) {
+
+ if (bundle != null)
+ {
context.setPropertyResolved(true);
return true;
}
-
+
return false;
}
+ @Override
public Object getValue(final ELContext context, final Object base, final Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
-
- if (base != null) return null;
- if (property == null) throw new PropertyNotFoundException();
- if (!(property instanceof String)) return null;
-
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+
+ if (base != null)
+ return null;
+ if (property == null)
+ throw new PropertyNotFoundException();
+ if (!(property instanceof String))
+ return null;
+
final ResourceBundle bundle = getResourceBundle(context, (String)property);
-
- if (bundle != null) {
+
+ if (bundle != null)
+ {
context.setPropertyResolved(true);
return bundle;
}
-
+
return null;
}
-
+
+ @Override
public Class<?> getType(final ELContext context, final Object base, final Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
-
- if (base != null) return null;
- if (property == null) throw new PropertyNotFoundException();
- if (!(property instanceof String)) return null;
-
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+
+ if (base != null)
+ return null;
+ if (property == null)
+ throw new PropertyNotFoundException();
+ if (!(property instanceof String))
+ return null;
+
final ResourceBundle bundle = getResourceBundle(context, (String)property);
-
- if (bundle != null) {
+
+ if (bundle != null)
+ {
context.setPropertyResolved(true);
return ResourceBundle.class;
}
-
+
return null;
}
- public Iterator<FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object base) {
-
- if (base != null) return null;
-
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object base)
+ {
+
+ if (base != null)
+ return null;
+
final ArrayList<FeatureDescriptor> descriptors = new ArrayList<FeatureDescriptor>();
-
- final Map<String, org.apache.myfaces.config.impl.digester.elements.ResourceBundle> resourceBundles = runtimeConfig(context).getResourceBundles();
-
- for (org.apache.myfaces.config.impl.digester.elements.ResourceBundle resourceBundle : resourceBundles.values()) {
+
+ final Map<String, org.apache.myfaces.config.impl.digester.elements.ResourceBundle> resourceBundles =
+ runtimeConfig(context).getResourceBundles();
+
+ for (org.apache.myfaces.config.impl.digester.elements.ResourceBundle resourceBundle : resourceBundles.values())
+ {
descriptors.add(makeDescriptor(resourceBundle));
}
-
+
return descriptors.iterator();
}
- public Class<?> getCommonPropertyType(final ELContext context, final Object base) {
-
- if (base != null) return null;
-
+ @Override
+ public Class<?> getCommonPropertyType(final ELContext context, final Object base)
+ {
+
+ if (base != null)
+ return null;
+
return String.class;
}
-
+
// get the FacesContext from the ELContext
- private static FacesContext facesContext(final ELContext context) {
+ private static FacesContext facesContext(final ELContext context)
+ {
return (FacesContext)context.getContext(FacesContext.class);
}
- private static ResourceBundle getResourceBundle(final ELContext context, final String property) {
+ private static ResourceBundle getResourceBundle(final ELContext context, final String property)
+ {
final FacesContext facesContext = facesContext(context);
- if (facesContext != null) {
+ if (facesContext != null)
+ {
final Application application = facesContext.getApplication();
return application.getResourceBundle(facesContext, property);
}
-
+
return null;
}
-
- protected RuntimeConfig runtimeConfig(ELContext context) {
+
+ protected RuntimeConfig runtimeConfig(ELContext context)
+ {
final FacesContext facesContext = facesContext(context);
-
+
// application-level singleton - we can safely cache this
- if (this.runtimeConfig == null) {
+ if (this.runtimeConfig == null)
+ {
this.runtimeConfig = RuntimeConfig.getCurrentInstance(facesContext.getExternalContext());
}
-
+
return runtimeConfig;
}
- private static FeatureDescriptor makeDescriptor(org.apache.myfaces.config.impl.digester.elements.ResourceBundle bundle) {
+ private static FeatureDescriptor makeDescriptor(
+ org.apache.myfaces.config.impl.digester.elements.ResourceBundle bundle)
+ {
final FeatureDescriptor fd = new FeatureDescriptor();
fd.setValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
fd.setName(bundle.getVar());