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/07/23 19:37:26 UTC
svn commit: r1150175 -
/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/
Author: lu4242
Date: Sat Jul 23 17:37:25 2011
New Revision: 1150175
URL: http://svn.apache.org/viewvc?rev=1150175&view=rev
Log:
MYFACES-3202 Improve EL Exceptions wrapping (thanks to Martin Koci for provide this patch)
Added:
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAware.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareELException.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareExceptionWrapper.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareMethodNotFoundException.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotFoundException.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotWritableException.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultContextAwareELException.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationAware.java
Modified:
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagMethodExpression.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpression.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpressionUEL.java
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAware.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAware.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAware.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.el.Expression;
+import javax.faces.view.Location;
+import javax.faces.view.facelets.TagAttribute;
+
+/**
+ * Identification inferface for types that know about {@link Location} and XML attribute name/value pair.
+ *
+ * <ol>
+ * <li>Location - location instance - see {@link LocationAware}</li>
+ * <li>expressionString - expression String {@link Expression#getExpressionString()}</li>
+ * <li>qName - the qualified name for attribute {@link TagAttribute#getQName()}</li>
+ * </ol>
+ *
+ * If type implements this interface, we can say that it knows where instance implementing this interface is located in facelets view (line/column)
+ * and what XML attribute (name/value pair) makes it.
+ *
+ * @author martinkoci
+ */
+public interface ContextAware extends LocationAware {
+
+
+ /**
+ * @return expression string, for example "#{bean.actionMethod}" or "success"
+ */
+ public abstract String getExpressionString();
+
+ /**
+ * @return qName of XML attribute, for example "action" or "value"
+ */
+ public abstract String getQName();
+
+}
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareELException.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareELException.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareELException.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareELException.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.el.ELException;
+import javax.faces.FacesWrapper;
+import javax.faces.view.Location;
+
+/**
+ * Implementation of types {@link ELException}, {@link ContextAware} and {@link FacesWrapper}
+ *
+ * @author martinkoci
+ *
+ * @see ContextAware
+ */
+public class ContextAwareELException extends ELException implements ContextAwareExceptionWrapper {
+
+ private ContextAwareExceptionWrapper _delegate;
+
+ public ContextAwareELException(Location location, String expressionString,
+ String qName, Throwable wrapped) {
+ super(wrapped);
+ _delegate = new DefaultContextAwareELException(location, expressionString, qName, wrapped);
+ }
+
+ public String getExpressionString() {
+ return _delegate.getExpressionString();
+ }
+
+ public String getQName() {
+ return _delegate.getQName();
+ }
+
+ public Throwable getWrapped() {
+ return _delegate.getWrapped();
+ }
+
+ public Location getLocation() {
+ return _delegate.getLocation();
+ }
+}
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareExceptionWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareExceptionWrapper.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareExceptionWrapper.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareExceptionWrapper.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.faces.FacesWrapper;
+
+/**
+ * A exception wrapper that "knows" interesting info about place where problem occured.
+
+ * @author martinkoci
+ *
+ * @see ContextAware
+ * @see FacesWrapper
+ */
+public interface ContextAwareExceptionWrapper extends FacesWrapper<Throwable>, ContextAware {
+
+}
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareMethodNotFoundException.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareMethodNotFoundException.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareMethodNotFoundException.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwareMethodNotFoundException.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.el.MethodNotFoundException;
+import javax.faces.FacesWrapper;
+import javax.faces.view.Location;
+
+/**
+ * Implementation of types {@link MethodNotFoundException}, {@link ContextAware} and {@link FacesWrapper}
+ *
+ * @author martinkoci
+ *
+ * @see ContextAware
+ */
+public class ContextAwareMethodNotFoundException extends MethodNotFoundException implements ContextAwareExceptionWrapper {
+
+ private ContextAwareExceptionWrapper _delegate;
+
+ public ContextAwareMethodNotFoundException(Location location,
+ String expressionString, String qName, Throwable wrapped) {
+ super(wrapped);
+ _delegate = new DefaultContextAwareELException(location, expressionString, qName, wrapped);
+ }
+
+ public Throwable getWrapped() {
+ return _delegate.getWrapped();
+ }
+
+ public Location getLocation() {
+ return _delegate.getLocation();
+ }
+
+ public String getExpressionString() {
+ return _delegate.getExpressionString();
+ }
+
+ public String getQName() {
+ return _delegate.getQName();
+ }
+
+}
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotFoundException.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotFoundException.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotFoundException.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotFoundException.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.el.PropertyNotFoundException;
+import javax.faces.FacesWrapper;
+import javax.faces.view.Location;
+
+/**
+ * Implementation of types {@link PropertyNotFoundException}, {@link ContextAware} and {@link FacesWrapper}
+ *
+ * @author martinkoci
+ *
+ * @see ContextAware
+ */
+public class ContextAwarePropertyNotFoundException extends javax.el.PropertyNotFoundException implements ContextAwareExceptionWrapper {
+
+ private ContextAwareExceptionWrapper _delegate;
+
+ public ContextAwarePropertyNotFoundException(Location location,
+ String expressionString, String qName,
+ Throwable wrapped) {
+ super(wrapped);
+ _delegate = new DefaultContextAwareELException(location, expressionString, qName, wrapped);
+ }
+
+ public Location getLocation() {
+ return _delegate.getLocation();
+ }
+
+ public String getExpressionString() {
+ return _delegate.getExpressionString();
+ }
+
+ public String getQName() {
+ return _delegate.getQName();
+ }
+
+ public Throwable getWrapped() {
+ return _delegate.getWrapped();
+ }
+
+
+}
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotWritableException.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotWritableException.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotWritableException.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ContextAwarePropertyNotWritableException.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.el.PropertyNotWritableException;
+import javax.faces.FacesWrapper;
+import javax.faces.view.Location;
+
+/**
+ * Implementation of types {@link PropertyNotWritableException}, {@link ContextAware} and {@link FacesWrapper}
+ *
+ * @author martinkoci
+ *
+ * @see ContextAware
+ */
+public class ContextAwarePropertyNotWritableException extends javax.el.PropertyNotWritableException implements ContextAwareExceptionWrapper {
+
+ private ContextAwareExceptionWrapper _delegate;
+
+ public ContextAwarePropertyNotWritableException(Location location,
+ String expressionString, String qName,
+ Throwable wrapped) {
+ super(wrapped);
+ _delegate = new DefaultContextAwareELException(location, expressionString, qName, wrapped);
+ }
+
+ public String getExpressionString() {
+ return _delegate.getExpressionString();
+ }
+
+ public String getQName() {
+ return _delegate.getQName();
+ }
+
+ public Throwable getWrapped() {
+ return _delegate.getWrapped();
+ }
+
+ public Location getLocation() {
+ return _delegate.getLocation();
+ }
+
+}
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultContextAwareELException.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultContextAwareELException.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultContextAwareELException.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultContextAwareELException.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.faces.view.Location;
+
+/**
+ * Default implementation of {@link ContextAwareExceptionWrapper}, used for delegation
+ *
+ * @author martinkoci
+ */
+public class DefaultContextAwareELException implements ContextAwareExceptionWrapper {
+
+ private Location _location;
+
+ private String _expressionString;
+
+ private String _qName;
+
+ private Throwable _wrapped;
+
+ public DefaultContextAwareELException(Location location,
+ String expressionString, String qName,
+ Throwable wrapped) {
+ _location = location;
+ _expressionString = expressionString;
+ _qName = qName;
+ _wrapped = wrapped;
+ }
+
+ public Location getLocation() {
+ return _location;
+ }
+
+ public String getExpressionString() {
+ return _expressionString;
+ }
+
+ public String getQName() {
+ return _qName;
+ }
+
+ public Throwable getWrapped() {
+ return _wrapped;
+ }
+}
Added: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationAware.java?rev=1150175&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationAware.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationAware.java Sat Jul 23 17:37:25 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.el;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.Location;
+
+/**
+ * Identification inferface for types that know about {@link Location}.
+ *
+ * If type implements this interface, we can say that it knows where instance implementing this interfaces is located in facelets view.
+ *
+ * {@link UIComponent} is LocationAware-like, because it knows it's Location: {@link UIComponent#VIEW_LOCATION_KEY}
+ *
+ * @author martinkoci
+ */
+public interface LocationAware {
+
+ /**
+ * @return the {@link Location} instance where this object exists/is related to
+ */
+ Location getLocation();
+
+}
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java?rev=1150175&r1=1150174&r2=1150175&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java Sat Jul 23 17:37:25 2011
@@ -47,7 +47,7 @@ import javax.faces.view.Location;
* @version $Revision$ $Date$
*/
public class LocationMethodExpression extends MethodExpression
- implements FacesWrapper<MethodExpression>, Externalizable
+ implements FacesWrapper<MethodExpression>, Externalizable, LocationAware
{
private static final long serialVersionUID = 1634644578979226893L;
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagMethodExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagMethodExpression.java?rev=1150175&r1=1150174&r2=1150175&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagMethodExpression.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagMethodExpression.java Sat Jul 23 17:37:25 2011
@@ -29,6 +29,8 @@ import javax.el.MethodExpression;
import javax.el.MethodInfo;
import javax.el.MethodNotFoundException;
import javax.el.PropertyNotFoundException;
+import javax.faces.FacesWrapper;
+import javax.faces.view.Location;
import javax.faces.view.facelets.TagAttribute;
/**
@@ -37,42 +39,50 @@ import javax.faces.view.facelets.TagAttr
* @author Jacob Hookom
* @version $Id: TagMethodExpression.java,v 1.7 2008/07/13 19:01:43 rlubke Exp $
*/
-public final class TagMethodExpression extends MethodExpression implements Externalizable
+public final class TagMethodExpression extends MethodExpression implements Externalizable, FacesWrapper<MethodExpression>, ContextAware
{
private static final long serialVersionUID = 1L;
- private String attr;
- private MethodExpression orig;
+ private MethodExpression _wrapped;
+
+ private Location _location;
+
+ private String _qName;
public TagMethodExpression()
{
super();
}
- public TagMethodExpression(TagAttribute attr, MethodExpression orig)
+ public TagMethodExpression(TagAttribute tagAttribute, MethodExpression methodExpression)
{
- this.attr = attr.toString();
- this.orig = orig;
+ _location = tagAttribute.getLocation();
+ _qName = tagAttribute.getQName();
+ _wrapped = methodExpression;
}
public MethodInfo getMethodInfo(ELContext context)
{
try
{
- return this.orig.getMethodInfo(context);
+ return _wrapped.getMethodInfo(context);
}
catch (PropertyNotFoundException pnfe)
{
- throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
+ throw new ContextAwarePropertyNotFoundException(getLocation(), getExpressionString(), getQName(), pnfe);
}
catch (MethodNotFoundException mnfe)
{
- throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause());
+ throw new ContextAwareMethodNotFoundException(getLocation(), getExpressionString(), getQName(), mnfe);
}
catch (ELException e)
{
- throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
+ }
+ catch (Exception e)
+ {
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
}
}
@@ -80,56 +90,74 @@ public final class TagMethodExpression e
{
try
{
- return this.orig.invoke(context, params);
+ return _wrapped.invoke(context, params);
}
catch (PropertyNotFoundException pnfe)
{
- throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
+ throw new ContextAwarePropertyNotFoundException(getLocation(), getExpressionString(), getQName(), pnfe);
}
catch (MethodNotFoundException mnfe)
{
- throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause());
+ throw new ContextAwareMethodNotFoundException(getLocation(), getExpressionString(), getQName(), mnfe);
}
catch (ELException e)
{
- throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
+ }
+ catch (Exception e)
+ {
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
}
}
public String getExpressionString()
{
- return this.orig.getExpressionString();
+ return _wrapped.getExpressionString();
}
public boolean equals(Object obj)
{
- return this.orig.equals(obj);
+ return _wrapped.equals(obj);
}
public int hashCode()
{
- return this.orig.hashCode();
+ return _wrapped.hashCode();
}
public boolean isLiteralText()
{
- return this.orig.isLiteralText();
+ return _wrapped.isLiteralText();
}
public void writeExternal(ObjectOutput out) throws IOException
{
- out.writeObject(this.orig);
- out.writeUTF(this.attr);
+ out.writeObject(_wrapped);
+ out.writeObject(_location);
+ out.writeUTF(_qName);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- this.orig = (MethodExpression) in.readObject();
- this.attr = in.readUTF();
+ _wrapped = (MethodExpression) in.readObject();
+ _location = (Location) in.readObject();
+ _qName = in.readUTF();
}
public String toString()
{
- return this.attr + ": " + this.orig;
+ return _location + ": " + _wrapped;
+ }
+
+ public Location getLocation() {
+ return _location;
+ }
+
+ public String getQName() {
+ return _qName;
+ }
+
+ public MethodExpression getWrapped() {
+ return _wrapped;
}
}
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpression.java?rev=1150175&r1=1150174&r2=1150175&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpression.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpression.java Sat Jul 23 17:37:25 2011
@@ -29,6 +29,7 @@ import javax.el.PropertyNotFoundExceptio
import javax.el.PropertyNotWritableException;
import javax.el.ValueExpression;
import javax.faces.FacesWrapper;
+import javax.faces.view.Location;
import javax.faces.view.facelets.TagAttribute;
/**
@@ -37,44 +38,51 @@ import javax.faces.view.facelets.TagAttr
* @author Jacob Hookom
* @version $Id: TagValueExpression.java,v 1.7 2008/07/13 19:01:42 rlubke Exp $
*/
-public class TagValueExpression extends ValueExpression implements Externalizable, FacesWrapper<ValueExpression>
+public class TagValueExpression extends ValueExpression implements Externalizable, FacesWrapper<ValueExpression>, ContextAware
{
private static final long serialVersionUID = 1L;
- // orig and attr need to be available in TagValueExpressionUEL
- ValueExpression orig;
- String attr;
+ private ValueExpression _wrapped;
+
+ private Location _location;
+
+ private String _qName;
public TagValueExpression()
{
super();
}
- public TagValueExpression(TagAttribute attr, ValueExpression orig)
+ public TagValueExpression(TagAttribute tagAttribute, ValueExpression valueExpression)
{
- this.attr = attr.toString();
- this.orig = orig;
+ _location = tagAttribute.getLocation();
+ _qName = tagAttribute.getQName();
+ _wrapped = valueExpression;
}
public Class<?> getExpectedType()
{
- return this.orig.getExpectedType();
+ return _wrapped.getExpectedType();
}
public Class<?> getType(ELContext context)
{
try
{
- return this.orig.getType(context);
+ return _wrapped.getType(context);
}
catch (PropertyNotFoundException pnfe)
{
- throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
+ throw new ContextAwarePropertyNotFoundException(getLocation(), getExpressionString(), getQName(), pnfe);
}
catch (ELException e)
{
- throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
+ }
+ catch (Exception e)
+ {
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
}
}
@@ -82,15 +90,19 @@ public class TagValueExpression extends
{
try
{
- return this.orig.getValue(context);
+ return _wrapped.getValue(context);
}
catch (PropertyNotFoundException pnfe)
{
- throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
+ throw new ContextAwarePropertyNotFoundException(getLocation(), getExpressionString(), getQName(), pnfe);
}
catch (ELException e)
{
- throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
+ }
+ catch (Exception e)
+ {
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
}
}
@@ -98,77 +110,96 @@ public class TagValueExpression extends
{
try
{
- return this.orig.isReadOnly(context);
+ return _wrapped.isReadOnly(context);
}
catch (PropertyNotFoundException pnfe)
{
- throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
+ throw new ContextAwarePropertyNotFoundException(getLocation(), getExpressionString(), getQName(), pnfe);
}
catch (ELException e)
{
- throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
+ }
+ catch (Exception e)
+ {
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
}
+
}
public void setValue(ELContext context, Object value)
{
try
{
- this.orig.setValue(context, value);
+ _wrapped.setValue(context, value);
}
catch (PropertyNotFoundException pnfe)
{
- throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
+ throw new ContextAwarePropertyNotFoundException(getLocation(), getExpressionString(), getQName(), pnfe);
}
catch (PropertyNotWritableException pnwe)
{
- throw new PropertyNotWritableException(this.attr + ": " + pnwe.getMessage(), pnwe.getCause());
+ throw new ContextAwarePropertyNotWritableException(getLocation(), getExpressionString(), getQName(), pnwe);
}
catch (ELException e)
{
- throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
+ }
+ catch (Exception e)
+ {
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
}
}
public boolean equals(Object obj)
{
- return this.orig.equals(obj);
+ return _wrapped.equals(obj);
}
public String getExpressionString()
{
- return this.orig.getExpressionString();
+ return _wrapped.getExpressionString();
}
public int hashCode()
{
- return this.orig.hashCode();
+ return _wrapped.hashCode();
}
public boolean isLiteralText()
{
- return this.orig.isLiteralText();
+ return _wrapped.isLiteralText();
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- this.orig = (ValueExpression) in.readObject();
- this.attr = in.readUTF();
+ _wrapped = (ValueExpression) in.readObject();
+ _location = (Location) in.readObject();
+ _qName = in.readUTF();
}
public void writeExternal(ObjectOutput out) throws IOException
{
- out.writeObject(this.orig);
- out.writeUTF(this.attr);
+ out.writeObject(_wrapped);
+ out.writeObject(_location);
+ out.writeUTF(_qName);
}
public String toString()
{
- return this.attr + ": " + this.orig;
+ return _location + ": " + _wrapped;
}
public ValueExpression getWrapped()
{
- return orig;
+ return _wrapped;
+ }
+
+ public Location getLocation() {
+ return _location;
+ }
+
+ public String getQName() {
+ return _qName;
}
}
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpressionUEL.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpressionUEL.java?rev=1150175&r1=1150174&r2=1150175&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpressionUEL.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/TagValueExpressionUEL.java Sat Jul 23 17:37:25 2011
@@ -49,15 +49,18 @@ public class TagValueExpressionUEL exten
{
try
{
- return this.orig.getValueReference(context);
+ return getWrapped().getValueReference(context);
}
catch (PropertyNotFoundException pnfe)
{
- throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
+ throw new ContextAwarePropertyNotFoundException(getLocation(), getExpressionString(), getQName() , pnfe);
}
catch (ELException e)
{
- throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
+ }
+ catch (Exception e) {
+ throw new ContextAwareELException(getLocation(), getExpressionString(), getQName(), e);
}
}