You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jb...@apache.org on 2010/11/20 18:57:49 UTC

svn commit: r1037279 [5/10] - in /tomcat/taglibs/standard/trunk/impl: ./ src/main/java/org/apache/taglibs/standard/ src/main/java/org/apache/taglibs/standard/functions/ src/main/java/org/apache/taglibs/standard/tag/common/core/ src/main/java/org/apache...

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.common.xml;
 
@@ -28,8 +28,8 @@ import org.apache.taglibs.standard.resou
  * <p>Support for tag handlers for &lt;param&gt;, the XML parameter
  * subtag for &lt;transformt&lt;.</p>
  *
- * @see TransformSupport
  * @author Shawn Bayern
+ * @see TransformSupport
  */
 
 public abstract class ParamSupport extends BodyTagSupport {
@@ -44,13 +44,13 @@ public abstract class ParamSupport exten
     // Constructor and initialization
 
     public ParamSupport() {
-	super();
-	init();
+        super();
+        init();
     }
 
     private void init() {
-	name = null;
-	value = null;
+        name = null;
+        value = null;
     }
 
 
@@ -58,28 +58,32 @@ public abstract class ParamSupport exten
     // Tag logic
 
     // simply send our name and value to our parent <transform> tag
+
     @Override
     public int doEndTag() throws JspException {
-	Tag t = findAncestorWithClass(this, TransformSupport.class);
-	if (t == null)
-	    throw new JspTagException(
-		Resources.getMessage("PARAM_OUTSIDE_TRANSFORM"));
-	TransformSupport parent = (TransformSupport) t;
-
-	Object value = this.value;
-	if (value == null) {
-            if (bodyContent == null || bodyContent.getString() == null)
+        Tag t = findAncestorWithClass(this, TransformSupport.class);
+        if (t == null) {
+            throw new JspTagException(
+                    Resources.getMessage("PARAM_OUTSIDE_TRANSFORM"));
+        }
+        TransformSupport parent = (TransformSupport) t;
+
+        Object value = this.value;
+        if (value == null) {
+            if (bodyContent == null || bodyContent.getString() == null) {
                 value = "";
-            else
+            } else {
                 value = bodyContent.getString().trim();
+            }
         }
-	parent.addParameter(name, value);
-	return EVAL_PAGE;
+        parent.addParameter(name, value);
+        return EVAL_PAGE;
     }
 
     // Releases any resources we may have (or inherit)
+
     @Override
     public void release() {
-	init();
+        init();
     }
 }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.common.xml;
 
@@ -60,15 +60,15 @@ public abstract class ParseSupport exten
 
     protected Object xml;                          // 'xml' attribute
     protected String systemId;                     // 'systemId' attribute
-    protected XMLFilter filter;			   // 'filter' attribute
+    protected XMLFilter filter;               // 'filter' attribute
 
     //*********************************************************************
     // Private state
 
     private String var;                            // 'var' attribute
-    private String varDom;			   // 'varDom' attribute
-    private int scope;				   // processed 'scope' attr
-    private int scopeDom;			   // processed 'scopeDom' attr
+    private String varDom;               // 'varDom' attribute
+    private int scope;                   // processed 'scope' attr
+    private int scopeDom;               // processed 'scopeDom' attr
 
     // state in support of XML parsing...
     private DocumentBuilderFactory dbf;
@@ -81,21 +81,21 @@ public abstract class ParseSupport exten
     // Constructor and initialization
 
     public ParseSupport() {
-	super();
-	init();
+        super();
+        init();
     }
 
     private void init() {
-	var = varDom = null;
-	xml = null;
-	systemId = null;
-	filter = null;
-	dbf = null;
-	db = null;
-	tf = null;
-	th = null;
-	scope = PageContext.PAGE_SCOPE;
-	scopeDom = PageContext.PAGE_SCOPE;
+        var = varDom = null;
+        xml = null;
+        systemId = null;
+        filter = null;
+        dbf = null;
+        db = null;
+        tf = null;
+        th = null;
+        scope = PageContext.PAGE_SCOPE;
+        scopeDom = PageContext.PAGE_SCOPE;
     }
 
 
@@ -103,87 +103,97 @@ public abstract class ParseSupport exten
     // Tag logic
 
     // parse 'source' or body, storing result in 'var'
+
     @Override
     public int doEndTag() throws JspException {
-      try {
-	
-	// set up our DocumentBuilder
-        if (dbf == null) {
-            dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            dbf.setValidating(false);
-        }
-        db = dbf.newDocumentBuilder();
+        try {
 
-	// if we've gotten a filter, set up a transformer to support it
-	if (filter != null) {
-            if (tf == null)
-                tf = TransformerFactory.newInstance();
-            if (!tf.getFeature(SAXTransformerFactory.FEATURE))
+            // set up our DocumentBuilder
+            if (dbf == null) {
+                dbf = DocumentBuilderFactory.newInstance();
+                dbf.setNamespaceAware(true);
+                dbf.setValidating(false);
+            }
+            db = dbf.newDocumentBuilder();
+
+            // if we've gotten a filter, set up a transformer to support it
+            if (filter != null) {
+                if (tf == null) {
+                    tf = TransformerFactory.newInstance();
+                }
+                if (!tf.getFeature(SAXTransformerFactory.FEATURE)) {
+                    throw new JspTagException(
+                            Resources.getMessage("PARSE_NO_SAXTRANSFORMER"));
+                }
+                SAXTransformerFactory stf = (SAXTransformerFactory) tf;
+                th = stf.newTransformerHandler();
+            }
+
+            // produce a Document by parsing whatever the attributes tell us to use
+            Document d;
+            Object xmlText = this.xml;
+            if (xmlText == null) {
+                // if the attribute was specified, use the body as 'xml'
+                if (bodyContent != null && bodyContent.getString() != null) {
+                    xmlText = bodyContent.getString().trim();
+                } else {
+                    xmlText = "";
+                }
+            }
+            if (xmlText instanceof String) {
+                d = parseStringWithFilter((String) xmlText, filter);
+            } else if (xmlText instanceof Reader) {
+                d = parseReaderWithFilter((Reader) xmlText, filter);
+            } else {
                 throw new JspTagException(
-		    Resources.getMessage("PARSE_NO_SAXTRANSFORMER"));
-            SAXTransformerFactory stf = (SAXTransformerFactory) tf;
-            th = stf.newTransformerHandler();
-	}
-
-	// produce a Document by parsing whatever the attributes tell us to use
-	Document d;
-	Object xmlText = this.xml;
-	if (xmlText == null) {
-	    // if the attribute was specified, use the body as 'xml'
-	    if (bodyContent != null && bodyContent.getString() != null)
-		xmlText = bodyContent.getString().trim();
-	    else
-		xmlText = "";
-	}
-	if (xmlText instanceof String)
-	    d = parseStringWithFilter((String) xmlText, filter);
-	else if (xmlText instanceof Reader)
-	    d = parseReaderWithFilter((Reader) xmlText, filter);
-	else
-	    throw new JspTagException(
-	        Resources.getMessage("PARSE_INVALID_SOURCE"));
-
-	// we've got a Document object; store it out as appropriate
-	// (let any exclusivity or other constraints be enforced by TEI/TLV)
-	if (var != null)
-	    pageContext.setAttribute(var, d, scope);
-	if (varDom != null)
-	    pageContext.setAttribute(varDom, d, scopeDom);
-
-	return EVAL_PAGE;
-      } catch (SAXException ex) {
-	throw new JspException(ex);
-      } catch (IOException ex) {
-	throw new JspException(ex);
-      } catch (ParserConfigurationException ex) {
-	throw new JspException(ex);
-      } catch (TransformerConfigurationException ex) {
-	throw new JspException(ex);
-      }
+                        Resources.getMessage("PARSE_INVALID_SOURCE"));
+            }
+
+            // we've got a Document object; store it out as appropriate
+            // (let any exclusivity or other constraints be enforced by TEI/TLV)
+            if (var != null) {
+                pageContext.setAttribute(var, d, scope);
+            }
+            if (varDom != null) {
+                pageContext.setAttribute(varDom, d, scopeDom);
+            }
+
+            return EVAL_PAGE;
+        } catch (SAXException ex) {
+            throw new JspException(ex);
+        } catch (IOException ex) {
+            throw new JspException(ex);
+        } catch (ParserConfigurationException ex) {
+            throw new JspException(ex);
+        } catch (TransformerConfigurationException ex) {
+            throw new JspException(ex);
+        }
     }
 
     // Releases any resources we may have (or inherit)
+
     @Override
     public void release() {
-	init();
+        init();
     }
 
 
     //*********************************************************************
     // Private utility methods
 
