struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r437675 - /struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InsertTag.java
Date Mon, 28 Aug 2006 11:52:22 GMT
Author: apetrelli
Date: Mon Aug 28 04:52:21 2006
New Revision: 437675

URL: http://svn.apache.org/viewvc?rev=437675&view=rev
Log:
SB-38
Now the tag check if a ComponentContext has been registered and, if there is one, uses it
to take an attribute value.
This way the NullPointerException will not be thrown.

Modified:
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InsertTag.java

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InsertTag.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InsertTag.java?rev=437675&r1=437674&r2=437675&view=diff
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InsertTag.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InsertTag.java
Mon Aug 28 04:52:21 2006
@@ -437,7 +437,12 @@
 	 * processDefinitionName()
 	 */
 	public TagHandler processName(String name) throws JspException {
-		Object attrValue = getCurrentContext().getAttribute(name);
+        Object attrValue = null;
+        ComponentContext context = getCurrentContext();
+        
+        if (context != null) {
+            attrValue = context.getAttribute(name);
+        }
 
 		if (attrValue != null && attrValue instanceof ComponentAttribute) {
                     return processTypedAttribute((ComponentAttribute) attrValue);
@@ -559,7 +564,12 @@
 	 * @throws JspException - Throws by underlying nested call to processDefinitionName()
 	 */
 	public TagHandler processAttribute(String name) throws JspException {
-            Object attrValue = getCurrentContext().getAttribute(name);
+            Object attrValue = null;
+            ComponentContext context = getCurrentContext();
+            
+            if (context != null) {
+                attrValue = context.getAttribute(name);
+            }
 
             if (attrValue == null) {
                     throw new JspException(



Mime
View raw message