You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by ba...@apache.org on 2007/01/03 21:07:58 UTC
svn commit: r492277 - in /jakarta/taglibs/proper/standard/trunk:
src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java
test/org/apache/taglibs/standard/tag/el/xml/Test35216.java
test/web/org/apache/taglibs/standard/tag/el/xml/Test35216.jsp
Author: bayard
Date: Wed Jan 3 12:07:58 2007
New Revision: 492277
URL: http://svn.apache.org/viewvc?view=rev&rev=492277
Log:
Applying Rahul's patch and my test case for #35216 - the illegal state exception is protected from via a != null
Added:
jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/xml/Test35216.java (with props)
jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/xml/Test35216.jsp (with props)
Modified:
jakarta/taglibs/proper/standard/trunk/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java
Modified: jakarta/taglibs/proper/standard/trunk/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java
URL: http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java?view=diff&rev=492277&r1=492276&r2=492277
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java (original)
+++ jakarta/taglibs/proper/standard/trunk/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java Wed Jan 3 12:07:58 2007
@@ -97,17 +97,24 @@
variableVector.addElement( new QName(null, varName ) );
globalVarSize++;
}
- 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 );
- globalVarSize++;
- variableVector.addElement( new QName(null, varName ) );
- globalVarSize++;
+
+ if (pageContext.getSession() != null) {
+ // 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);
+ //Adding both namespace qualified QName and just localName
+ variableVector.addElement( varQName );
+ globalVarSize++;
+ variableVector.addElement( new QName(null, varName ) );
+ globalVarSize++;
+ }
}
+
enum_ = pageContext.getAttributeNamesInScope(
PageContext.APPLICATION_SCOPE );
while ( enum_.hasMoreElements() ) {
Added: jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/xml/Test35216.java
URL: http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/xml/Test35216.java?view=auto&rev=492277
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/xml/Test35216.java (added)
+++ jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/xml/Test35216.java Wed Jan 3 12:07:58 2007
@@ -0,0 +1,43 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.taglibs.standard.tag.el.xml;
+
+import javax.servlet.jsp.*;
+import org.apache.cactus.*;
+import org.apache.taglibs.standard.testutil.TestUtil;
+
+public class Test35216 extends JspTestCase {
+
+ public Test35216(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void test35216() throws Exception {
+ String toInclude = TestUtil.getTestJsp(this);
+ pageContext.include(toInclude);
+
+ // fail case throws an exception; so nothing further needed
+ }
+}
Propchange: jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/xml/Test35216.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/xml/Test35216.jsp
URL: http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/xml/Test35216.jsp?view=auto&rev=492277
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/xml/Test35216.jsp (added)
+++ jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/xml/Test35216.jsp Wed Jan 3 12:07:58 2007
@@ -0,0 +1,8 @@
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
+
+<x:parse xml="<content/>" var="doc" scope="request" />
+
+<x:forEach select="$doc//*">
+ foo
+</x:forEach>
Propchange: jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/xml/Test35216.jsp
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org