-    /** Parses the given InputSource after, applying the given XMLFilter. */
+    /**
+     * Parses the given InputSource after, applying the given XMLFilter.
+     */
     private Document parseInputSourceWithFilter(InputSource s, XMLFilter f)
             throws SAXException, IOException {
-	if (f != null) {
+        if (f != null) {
             // prepare an output Document
             Document o = db.newDocument();
 
             // use TrAX to adapt SAX events to a Document object
             th.setResult(new DOMResult(o));
             XMLReader xr = XMLReaderFactory.createXMLReader();
-	    xr.setEntityResolver(new JstlEntityResolver(pageContext));
+            xr.setEntityResolver(new JstlEntityResolver(pageContext));
             //   (note that we overwrite the filter's parent.  this seems
             //    to be expected usage.  we could cache and reset the old
             //    parent, but you can't setParent(null), so this wouldn't
@@ -192,107 +202,132 @@ public abstract class ParseSupport exten
             f.setContentHandler(th);
             f.parse(s);
             return o;
-	} else
-	    return parseInputSource(s);	
+        } else {
+            return parseInputSource(s);
+        }
     }
 
-    /** Parses the given Reader after applying the given XMLFilter. */
+    /**
+     * Parses the given Reader after applying the given XMLFilter.
+     */
     private Document parseReaderWithFilter(Reader r, XMLFilter f)
             throws SAXException, IOException {
-	return parseInputSourceWithFilter(new InputSource(r), f);
+        return parseInputSourceWithFilter(new InputSource(r), f);
     }
 
-    /** Parses the given String after applying the given XMLFilter. */
+    /**
+     * Parses the given String after applying the given XMLFilter.
+     */
     private Document parseStringWithFilter(String s, XMLFilter f)
             throws SAXException, IOException {
         StringReader r = new StringReader(s);
         return parseReaderWithFilter(r, f);
     }
 
-    /** Parses the given Reader after applying the given XMLFilter. */
+    /**
+     * Parses the given Reader after applying the given XMLFilter.
+     */
     private Document parseURLWithFilter(String url, XMLFilter f)
             throws SAXException, IOException {
-	return parseInputSourceWithFilter(new InputSource(url), f);
+        return parseInputSourceWithFilter(new InputSource(url), f);
     }
 
-    /** Parses the given InputSource into a Document. */
+    /**
+     * Parses the given InputSource into a Document.
+     */
     private Document parseInputSource(InputSource s)
-	    throws SAXException, IOException {
-	db.setEntityResolver(new JstlEntityResolver(pageContext));
+            throws SAXException, IOException {
+        db.setEntityResolver(new JstlEntityResolver(pageContext));
 
         // normalize URIs so they can be processed consistently by resolver
-        if (systemId == null)
+        if (systemId == null) {
             s.setSystemId("jstl:");
-	else if (ImportSupport.isAbsoluteUrl(systemId))
+        } else if (ImportSupport.isAbsoluteUrl(systemId)) {
             s.setSystemId(systemId);
-        else
+        } else {
             s.setSystemId("jstl:" + systemId);
-	return db.parse(s);
+        }
+        return db.parse(s);
     }
 
-    /** Parses the given Reader into a Document. */
+    /**
+     * Parses the given Reader into a Document.
+     */
     private Document parseReader(Reader r) throws SAXException, IOException {
         return parseInputSource(new InputSource(r));
     }
 
-    /** Parses the given String into a Document. */
+    /**
+     * Parses the given String into a Document.
+     */
     private Document parseString(String s) throws SAXException, IOException {
         StringReader r = new StringReader(s);
         return parseReader(r);
     }
 
-    /** Parses the URL (passed as a String) into a Document. */
+    /**
+     * Parses the URL (passed as a String) into a Document.
+     */
     private Document parseURL(String url) throws SAXException, IOException {
-	return parseInputSource(new InputSource(url));
+        return parseInputSource(new InputSource(url));
     }
 
     //*********************************************************************
     // JSTL-specific EntityResolver class
 
-    /** Lets us resolve relative external entities. */
+    /**
+     * Lets us resolve relative external entities.
+     */
     public static class JstlEntityResolver implements EntityResolver {
-	private final PageContext ctx;
+        private final PageContext ctx;
+
         public JstlEntityResolver(PageContext ctx) {
             this.ctx = ctx;
         }
+
         public InputSource resolveEntity(String publicId, String systemId)
-	        throws FileNotFoundException {
+                throws FileNotFoundException {
 
-	    // pass if we don't have a systemId
-	    if (systemId == null)
-		return null;
-
-	    // strip leading "jstl:" off URL if applicable
-	    if (systemId.startsWith("jstl:"))
-		systemId = systemId.substring(5);
-
-	    // we're only concerned with relative URLs
-	    if (ImportSupport.isAbsoluteUrl(systemId))
-		return null;
-
-	    // for relative URLs, load and wrap the resource.
-	    // don't bother checking for 'null' since we specifically want
-	    // the parser to fail if the resource doesn't exist
-	    InputStream s;
-	    if (systemId.startsWith("/")) {
-	        s = ctx.getServletContext().getResourceAsStream(systemId);
-	        if (s == null)
-		    throw new FileNotFoundException(
-			Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
-			 systemId));
-	    } else {
-		String pagePath =
-		    ((HttpServletRequest) ctx.getRequest()).getServletPath();
-		String basePath =
-		    pagePath.substring(0, pagePath.lastIndexOf("/"));
-		s = ctx.getServletContext().getResourceAsStream(
-		      basePath + "/" + systemId);
-	        if (s == null)
-		    throw new FileNotFoundException(
-			Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
-			 systemId));
-	    }
-	    return new InputSource(s);
+            // pass if we don't have a systemId
+            if (systemId == null) {
+                return null;
+            }
+
+            // strip leading "jstl:" off URL if applicable
+            if (systemId.startsWith("jstl:")) {
+                systemId = systemId.substring(5);
+            }
+
+            // we're only concerned with relative URLs
+            if (ImportSupport.isAbsoluteUrl(systemId)) {
+                return null;
+            }
+
+            // for relative URLs, load and wrap the resource.
+            // don't bother checking for 'null' since we specifically want
+            // the parser to fail if the resource doesn't exist
+            InputStream s;
+            if (systemId.startsWith("/")) {
+                s = ctx.getServletContext().getResourceAsStream(systemId);
+                if (s == null) {
+                    throw new FileNotFoundException(
+                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
+                                    systemId));
+                }
+            } else {
+                String pagePath =
+                        ((HttpServletRequest) ctx.getRequest()).getServletPath();
+                String basePath =
+                        pagePath.substring(0, pagePath.lastIndexOf("/"));
+                s = ctx.getServletContext().getResourceAsStream(
+                        basePath + "/" + systemId);
+                if (s == null) {
+                    throw new FileNotFoundException(
+                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
+                                    systemId));
+                }
+            }
+            return new InputSource(s);
         }
     }
 
@@ -300,18 +335,18 @@ public abstract class ParseSupport exten
     // Tag attributes
 
     public void setVar(String var) {
-	this.var = var;
+        this.var = var;
     }
 
     public void setVarDom(String varDom) {
-	this.varDom = varDom;
+        this.varDom = varDom;
     }
 
     public void setScope(String scope) {
-	this.scope = Util.getScope(scope);
+        this.scope = Util.getScope(scope);
     }
 
     public void setScopeDom(String scopeDom) {
-	this.scopeDom = Util.getScope(scopeDom);
+        this.scopeDom = Util.getScope(scopeDom);
     }
 }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.common.xml;
 
@@ -37,7 +37,7 @@ public class SetTag extends TagSupport {
 
     private String select;                    // tag attribute
     private String var;                       // tag attribute
-    private int scope;			      // processed tag attribute
+    private int scope;                  // processed tag attribute
 
     //*********************************************************************
     // Construction and initialization
@@ -53,9 +53,10 @@ public class SetTag extends TagSupport {
     }
 
     // resets local state
+
     private void init() {
-	var = null;
-	select = null;
+        var = null;
+        select = null;
         scope = PageContext.PAGE_SCOPE;
     }
 
@@ -64,28 +65,31 @@ public class SetTag extends TagSupport {
     // Tag logic
 
     // applies XPath expression from 'select' and stores the result in 'var'
+
     @Override
     public int doStartTag() throws JspException {
         // process the query
         XPathUtil xu = new XPathUtil(pageContext);
         List result =
-        xu.selectNodes(XPathUtil.getContext(this), select);
+                xu.selectNodes(XPathUtil.getContext(this), select);
         Object ret = result;
-        
+
         // unwrap primitive types if that's what we received
         if (result.size() == 1) {
             Object o = result.get(0);
             if (o instanceof String || o instanceof Boolean
-            || o instanceof Number)
+                    || o instanceof Number) {
                 ret = o;
+            }
         }
-        
+
         // expose the final result
         pageContext.setAttribute(var, ret, scope);
         return SKIP_BODY;
     }
 
     // Releases any resources we may have (or inherit)
+
     @Override
     public void release() {
         super.release();
@@ -97,14 +101,14 @@ public class SetTag extends TagSupport {
     // Attribute accessors
 
     public void setSelect(String select) {
-	this.select = select;
+        this.select = select;
     }
 
     public void setVar(String var) {
-	this.var = var;
+        this.var = var;
     }
 
     public void setScope(String scope) {
-	this.scope = Util.getScope(scope);
+        this.scope = Util.getScope(scope);
     }
 }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java Sat Nov 20 17:57:45 2010
@@ -23,6 +23,7 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.io.Writer;
 import java.util.List;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.JspTagException;
@@ -130,9 +131,10 @@ public abstract class TransformSupport e
 
             // we can assume at most one of 'var' or 'result' is specified
             if (result != null)
-                // we can write directly to the Result
+            // we can write directly to the Result
+            {
                 t.transform(source, result);
-            else if (var != null) {
+            } else if (var != null) {
                 // we need a Document
                 Document d = db.newDocument();
                 Result doc = new DOMResult(d);
@@ -183,12 +185,13 @@ public abstract class TransformSupport e
      * the current directory in the filesystem.
      */
     private static String wrapSystemId(String systemId) {
-        if (systemId == null)
+        if (systemId == null) {
             return "jstl:";
-        else if (ImportSupport.isAbsoluteUrl(systemId))
+        } else if (ImportSupport.isAbsoluteUrl(systemId)) {
             return systemId;
-        else
+        } else {
             return ("jstl:" + systemId);
+        }
     }
 
     /**
@@ -271,6 +274,7 @@ public abstract class TransformSupport e
 
     /**
      * Return the Source for a document specified as body content.
+     *
      * @return the document Source
      * @throws JspTagException if there is a problem with the body content
      */
@@ -373,8 +377,9 @@ public abstract class TransformSupport e
                 throws TransformerException {
 
             // pass if we don't have a systemId
-            if (href == null)
+            if (href == null) {
                 return null;
+            }
 
             // remove "jstl" marker from 'base'
             // NOTE: how 'base' is determined varies among different Xalan
@@ -386,14 +391,16 @@ public abstract class TransformSupport e
 
             // we're only concerned with relative URLs
             if (ImportSupport.isAbsoluteUrl(href)
-                    || (base != null && ImportSupport.isAbsoluteUrl(base)))
+                    || (base != null && ImportSupport.isAbsoluteUrl(base))) {
                 return null;
+            }
 
             // base is relative; remove everything after trailing '/'
-            if (base == null || base.lastIndexOf("/") == -1)
+            if (base == null || base.lastIndexOf("/") == -1) {
                 base = "";
-            else
+            } else {
                 base = base.substring(0, base.lastIndexOf("/") + 1);
+            }
 
             // concatenate to produce the real URL we're interested in
             String target = base + href;
@@ -404,10 +411,11 @@ public abstract class TransformSupport e
             InputStream s;
             if (target.startsWith("/")) {
                 s = ctx.getServletContext().getResourceAsStream(target);
-                if (s == null)
+                if (s == null) {
                     throw new TransformerException(
                             Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
                                     href));
+                }
             } else {
                 String pagePath =
                         ((HttpServletRequest) ctx.getRequest()).getServletPath();
@@ -415,10 +423,11 @@ public abstract class TransformSupport e
                         pagePath.substring(0, pagePath.lastIndexOf("/"));
                 s = ctx.getServletContext().getResourceAsStream(
                         basePath + "/" + target);
-                if (s == null)
+                if (s == null) {
                     throw new TransformerException(
                             Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
                                     href));
+                }
             }
             return new StreamSource(s);
         }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java Sat Nov 20 17:57:45 2010
@@ -27,18 +27,20 @@ public class UnresolvableException exten
     /**
      * Create an UnresolvableException object that holds
      * an error message.
+     *
      * @param message The error message.
      */
     public UnresolvableException(String message) {
         super(message);
     }
-    
+
     /**
      * Create an UnresolvableException object that holds
      * an error message, and another exception
      * that caused this exception.
+     *
      * @param message The error message.
-     * @param e The exception that caused this exception.
+     * @param e       The exception that caused this exception.
      */
     public UnresolvableException(String message, Exception e) {
         super(message, e);

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.common.xml;
 
@@ -33,12 +33,14 @@ public class WhenTag extends WhenTagSupp
     // Constructor and lifecycle management
 
     // initialize inherited and local state
+
     public WhenTag() {
         super();
         init();
     }
 
     // Releases any resources we may have (or inherit)
+
     @Override
     public void release() {
         super.release();
@@ -73,6 +75,7 @@ public class WhenTag extends WhenTagSupp
     // Private utility methods
 
     // resets internal state
+
     private void init() {
         select = null;
     }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java Sat Nov 20 17:57:45 2010
@@ -57,45 +57,46 @@ import org.w3c.dom.NodeList;
 // would ideally be a base class, but some of our user handlers already
 // have their own parents
 public class XPathUtil {
-    
+
     //*********************************************************************
     // Constructor
-    
+
     /**
      * Constructs a new XPathUtil object associated with the given
      * PageContext.
      */
     public XPathUtil(PageContext pc) {
         pageContext = pc;
-    }    
-    
-    int globalVarSize=0;
-    public Vector getVariableQNames ( ) {
+    }
+
+    int globalVarSize = 0;
+
+    public Vector getVariableQNames() {
 
         globalVarSize = 0;
-        Vector variableVector = new Vector ( );
+        Vector variableVector = new Vector();
         // Now construct attributes in different scopes
-        Enumeration enum_ = pageContext.getAttributeNamesInScope( 
-            PageContext.PAGE_SCOPE );
-        while ( enum_.hasMoreElements() ) {
-            String varName = (String)enum_.nextElement();
-            QName varQName = new QName ( PAGE_NS_URL, PAGE_P, varName); 
+        Enumeration enum_ = pageContext.getAttributeNamesInScope(
+                PageContext.PAGE_SCOPE);
+        while (enum_.hasMoreElements()) {
+            String varName = (String) enum_.nextElement();
+            QName varQName = new QName(PAGE_NS_URL, PAGE_P, varName);
             //Adding both namespace qualified QName and just localName
-            variableVector.addElement( varQName );
+            variableVector.addElement(varQName);
             globalVarSize++;
-            
-            variableVector.addElement( new QName(null, varName ) );
+
+            variableVector.addElement(new QName(null, varName));
             globalVarSize++;
         }
-        enum_ = pageContext.getAttributeNamesInScope( 
-            PageContext.REQUEST_SCOPE );
-        while ( enum_.hasMoreElements() ) {
-            String varName = (String)enum_.nextElement();
-            QName varQName = new QName ( REQUEST_NS_URL,REQUEST_P, varName); 
+        enum_ = pageContext.getAttributeNamesInScope(
+                PageContext.REQUEST_SCOPE);
+        while (enum_.hasMoreElements()) {
+            String varName = (String) enum_.nextElement();
+            QName varQName = new QName(REQUEST_NS_URL, REQUEST_P, varName);
             //Adding both namespace qualified QName and just localName
-            variableVector.addElement( varQName );
+            variableVector.addElement(varQName);
             globalVarSize++;
-            variableVector.addElement( new QName(null, varName ) );
+            variableVector.addElement(new QName(null, varName));
             globalVarSize++;
         }
 
@@ -103,90 +104,90 @@ public class XPathUtil {
             // we may have a page directive preventing session creation/access
             // do not attempt to retrieve attribute names in session scope
             // @see [ http://issues.apache.org/bugzilla/show_bug.cgi?id=35216 ]
-            enum_ = pageContext.getAttributeNamesInScope( 
-                PageContext.SESSION_SCOPE );
-            while ( enum_.hasMoreElements() ) {
-                String varName = (String)enum_.nextElement();
-                QName varQName = new QName ( SESSION_NS_URL, SESSION_P,varName); 
+            enum_ = pageContext.getAttributeNamesInScope(
+                    PageContext.SESSION_SCOPE);
+            while (enum_.hasMoreElements()) {
+                String varName = (String) enum_.nextElement();
+                QName varQName = new QName(SESSION_NS_URL, SESSION_P, varName);
                 //Adding both namespace qualified QName and just localName
-                variableVector.addElement( varQName );
+                variableVector.addElement(varQName);
                 globalVarSize++;
-                variableVector.addElement( new QName(null, varName ) );
+                variableVector.addElement(new QName(null, varName));
                 globalVarSize++;
             }
         }
 
-        enum_ = pageContext.getAttributeNamesInScope( 
-            PageContext.APPLICATION_SCOPE );
-        while ( enum_.hasMoreElements() ) {
-            String varName = (String)enum_.nextElement();
-            QName varQName = new QName ( APP_NS_URL, APP_P,varName ); 
+        enum_ = pageContext.getAttributeNamesInScope(
+                PageContext.APPLICATION_SCOPE);
+        while (enum_.hasMoreElements()) {
+            String varName = (String) enum_.nextElement();
+            QName varQName = new QName(APP_NS_URL, APP_P, varName);
             //Adding both namespace qualified QName and just localName
-            variableVector.addElement( varQName );
+            variableVector.addElement(varQName);
             globalVarSize++;
-            variableVector.addElement( new QName(null, varName ) );
+            variableVector.addElement(new QName(null, varName));
             globalVarSize++;
         }
         enum_ = pageContext.getRequest().getParameterNames();
-        while ( enum_.hasMoreElements() ) {
-            String varName = (String)enum_.nextElement();
-            QName varQName = new QName ( PARAM_NS_URL, PARAM_P,varName ); 
+        while (enum_.hasMoreElements()) {
+            String varName = (String) enum_.nextElement();
+            QName varQName = new QName(PARAM_NS_URL, PARAM_P, varName);
             //Adding both namespace qualified QName and just localName
-            variableVector.addElement( varQName );
+            variableVector.addElement(varQName);
             globalVarSize++;
         }
         enum_ = pageContext.getServletContext().getInitParameterNames();
-        while ( enum_.hasMoreElements() ) {
-            String varName = (String)enum_.nextElement();
-            QName varQName = new QName ( INITPARAM_NS_URL, INITPARAM_P,varName ); 
+        while (enum_.hasMoreElements()) {
+            String varName = (String) enum_.nextElement();
+            QName varQName = new QName(INITPARAM_NS_URL, INITPARAM_P, varName);
             //Adding both namespace qualified QName and just localName
-            variableVector.addElement( varQName );
+            variableVector.addElement(varQName);
             globalVarSize++;
         }
-        enum_ = ((HttpServletRequest)pageContext.getRequest()).getHeaderNames();
-        while ( enum_.hasMoreElements() ) {
-            String varName = (String)enum_.nextElement();
-            QName varQName = new QName ( HEADER_NS_URL, HEADER_P,varName ); 
+        enum_ = ((HttpServletRequest) pageContext.getRequest()).getHeaderNames();
+        while (enum_.hasMoreElements()) {
+            String varName = (String) enum_.nextElement();
+            QName varQName = new QName(HEADER_NS_URL, HEADER_P, varName);
             //Adding namespace qualified QName 
-            variableVector.addElement( varQName );
+            variableVector.addElement(varQName);
             globalVarSize++;
         }
-        Cookie[] c= ((HttpServletRequest)pageContext.getRequest()).getCookies();
-        if ( c!= null ) {
-	    for (int i = 0; i < c.length; i++) {
-	        String varName = c[i].getName();
-                QName varQName = new QName ( COOKIE_NS_URL, COOKIE_P,varName ); 
+        Cookie[] c = ((HttpServletRequest) pageContext.getRequest()).getCookies();
+        if (c != null) {
+            for (int i = 0; i < c.length; i++) {
+                String varName = c[i].getName();
+                QName varQName = new QName(COOKIE_NS_URL, COOKIE_P, varName);
                 //Adding namespace qualified QName 
-                variableVector.addElement( varQName );
+                variableVector.addElement(varQName);
                 globalVarSize++;
             }
         }
 
         return variableVector;
-        
+
     }
- 
+
     //*********************************************************************
     // Support for JSTL variable resolution
-    
+
     // The URLs
     private static final String PAGE_NS_URL
-    = "http://java.sun.com/jstl/xpath/page";
+            = "http://java.sun.com/jstl/xpath/page";
     private static final String REQUEST_NS_URL
-    = "http://java.sun.com/jstl/xpath/request";
+            = "http://java.sun.com/jstl/xpath/request";
     private static final String SESSION_NS_URL
-    = "http://java.sun.com/jstl/xpath/session";
+            = "http://java.sun.com/jstl/xpath/session";
     private static final String APP_NS_URL
-    = "http://java.sun.com/jstl/xpath/app";
+            = "http://java.sun.com/jstl/xpath/app";
     private static final String PARAM_NS_URL
-    = "http://java.sun.com/jstl/xpath/param";
+            = "http://java.sun.com/jstl/xpath/param";
     private static final String INITPARAM_NS_URL
-    = "http://java.sun.com/jstl/xpath/initParam";
+            = "http://java.sun.com/jstl/xpath/initParam";
     private static final String COOKIE_NS_URL
-    = "http://java.sun.com/jstl/xpath/cookie";
+            = "http://java.sun.com/jstl/xpath/cookie";
     private static final String HEADER_NS_URL
-    = "http://java.sun.com/jstl/xpath/header";
-    
+            = "http://java.sun.com/jstl/xpath/header";
+
     // The prefixes
     private static final String PAGE_P = "pageScope";
     private static final String REQUEST_P = "requestScope";
@@ -196,194 +197,196 @@ public class XPathUtil {
     private static final String INITPARAM_P = "initParam";
     private static final String COOKIE_P = "cookie";
     private static final String HEADER_P = "header";
-    
+
     /**
-     * org.apache.xpath.VariableStack defines a class to keep track of a stack 
-     * for template arguments and variables. 
+     * org.apache.xpath.VariableStack defines a class to keep track of a stack
+     * for template arguments and variables.
      * JstlVariableContext customizes it so it handles JSTL custom
      * variable-mapping rules.
      */
     protected class JstlVariableContext extends org.apache.xpath.VariableStack {
-        
-        public JstlVariableContext( ) {
+
+        public JstlVariableContext() {
             super();
         }
-        
+
         /**
          * Get a variable as an XPath object based on it's qualified name.
-         * We override the base class method so JSTL's custom variable-mapping 
+         * We override the base class method so JSTL's custom variable-mapping
          * rules can be applied.
          *
          * @param xctxt The XPath context. @@@ we don't use it...
-         *  (from xalan: which must be passed in order to lazy evaluate variables.)
+         *              (from xalan: which must be passed in order to lazy evaluate variables.)
          * @param qname The qualified name of the variable.
          */
         @Override
         public XObject getVariableOrParam(
-        XPathContext xctxt, 
-        org.apache.xml.utils.QName qname)
-        throws javax.xml.transform.TransformerException, UnresolvableException
-        {
+                XPathContext xctxt,
+                org.apache.xml.utils.QName qname)
+                throws javax.xml.transform.TransformerException, UnresolvableException {
             //p( "***********************************getVariableOrParam begin****");
             String namespace = qname.getNamespaceURI();
             String prefix = qname.getPrefix();
             String localName = qname.getLocalName();
-            
+
             //p("namespace:prefix:localname=>"+ namespace
             //     + ":" + prefix +":" + localName );
-            
+
             try {
-                Object varObject = getVariableValue(namespace,prefix,localName);
+                Object varObject = getVariableValue(namespace, prefix, localName);
 
 
                 //XObject varObject = myvs.getVariableOrParam( xpathSupport, varQName);
-                XObject newXObject = new XObject( varObject);
+                XObject newXObject = new XObject(varObject);
 
-                if ( Class.forName("org.w3c.dom.Document").isInstance( varObject) ) {
+                if (Class.forName("org.w3c.dom.Document").isInstance(varObject)) {
 
-                    NodeList nl= ((Document)varObject).getChildNodes();
+                    NodeList nl = ((Document) varObject).getChildNodes();
                     // To allow non-welformed document
                     Vector nodeVector = new Vector();
-                    for ( int i=0; i<nl.getLength(); i++ ) {
+                    for (int i = 0; i < nl.getLength(); i++) {
                         Node currNode = nl.item(i);
-                        if ( currNode.getNodeType() == Node.ELEMENT_NODE ) {
-                            nodeVector.addElement( currNode);
+                        if (currNode.getNodeType() == Node.ELEMENT_NODE) {
+                            nodeVector.addElement(currNode);
                         }
                     }
-                    JSTLNodeList jstlNodeList = new JSTLNodeList( nodeVector);
-                    newXObject = new XNodeSetForDOM( jstlNodeList, xctxt );
-                    
+                    JSTLNodeList jstlNodeList = new JSTLNodeList(nodeVector);
+                    newXObject = new XNodeSetForDOM(jstlNodeList, xctxt);
+
                     return newXObject;
-                   
-                } 
-                if ( Class.forName(
-        "org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance(
-                     varObject) ) {
-                    JSTLNodeList jstlNodeList = (JSTLNodeList)varObject;
-                    if  ( ( jstlNodeList.getLength() == 1 ) && 
-   (!Class.forName("org.w3c.dom.Node").isInstance( jstlNodeList.elementAt(0) ) ) ) { 
+
+                }
+                if (Class.forName(
+                        "org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance(
+                        varObject)) {
+                    JSTLNodeList jstlNodeList = (JSTLNodeList) varObject;
+                    if ((jstlNodeList.getLength() == 1) &&
+                            (!Class.forName("org.w3c.dom.Node").isInstance(jstlNodeList.elementAt(0)))) {
                         varObject = jstlNodeList.elementAt(0);
                         //Now we need to allow this primitive type to be coverted 
                         // to type which Xalan XPath understands 
                     } else {
-                        return new XNodeSetForDOM (  jstlNodeList ,xctxt );
+                        return new XNodeSetForDOM(jstlNodeList, xctxt);
                     }
-                } 
-                if (Class.forName("org.w3c.dom.Node").isInstance( varObject)) {
-                    newXObject = new XNodeSetForDOM ( new JSTLNodeList( (Node)varObject ),xctxt );
-                } else if ( Class.forName("java.lang.String").isInstance( varObject)){
-                    newXObject = new XString ( (String)varObject );
-                } else if ( Class.forName("java.lang.Boolean").isInstance( varObject) ) {
-                    newXObject = new XBoolean ( (Boolean)varObject );
-                } else if ( Class.forName("java.lang.Number").isInstance( varObject) ) {
-                    newXObject = new XNumber ( (Number)varObject );
-                } 
+                }
+                if (Class.forName("org.w3c.dom.Node").isInstance(varObject)) {
+                    newXObject = new XNodeSetForDOM(new JSTLNodeList((Node) varObject), xctxt);
+                } else if (Class.forName("java.lang.String").isInstance(varObject)) {
+                    newXObject = new XString((String) varObject);
+                } else if (Class.forName("java.lang.Boolean").isInstance(varObject)) {
+                    newXObject = new XBoolean((Boolean) varObject);
+                } else if (Class.forName("java.lang.Number").isInstance(varObject)) {
+                    newXObject = new XNumber((Number) varObject);
+                }
 
                 return newXObject;
-               // myvs.setGlobalVariable( i, newXObject );
-            } catch ( ClassNotFoundException cnfe ) {
+                // myvs.setGlobalVariable( i, newXObject );
+            } catch (ClassNotFoundException cnfe) {
                 // This shouldn't happen (TODO: LOG)
-                System.out.println("CLASS NOT FOUND EXCEPTION :" + cnfe );
-            } 
+                System.out.println("CLASS NOT FOUND EXCEPTION :" + cnfe);
+            }
             //System.out.println("*****getVariableOrParam returning *null*" );
-            return null ;
+            return null;
         }
-        
+
         /**
-         * Retrieve an XPath's variable value using JSTL's custom 
+         * Retrieve an XPath's variable value using JSTL's custom
          * variable-mapping rules
          */
         public Object getVariableValue(
-        String namespace, 
-        String prefix,
-        String localName) 
-        throws UnresolvableException 
-        {
+                String namespace,
+                String prefix,
+                String localName)
+                throws UnresolvableException {
             // p("resolving: ns=" + namespace + " prefix=" + prefix + " localName=" + localName);
             // We can match on namespace with Xalan but leaving as is
             // [ I 'd prefer to match on namespace, but this doesn't appear
             // to work in Jaxen]
             if (prefix == null || prefix.equals("")) {
                 return notNull(
-                pageContext.findAttribute(localName),
-                prefix,
-                localName);
+                        pageContext.findAttribute(localName),
+                        prefix,
+                        localName);
             } else if (prefix.equals(PAGE_P)) {
                 return notNull(
-                pageContext.getAttribute(localName,PageContext.PAGE_SCOPE),
-                prefix,
-                localName);
+                        pageContext.getAttribute(localName, PageContext.PAGE_SCOPE),
+                        prefix,
+                        localName);
             } else if (prefix.equals(REQUEST_P)) {
                 return notNull(
-                pageContext.getAttribute(localName,
-                PageContext.REQUEST_SCOPE),
-                prefix,
-                localName);
+                        pageContext.getAttribute(localName,
+                                PageContext.REQUEST_SCOPE),
+                        prefix,
+                        localName);
             } else if (prefix.equals(SESSION_P)) {
                 return notNull(
-                pageContext.getAttribute(localName,
-                PageContext.SESSION_SCOPE),
-                prefix,
-                localName);
+                        pageContext.getAttribute(localName,
+                                PageContext.SESSION_SCOPE),
+                        prefix,
+                        localName);
             } else if (prefix.equals(APP_P)) {
                 return notNull(
-                pageContext.getAttribute(localName,
-                PageContext.APPLICATION_SCOPE),
-                prefix,
-                localName);
+                        pageContext.getAttribute(localName,
+                                PageContext.APPLICATION_SCOPE),
+                        prefix,
+                        localName);
             } else if (prefix.equals(PARAM_P)) {
                 return notNull(
-                pageContext.getRequest().getParameter(localName),
-                prefix,
-                localName);
+                        pageContext.getRequest().getParameter(localName),
+                        prefix,
+                        localName);
             } else if (prefix.equals(INITPARAM_P)) {
                 return notNull(
-                pageContext.getServletContext().
-                getInitParameter(localName),
-                prefix,
-                localName);
+                        pageContext.getServletContext().
+                                getInitParameter(localName),
+                        prefix,
+                        localName);
             } else if (prefix.equals(HEADER_P)) {
                 HttpServletRequest hsr =
-                (HttpServletRequest) pageContext.getRequest();
+                        (HttpServletRequest) pageContext.getRequest();
                 return notNull(
-                hsr.getHeader(localName),
-                prefix,
-                localName);
+                        hsr.getHeader(localName),
+                        prefix,
+                        localName);
             } else if (prefix.equals(COOKIE_P)) {
                 HttpServletRequest hsr =
-                (HttpServletRequest) pageContext.getRequest();
+                        (HttpServletRequest) pageContext.getRequest();
                 Cookie[] c = hsr.getCookies();
-                for (int i = 0; i < c.length; i++)
-                    if (c[i].getName().equals(localName))
+                for (int i = 0; i < c.length; i++) {
+                    if (c[i].getName().equals(localName)) {
                         return c[i].getValue();
+                    }
+                }
                 throw new UnresolvableException("$" + prefix + ":" + localName);
             } else {
                 throw new UnresolvableException("$" + prefix + ":" + localName);
             }
-        }    
-        
+        }
+
         /**
          * Validate that the Object returned is not null. If it is
          * null, throw an exception.
          */
         private Object notNull(Object o, String prefix, String localName)
-        throws UnresolvableException {
+                throws UnresolvableException {
             if (o == null) {
-                throw new UnresolvableException("$" + (prefix==null?"":prefix+":") + localName);
+                throw new UnresolvableException("$" + (prefix == null ? "" : prefix + ":") + localName);
             }
             //p("resolved to: " + o);
             return o;
-        }                
+        }
     }
-    
+
     //*********************************************************************
     // Support for XPath evaluation
-    
+
     private PageContext pageContext;
     private static HashMap exprCache;
     private static JSTLPrefixResolver jstlPrefixResolver = null;
-    
-    /** Initialize globally useful data. */
+
+    /**
+     * Initialize globally useful data.
+     */
     private synchronized static void staticInit() {
         if (jstlPrefixResolver == null) {
             // register supported namespaces
@@ -396,48 +399,48 @@ public class XPathUtil {
             jstlPrefixResolver.addNamespace("initParam", INITPARAM_NS_URL);
             jstlPrefixResolver.addNamespace("header", HEADER_NS_URL);
             jstlPrefixResolver.addNamespace("cookie", COOKIE_NS_URL);
-            
-            
+
+
             // create a HashMap to cache the expressions
             exprCache = new HashMap();
         }
     }
-    
+
     static DocumentBuilderFactory dbf = null;
     static DocumentBuilder db = null;
     static Document d = null;
-    
-    static Document getDummyDocument( ) {
+
+    static Document getDummyDocument() {
         try {
-            if ( dbf == null ) {
+            if (dbf == null) {
                 dbf = DocumentBuilderFactory.newInstance();
-                dbf.setNamespaceAware( true );
-                dbf.setValidating( false );
+                dbf.setNamespaceAware(true);
+                dbf.setValidating(false);
             }
             db = dbf.newDocumentBuilder();
 
             DOMImplementation dim = db.getDOMImplementation();
-            d = dim.createDocument("http://java.sun.com/jstl", "dummyroot", null); 
+            d = dim.createDocument("http://java.sun.com/jstl", "dummyroot", null);
             //d = db.newDocument();
             return d;
-        } catch ( Exception e ) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return null;
     }
 
-     static Document getDummyDocumentWithoutRoot( ) {
+    static Document getDummyDocumentWithoutRoot() {
         try {
-            if ( dbf == null ) {
+            if (dbf == null) {
                 dbf = DocumentBuilderFactory.newInstance();
-                dbf.setNamespaceAware( true );
-                dbf.setValidating( false );
+                dbf.setNamespaceAware(true);
+                dbf.setValidating(false);
             }
             db = dbf.newDocumentBuilder();
 
             d = db.newDocument();
             return d;
-        } catch ( Exception e ) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return null;
@@ -449,97 +452,94 @@ public class XPathUtil {
         doc.appendChild(importedNode);
         return doc;
     }
-    
+
     // The following variable is used for holding the modified xpath string
     // when adapting parameter for Xalan XPath engine, where we need to have
     // a Non null context node.
     String modifiedXPath = null;
-    
 
-    
-    
-    
+
     /**
-     * Evaluate an XPath expression to a String value. 
+     * Evaluate an XPath expression to a String value.
      */
-    public String valueOf(Node n, String xpath) throws JspTagException  {
+    public String valueOf(Node n, String xpath) throws JspTagException {
         //p("******** valueOf(" + n + ", " + xpath + ")");
         staticInit();
         // @@@ but where do we set the Pag4eContext for the varaiblecontext?
         JstlVariableContext vs = new JstlVariableContext();
         XPathContext xpathSupport = new XPathContext();
-        xpathSupport.setVarStack( vs);
-        
-        Vector varVector = fillVarStack(vs, xpathSupport);                
-        
-        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
-        
+        xpathSupport.setVarStack(vs);
+
+        Vector varVector = fillVarStack(vs, xpathSupport);
+
+        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
+
         xpath = modifiedXPath;
-        
+
         //p("******** valueOf: modified xpath: " + xpath);
 
-        XObject result = JSTLXPathAPI.eval( contextNode, xpath,
-        jstlPrefixResolver,xpathSupport, varVector);
+        XObject result = JSTLXPathAPI.eval(contextNode, xpath,
+                jstlPrefixResolver, xpathSupport, varVector);
+
 
-        
         //p("******Result TYPE => " + result.getTypeString() );
-        
+
         String resultString = result.str();
         //p("******** valueOf: after eval: " + resultString);
-        
+
         return resultString;
-    
-    }    
 
-    /** 
-     * Evaluate an XPath expression to a boolean value. 
+    }
+
+    /**
+     * Evaluate an XPath expression to a boolean value.
      */
     public boolean booleanValueOf(Node n, String xpath)
-    throws JspTagException {
-        
+            throws JspTagException {
+
         staticInit();
         JstlVariableContext vs = new JstlVariableContext();
         XPathContext xpathSupport = new XPathContext();
-        xpathSupport.setVarStack( vs);
-        
-        Vector varVector = fillVarStack(vs, xpathSupport);        
-        
-        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
+        xpathSupport.setVarStack(vs);
+
+        Vector varVector = fillVarStack(vs, xpathSupport);
+
+        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
         xpath = modifiedXPath;
-        
-        XObject result = JSTLXPathAPI.eval( contextNode, xpath,
-        jstlPrefixResolver, xpathSupport, varVector);
-        
+
+        XObject result = JSTLXPathAPI.eval(contextNode, xpath,
+                jstlPrefixResolver, xpathSupport, varVector);
+
         try {
             return result.bool();
         } catch (TransformerException ex) {
             throw new JspTagException(
-                Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);            
+                    Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);
         }
     }
-    
-    /** 
-     * Evaluate an XPath expression to a List of nodes. 
+
+    /**
+     * Evaluate an XPath expression to a List of nodes.
      */
-    public List selectNodes(Node n, String xpath)  throws JspTagException {
-        
+    public List selectNodes(Node n, String xpath) throws JspTagException {
+
         staticInit();
         JstlVariableContext vs = new JstlVariableContext();
         XPathContext xpathSupport = new XPathContext();
-        xpathSupport.setVarStack( vs);
-        
-        Vector varVector = fillVarStack(vs, xpathSupport);                
+        xpathSupport.setVarStack(vs);
 
-        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
+        Vector varVector = fillVarStack(vs, xpathSupport);
+
+        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
         xpath = modifiedXPath;
-        
-        XObject result = JSTLXPathAPI.eval( contextNode, xpath,
-        jstlPrefixResolver,xpathSupport, varVector);
+
+        XObject result = JSTLXPathAPI.eval(contextNode, xpath,
+                jstlPrefixResolver, xpathSupport, varVector);
         try {
-            NodeList nl= JSTLXPathAPI.getNodeList(result);
-            return new JSTLNodeList( nl );
-        } catch ( JspTagException e ) {
-            try { 
+            NodeList nl = JSTLXPathAPI.getNodeList(result);
+            return new JSTLNodeList(nl);
+        } catch (JspTagException e) {
+            try {
                 //If result can't be converted to NodeList we receive exception
                 // In this case we may have single primitive value as the result
                 // Populating List with this value ( String, Boolean or Number )
@@ -547,154 +547,155 @@ public class XPathUtil {
                 //System.out.println("JSTLXPathAPI.getNodeList thrown exception:"+ e);
                 Vector vector = new Vector();
                 Object resultObject = null;
-                if ( result.getType()== XObject.CLASS_BOOLEAN ) {
-                    resultObject = new Boolean( result.bool());
-                } else if ( result.getType()== XObject.CLASS_NUMBER ) {
-                    resultObject = new Double( result.num());
-                } else if ( result.getType()== XObject.CLASS_STRING ) {
+                if (result.getType() == XObject.CLASS_BOOLEAN) {
+                    resultObject = result.bool();
+                } else if (result.getType() == XObject.CLASS_NUMBER) {
+                    resultObject = result.num();
+                } else if (result.getType() == XObject.CLASS_STRING) {
                     resultObject = result.str();
                 }
 
-                vector.add( resultObject );
-                return new JSTLNodeList ( vector );
-            } catch ( TransformerException te ) {
+                vector.add(resultObject);
+                return new JSTLNodeList(vector);
+            } catch (TransformerException te) {
                 throw new JspTagException(te.toString(), te);
             }
         }
-          
-        
-       
-    }
-    
-    /** 
-     * Evaluate an XPath expression to a single node. 
+
+
+    }
+
+    /**
+     * Evaluate an XPath expression to a single node.
      */
     public Node selectSingleNode(Node n, String xpath)
-    throws JspTagException {
+            throws JspTagException {
         //p("selectSingleNode of XPathUtil = passed node:" +
         //   "xpath => " + n + " : " + xpath );
-        
+
         staticInit();
         JstlVariableContext vs = new JstlVariableContext();
         XPathContext xpathSupport = new XPathContext();
-        xpathSupport.setVarStack( vs);
-        
-        Vector varVector = fillVarStack(vs, xpathSupport);                
+        xpathSupport.setVarStack(vs);
 
-        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
+        Vector varVector = fillVarStack(vs, xpathSupport);
+
+        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
         xpath = modifiedXPath;
-        
-        return (Node) JSTLXPathAPI.selectSingleNode( contextNode, xpath,
-        jstlPrefixResolver,xpathSupport );
+
+        return (Node) JSTLXPathAPI.selectSingleNode(contextNode, xpath,
+                jstlPrefixResolver, xpathSupport);
     }
-    
-    /** Returns a locally appropriate context given a node. */
+
+    /**
+     * Returns a locally appropriate context given a node.
+     */
     private VariableStack getLocalContext() {
         // set up instance-specific contexts
         VariableStack vc = new JstlVariableContext();
         return vc;
-    }    
-    
+    }
+
     //*********************************************************************
     // Adapt XPath expression for integration with Xalan
-   
+
     /**
-     * To evaluate an XPath expression using Xalan, we need 
-     * to create an XPath object, which wraps an expression object and provides 
+     * To evaluate an XPath expression using Xalan, we need
+     * to create an XPath object, which wraps an expression object and provides
      * general services for execution of that expression.
-     *
+     * <p/>
      * An XPath object can be instantiated with the following information:
-     *     - XPath expression to evaluate
-     *     - SourceLocator 
-     *        (reports where an error occurred in the XML source or 
-     *        transformation instructions)
-     *     - PrefixResolver
-     *        (resolve prefixes to namespace URIs)
-     *     - type
-     *        (one of SELECT or MATCH)
-     *     - ErrorListener
-     *        (customized error handling)
-     *
+     * - XPath expression to evaluate
+     * - SourceLocator
+     * (reports where an error occurred in the XML source or
+     * transformation instructions)
+     * - PrefixResolver
+     * (resolve prefixes to namespace URIs)
+     * - type
+     * (one of SELECT or MATCH)
+     * - ErrorListener
+     * (customized error handling)
+     * <p/>
      * Execution of the XPath expression represented by an XPath object
      * is done via method execute which takes the following parameters:
-     *     - XPathContext 
-     *        The execution context
-     *     - Node contextNode
-     *        The node that "." expresses
-     *     - PrefixResolver namespaceContext
-     *        The context in which namespaces in the XPath are supposed to be 
-     *        expanded.
-     *
+     * - XPathContext
+     * The execution context
+     * - Node contextNode
+     * The node that "." expresses
+     * - PrefixResolver namespaceContext
+     * The context in which namespaces in the XPath are supposed to be
+     * expanded.
+     * <p/>
      * Given all of this, if no context node is set for the evaluation
-     * of the XPath expression, one must be set so Xalan 
+     * of the XPath expression, one must be set so Xalan
      * can successfully evaluate a JSTL XPath expression.
      * (it will not work if the context node is given as a varialbe
      * at the beginning of the expression)
      *
      * @@@ Provide more details...
      */
-    protected Node adaptParamsForXalan( JstlVariableContext jvc,  Node n,
-    String xpath ) {
+    protected Node adaptParamsForXalan(JstlVariableContext jvc, Node n,
+                                       String xpath) {
         Node boundDocument = null;
-        
+
         modifiedXPath = xpath;
-        String origXPath = xpath ;
+        String origXPath = xpath;
         boolean whetherOrigXPath = true;
-        
+
         // If contextNode is not null then  just pass the values to Xalan XPath
         // unless this is an expression that starts off with an xml document 
-        if ( n != null && !xpath.startsWith("$") ) {
+        if (n != null && !xpath.startsWith("$")) {
             return n;
         }
-        
-        if (  xpath.startsWith("$")  ) {
+
+        if (xpath.startsWith("$")) {
             // JSTL uses $scopePrefix:varLocalName/xpath expression
 
-            String varQName=  xpath.substring( xpath.indexOf("$")+1);
-            if ( varQName.indexOf("/") > 0 ) {
-                varQName = varQName.substring( 0, varQName.indexOf("/"));
-            }
-            String varPrefix =  null;
-            String varLocalName =  varQName;
-            if ( varQName.indexOf( ":") >= 0 ) {
-                varPrefix = varQName.substring( 0, varQName.indexOf(":") );
-                varLocalName = varQName.substring( varQName.indexOf(":")+1 );
-            }
-            
-            if ( xpath.indexOf("/") > 0 ) {
-                xpath = xpath.substring( xpath.indexOf("/"));
-            } else  {
+            String varQName = xpath.substring(xpath.indexOf("$") + 1);
+            if (varQName.indexOf("/") > 0) {
+                varQName = varQName.substring(0, varQName.indexOf("/"));
+            }
+            String varPrefix = null;
+            String varLocalName = varQName;
+            if (varQName.indexOf(":") >= 0) {
+                varPrefix = varQName.substring(0, varQName.indexOf(":"));
+                varLocalName = varQName.substring(varQName.indexOf(":") + 1);
+            }
+
+            if (xpath.indexOf("/") > 0) {
+                xpath = xpath.substring(xpath.indexOf("/"));
+            } else {
                 xpath = "/*";
-                whetherOrigXPath = false; 
+                whetherOrigXPath = false;
             }
-           
-            
+
+
             try {
-                Object varObject=jvc.getVariableValue( null,varPrefix,
-                varLocalName);
+                Object varObject = jvc.getVariableValue(null, varPrefix,
+                        varLocalName);
                 //System.out.println( "varObject => : its Class " +varObject +
                 // ":" + varObject.getClass() );
-                
-                if ( Class.forName("org.w3c.dom.Document").isInstance(
-                varObject ) )  {
+
+                if (Class.forName("org.w3c.dom.Document").isInstance(
+                        varObject)) {
                     //boundDocument = ((Document)varObject).getDocumentElement();
-                    boundDocument = ((Document)varObject);
+                    boundDocument = ((Document) varObject);
                 } else {
-                    
+
                     //System.out.println("Creating a Dummy document to pass " +
                     // " onto as context node " );
-                    
-                    if ( Class.forName("org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance( varObject ) ) {
+
+                    if (Class.forName("org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance(varObject)) {
                         Document newDocument = getDummyDocument();
 
-                        JSTLNodeList jstlNodeList = (JSTLNodeList)varObject;
-                        if   ( jstlNodeList.getLength() == 1 ) { 
-                            if ( Class.forName("org.w3c.dom.Node").isInstance(
-                                jstlNodeList.elementAt(0) ) ) { 
-                                Node node = (Node)jstlNodeList.elementAt(0);
+                        JSTLNodeList jstlNodeList = (JSTLNodeList) varObject;
+                        if (jstlNodeList.getLength() == 1) {
+                            if (Class.forName("org.w3c.dom.Node").isInstance(
+                                    jstlNodeList.elementAt(0))) {
+                                Node node = (Node) jstlNodeList.elementAt(0);
                                 boundDocument = getDocumentForNode(node);
-                                if ( whetherOrigXPath ) {
-                                    xpath="/*" + xpath;
+                                if (whetherOrigXPath) {
+                                    xpath = "/*" + xpath;
                                 }
 
                             } else {
@@ -709,20 +710,20 @@ public class XPathUtil {
 
                                 //p("String value ( xpathwould be this) => " + xpath);
                                 boundDocument = newDocument;
-                            } 
-                            
+                            }
+
                         } else {
 
                             Element dummyroot = newDocument.getDocumentElement();
-                            for ( int i=0; i< jstlNodeList.getLength(); i++ ) {
-                                Node currNode = (Node)jstlNodeList.item(i);
-                            
+                            for (int i = 0; i < jstlNodeList.getLength(); i++) {
+                                Node currNode = (Node) jstlNodeList.item(i);
+
                                 Node importedNode = newDocument.importNode(
-                                    currNode, true );
+                                        currNode, true);
 
                                 //printDetails ( newDocument);
 
-                                dummyroot.appendChild( importedNode );
+                                dummyroot.appendChild(importedNode);
 
                                 //p( "Details of the document After importing");
                                 //printDetails ( newDocument);
@@ -733,11 +734,11 @@ public class XPathUtil {
                             // to change the xpath expression.Hopefully this
                             // won't  change the result
 
-                            xpath = "/*" +  xpath;
+                            xpath = "/*" + xpath;
                         }
-                    } else if ( Class.forName("org.w3c.dom.Node").isInstance(
-                    varObject ) ) {
-                        boundDocument = getDocumentForNode((Node)varObject);
+                    } else if (Class.forName("org.w3c.dom.Node").isInstance(
+                            varObject)) {
+                        boundDocument = getDocumentForNode((Node) varObject);
                         if (whetherOrigXPath) {
                             xpath = "/*" + xpath;
                         }
@@ -745,147 +746,145 @@ public class XPathUtil {
                         boundDocument = getDummyDocument();
                         xpath = origXPath;
                     }
-                    
-                    
+
+
                 }
-            } catch ( UnresolvableException ue ) {
+            } catch (UnresolvableException ue) {
                 // TODO: LOG
                 System.out.println("Variable Unresolvable :" + ue.getMessage());
                 ue.printStackTrace();
-            } catch ( ClassNotFoundException cnf ) {
+            } catch (ClassNotFoundException cnf) {
                 // Will never happen
             }
-        } else { 
+        } else {
             //System.out.println("Not encountered $ Creating a Dummydocument 2 "+
-             //   "pass onto as context node " );
+            //   "pass onto as context node " );
             boundDocument = getDummyDocument();
         }
-     
+
         modifiedXPath = xpath;
         //System.out.println("Modified XPath::boundDocument =>" + modifiedXPath +
         //    "::" + boundDocument );
-         
+
         return boundDocument;
     }
-    
+
 
     //*********************************************************************
     // 
-    
+
     /**
-     ** @@@ why do we have to pass varVector in the varStack first, and then
+     * * @@@ why do we have to pass varVector in the varStack first, and then
      * to XPath object?
      */
-    private Vector fillVarStack(JstlVariableContext vs, XPathContext xpathSupport) 
-    throws JspTagException {
+    private Vector fillVarStack(JstlVariableContext vs, XPathContext xpathSupport)
+            throws JspTagException {
         org.apache.xpath.VariableStack myvs = xpathSupport.getVarStack();
         Vector varVector = getVariableQNames();
-        for ( int i=0; i<varVector.size(); i++ ) {
-          
-            QName varQName = (QName)varVector.elementAt(i);
+        for (int i = 0; i < varVector.size(); i++) {
 
-            try { 
-                XObject variableValue = vs.getVariableOrParam( xpathSupport, varQName );
+            QName varQName = (QName) varVector.elementAt(i);
+
+            try {
+                XObject variableValue = vs.getVariableOrParam(xpathSupport, varQName);
                 //p("&&&&Variable set to => " + variableValue.toString() );
                 //p("&&&&Variable type => " + variableValue.getTypeString() );
-                myvs.setGlobalVariable( i, variableValue );
+                myvs.setGlobalVariable(i, variableValue);
 
-            } catch ( TransformerException te ) {
+            } catch (TransformerException te) {
                 throw new JspTagException(te.toString(), te);
-            } 
- 
+            }
+
         }
         return varVector;
     }
-        
-    
-    
-    
-    
+
+
     //*********************************************************************
     // Static support for context retrieval from parent <forEach> tag
-    
+
     public static Node getContext(Tag t) throws JspTagException {
         ForEachTag xt =
-        (ForEachTag) TagSupport.findAncestorWithClass(
-        t, ForEachTag.class);
-        if (xt == null)
+                (ForEachTag) TagSupport.findAncestorWithClass(
+                        t, ForEachTag.class);
+        if (xt == null) {
             return null;
-        else
+        } else {
             return (xt.getContext());
+        }
     }
-    
+
     //*********************************************************************
     // Utility methods
-    
+
     private static void p(String s) {
         System.out.println("[XPathUtil] " + s);
     }
-    
+
     public static void printDetails(Node n) {
-        System.out.println("\n\nDetails of Node = > " + n ) ;
+        System.out.println("\n\nDetails of Node = > " + n);
         System.out.println("Name:Type:Node Value = > " + n.getNodeName() +
-        ":" + n.getNodeType() + ":" + n.getNodeValue()  ) ;
+                ":" + n.getNodeType() + ":" + n.getNodeValue());
         System.out.println("Namespace URI : Prefix : localName = > " +
-        n.getNamespaceURI() + ":" +n.getPrefix() + ":" + n.getLocalName());
-        System.out.println("\n Node has children => " + n.hasChildNodes() );
-        if ( n.hasChildNodes() ) {
+                n.getNamespaceURI() + ":" + n.getPrefix() + ":" + n.getLocalName());
+        System.out.println("\n Node has children => " + n.hasChildNodes());
+        if (n.hasChildNodes()) {
             NodeList nl = n.getChildNodes();
-            System.out.println("Number of Children => " + nl.getLength() );
-            for ( int i=0; i<nl.getLength(); i++ ) {
+            System.out.println("Number of Children => " + nl.getLength());
+            for (int i = 0; i < nl.getLength(); i++) {
                 Node childNode = nl.item(i);
-                printDetails( childNode );
+                printDetails(childNode);
             }
         }
-    }    
+    }
 }
 
-class JSTLNodeList extends Vector implements NodeList   {
-    
+class JSTLNodeList extends Vector implements NodeList {
+
     Vector nodeVector;
 
-    public JSTLNodeList ( Vector nodeVector ) {
+    public JSTLNodeList(Vector nodeVector) {
         this.nodeVector = nodeVector;
     }
 
-    public JSTLNodeList ( NodeList nl ) {
+    public JSTLNodeList(NodeList nl) {
         nodeVector = new Vector();
         //System.out.println("[JSTLNodeList] nodelist details");
-        for ( int i=0; i<nl.getLength(); i++ ) {
+        for (int i = 0; i < nl.getLength(); i++) {
             Node currNode = nl.item(i);
             //XPathUtil.printDetails ( currNode );
-            nodeVector.add(i, nl.item(i) );
+            nodeVector.add(i, nl.item(i));
         }
     }
 
-    public JSTLNodeList ( Node n ) {
+    public JSTLNodeList(Node n) {
         nodeVector = new Vector();
-        nodeVector.addElement( n );
+        nodeVector.addElement(n);
     }
-        
 
-    public Node item ( int index ) {
-        return (Node)nodeVector.elementAt( index );
+
+    public Node item(int index) {
+        return (Node) nodeVector.elementAt(index);
     }
 
     @Override
-    public Object elementAt ( int index ) {
-        return nodeVector.elementAt( index );
+    public Object elementAt(int index) {
+        return nodeVector.elementAt(index);
     }
 
     @Override
-    public Object get ( int index ) {
-        return nodeVector.get( index );
+    public Object get(int index) {
+        return nodeVector.get(index);
     }
 
-    public int getLength (  ) {
-        return nodeVector.size( );
+    public int getLength() {
+        return nodeVector.size();
     }
 
     @Override
-    public int size (  ) {
+    public int size() {
         //System.out.println("JSTL node list size => " + nodeVector.size() );
-        return nodeVector.size( );
+        return nodeVector.size();
     }
 
     // Can implement other Vector methods to redirect those methods to 

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.rt.core;
 
@@ -33,14 +33,14 @@ import org.apache.taglibs.standard.tag.c
  */
 
 public class ForEachTag
-    extends ForEachSupport
-    implements LoopTag, IterationTag
-{
+        extends ForEachSupport
+        implements LoopTag, IterationTag {
 
     //*********************************************************************
     // Accessor methods
 
     // for tag attribute
+
     public void setBegin(int begin) throws JspTagException {
         this.beginSpecified = true;
         this.begin = begin;
@@ -48,6 +48,7 @@ public class ForEachTag
     }
 
     // for tag attribute
+
     public void setEnd(int end) throws JspTagException {
         this.endSpecified = true;
         this.end = end;
@@ -55,6 +56,7 @@ public class ForEachTag
     }
 
     // for tag attribute
+
     public void setStep(int step) throws JspTagException {
         this.stepSpecified = true;
         this.step = step;
@@ -62,10 +64,11 @@ public class ForEachTag
     }
 
     public void setItems(Object o) throws JspTagException {
-	// for null items, simulate an empty list
-	if (o == null)
-	    rawItems = new ArrayList();
-        else
-	    rawItems = o;
+        // for null items, simulate an empty list
+        if (o == null) {
+            rawItems = new ArrayList();
+        } else {
+            rawItems = o;
+        }
     }
 }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.rt.core;
 
@@ -31,14 +31,14 @@ import org.apache.taglibs.standard.tag.c
  */
 
 public class ForTokensTag
-    extends ForTokensSupport
-    implements LoopTag, IterationTag
-{
+        extends ForTokensSupport
+        implements LoopTag, IterationTag {
 
     //*********************************************************************
     // Accessor methods
 
     // for tag attribute
+
     public void setBegin(int begin) throws JspTagException {
         this.beginSpecified = true;
         this.begin = begin;
@@ -46,6 +46,7 @@ public class ForTokensTag
     }
 
     // for tag attribute
+
     public void setEnd(int end) throws JspTagException {
         this.endSpecified = true;
         this.end = end;
@@ -53,6 +54,7 @@ public class ForTokensTag
     }
 
     // for tag attribute
+
     public void setStep(int step) throws JspTagException {
         this.stepSpecified = true;
         this.step = step;
@@ -60,19 +62,23 @@ public class ForTokensTag
     }
 
     // stores the 'items' Object we're passed
+
     public void setItems(Object s) throws JspTagException {
         items = s;
-	// use the empty string to indicate "no iteration"
-        if (s == null)
-	    items = "";
+        // use the empty string to indicate "no iteration"
+        if (s == null) {
+            items = "";
+        }
     }
 
     // stores the 'delims' String we're passed
+
     public void setDelims(String s) throws JspTagException {
         delims = s;
-	// use the empty string to cause monolithic tokenization
-        if (s == null)
-	    delims = "";
+        // use the empty string to cause monolithic tokenization
+        if (s == null) {
+            delims = "";
+        }
     }
 
 }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.rt.core;
 
@@ -34,12 +34,14 @@ public class IfTag extends ConditionalTa
     // Constructor and lifecycle management
 
     // initialize inherited and local state
+
     public IfTag() {
         super();
         init();
     }
 
     // Releases any resources we may have (or inherit)
+
     @Override
     public void release() {
         super.release();
@@ -66,6 +68,7 @@ public class IfTag extends ConditionalTa
     // Accessors
 
     // receives the tag's 'test' attribute
+
     public void setTest(boolean test) {
         this.test = test;
     }
@@ -75,6 +78,7 @@ public class IfTag extends ConditionalTa
     // Private utility methods
 
     // resets internal state
+
     private void init() {
         test = false;
     }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.rt.core;
 
@@ -34,16 +34,19 @@ public class ImportTag extends ImportSup
     // Accessor methods
 
     // for tag attribute
+
     public void setUrl(String url) throws JspTagException {
         this.url = url;
     }
 
     // for tag attribute
+
     public void setContext(String context) throws JspTagException {
         this.context = context;
     }
 
     // for tag attribute
+
     public void setCharEncoding(String charEncoding) throws JspTagException {
         this.charEncoding = charEncoding;
     }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.rt.core;
 
@@ -43,16 +43,19 @@ public class OutTag extends OutSupport {
     }
 
     // for tag attribute
+
     public void setValue(Object value) {
         this.value = value;
     }
-      
+
     // for tag attribute
+
     public void setDefault(String def) {
         this.def = def;
     }
-        
+
     // for tag attribute
+
     public void setEscapeXml(boolean escapeXml) {
         this.escapeXml = escapeXml;
     }

Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java?rev=1037279&r1=1037278&r2=1037279&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java (original)
+++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java Sat Nov 20 17:57:45 2010
@@ -13,7 +13,7 @@
  * 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.taglibs.standard.tag.rt.core;
 
@@ -34,11 +34,13 @@ public class ParamTag extends ParamSuppo
     // Accessor methods
 
     // for tag attribute
+
     public void setName(String name) throws JspTagException {
         this.name = name;
     }
 
     // for tag attribute
+
     public void setValue(String value) throws JspTagException {
         this.value = value;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org