Author: remy.maucherat(a)jboss.com
Date: 2008-01-02 05:28:19 -0500 (Wed, 02 Jan 2008)
New Revision: 384
Modified:
trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
trunk/java/org/apache/catalina/realm/JAASRealm.java
trunk/java/org/apache/el/lang/ELArithmetic.java
trunk/java/org/apache/el/lang/EvaluationContext.java
trunk/java/org/apache/el/parser/AstValue.java
trunk/java/org/apache/jasper/compiler/Node.java
trunk/webapps/docs/changelog.xml
Log:
- Minor Tomcat patches (Jasper, JAAS realm).
Modified: trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java 2007-12-23 21:53:10 UTC
(rev 383)
+++ trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java 2008-01-02 10:28:19 UTC
(rev 384)
@@ -982,7 +982,7 @@
" <td class=\"row-left\" bgcolor=\"{13}\">\n"
+
" <form method=\"POST\" action=\"{8}\">\n"
+
" <small>\n" +
- " <input type=\"submit\"
value=\"{9}\"> {10} <input type=\"text\"
name=\"expire\" size=\"5\"
value=\"{11}\"> {12} \n" +
+ " <input type=\"submit\"
value=\"{9}\"> {10} <input type=\"text\"
name=\"idle\" size=\"5\"
value=\"{11}\"> {12} \n" +
" </small>\n" +
" </form>\n" +
" </td>\n" +
@@ -1001,7 +1001,7 @@
" <td class=\"row-left\" bgcolor=\"{13}\">\n"
+
" <form method=\"POST\" action=\"{8}\">\n"
+
" <small>\n" +
- " <input type=\"submit\"
value=\"{9}\"> {10} <input type=\"text\"
name=\"expire\" size=\"5\"
value=\"{11}\"> {12} \n" +
+ " <input type=\"submit\"
value=\"{9}\"> {10} <input type=\"text\"
name=\"idle\" size=\"5\"
value=\"{11}\"> {12} \n" +
" </small>\n" +
" </form>\n" +
" </td>\n" +
Modified: trunk/java/org/apache/catalina/realm/JAASRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/JAASRealm.java 2007-12-23 21:53:10 UTC (rev 383)
+++ trunk/java/org/apache/catalina/realm/JAASRealm.java 2008-01-02 10:28:19 UTC (rev 384)
@@ -35,7 +35,6 @@
import org.apache.catalina.LifecycleException;
import org.apache.catalina.util.StringManager;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
@@ -120,7 +119,7 @@
*
* @author Craig R. McClanahan
* @author Yoav Shapira
- * @version $Revision: 522356 $ $Date: 2007-03-25 23:42:05 +0200 (dim., 25 mars 2007) $
+ * @version $Revision: 607339 $ $Date: 2007-12-28 22:31:46 +0100 (Fri, 28 Dec 2007) $
*/
public class JAASRealm
@@ -214,7 +213,7 @@
* @return The value of useContextClassLoader
*/
public boolean isUseContextClassLoader() {
- return useContextClassLoader;
+ return useContextClassLoader;
}
public void setContainer(Container container) {
@@ -241,21 +240,19 @@
}
/**
- * Sets the list of comma-delimited classes that represent
- * roles. The classes in the list must implement
<code>java.security.Principal</code>.
- * When this accessor is called (for example, by a
<code>Digester</code>
- * instance parsing the
- * configuration file), it will parse the class names and store the resulting
- * string(s) into the <code>ArrayList</code> field
</code>roleClasses</code>.
+ * Sets the list of comma-delimited classes that represent roles. The
+ * classes in the list must implement
<code>java.security.Principal</code>.
+ * The supplied list of classes will be parsed when {@link #start()} is
+ * called.
*/
public void setRoleClassNames(String roleClassNames) {
this.roleClassNames = roleClassNames;
- parseClassNames(roleClassNames, roleClasses);
}
/**
* Parses a comma-delimited list of class names, and store the class names
- * in the provided List. Each class must implement
<codejava.security.Principal</code>.
+ * in the provided List. Each class must implement
+ * <code>java.security.Principal</code>.
*
* @param classNamesString a comma-delimited list of fully qualified class names.
* @param classNamesList the list in which the class names will be stored.
@@ -264,12 +261,17 @@
protected void parseClassNames(String classNamesString, List<String>
classNamesList) {
classNamesList.clear();
if (classNamesString == null) return;
-
+
+ ClassLoader loader = this.getClass().getClassLoader();
+ if (isUseContextClassLoader())
+ loader = Thread.currentThread().getContextClassLoader();
+
String[] classNames = classNamesString.split("[ ]*,[ ]*");
for (int i=0; i<classNames.length; i++) {
if (classNames[i].length()==0) continue;
try {
- Class principalClass = Class.forName(classNames[i]);
+ Class principalClass = Class.forName(classNames[i], false,
+ loader);
if (Principal.class.isAssignableFrom(principalClass)) {
classNamesList.add(classNames[i]);
} else {
@@ -293,16 +295,13 @@
}
/**
- * Sets the list of comma-delimited classes that represent individual
- * users. The classes in the list must implement
<code>java.security.Principal</code>.
- * When this accessor is called (for example, by a <code>Digester</code>
- * instance parsing the
- * configuration file), it will parse the class names and store the resulting
- * string(s) into the <code>ArrayList</code> field
</code>userClasses</code>.
- */
+ * Sets the list of comma-delimited classes that represent individual
+ * users. The classes in the list must implement
+ * <code>java.security.Principal</code>. The supplied list of classes
will
+ * be parsed when {@link #start()} is called.
+ */
public void setUserClassNames(String userClassNames) {
this.userClassNames = userClassNames;
- parseClassNames(userClassNames, userClasses);
}
@@ -335,9 +334,10 @@
// What if the LoginModule is in the container class loader ?
ClassLoader ocl = null;
- if (isUseContextClassLoader()) {
- ocl=Thread.currentThread().getContextClassLoader();
-
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ if (!isUseContextClassLoader()) {
+ ocl = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(
+ this.getClass().getClassLoader());
}
try {
@@ -348,7 +348,7 @@
log.error(sm.getString("jaasRealm.unexpectedError"), e);
return (null);
} finally {
- if( isUseContextClassLoader()) {
+ if(!isUseContextClassLoader()) {
Thread.currentThread().setContextClassLoader(ocl);
}
}
@@ -457,15 +457,14 @@
*/
protected Principal createPrincipal(String username, Subject subject) {
// Prepare to scan the Principals for this Subject
- String password = null; // Will not be carried forward
List<String> roles = new ArrayList<String>();
Principal userPrincipal = null;
// Scan the Principals for this Subject
- Iterator principals = subject.getPrincipals().iterator();
+ Iterator<Principal> principals = subject.getPrincipals().iterator();
while (principals.hasNext()) {
- Principal principal = (Principal) principals.next();
+ Principal principal = principals.next();
String principalClass = principal.getClass().getName();
@@ -548,6 +547,10 @@
// Perform normal superclass initialization
super.start();
+ // These need to be called after loading configuration, in case
+ // useContextClassLoader appears after them in xml config
+ parseClassNames(userClassNames, userClasses);
+ parseClassNames(roleClassNames, roleClasses);
}
Modified: trunk/java/org/apache/el/lang/ELArithmetic.java
===================================================================
--- trunk/java/org/apache/el/lang/ELArithmetic.java 2007-12-23 21:53:10 UTC (rev 383)
+++ trunk/java/org/apache/el/lang/ELArithmetic.java 2008-01-02 10:28:19 UTC (rev 384)
@@ -364,8 +364,8 @@
return coerce(new Short((short) ((Character) obj).charValue()));
}
- throw new IllegalArgumentException(MessageFactory.get("el.convert",
obj,
- objType));
+ throw new IllegalArgumentException(MessageFactory.get("error.convert",
+ obj, objType, "Number"));
}
protected abstract Number coerce(final String str);
Modified: trunk/java/org/apache/el/lang/EvaluationContext.java
===================================================================
--- trunk/java/org/apache/el/lang/EvaluationContext.java 2007-12-23 21:53:10 UTC (rev
383)
+++ trunk/java/org/apache/el/lang/EvaluationContext.java 2008-01-02 10:28:19 UTC (rev
384)
@@ -17,6 +17,7 @@
package org.apache.el.lang;
+import java.util.Locale;
import javax.el.ELContext;
import javax.el.ELResolver;
import javax.el.FunctionMapper;
@@ -68,4 +69,12 @@
public void setPropertyResolved(boolean resolved) {
this.elContext.setPropertyResolved(resolved);
}
+
+ public Locale getLocale() {
+ return this.elContext.getLocale();
+ }
+
+ public void setLocale(Locale locale) {
+ this.elContext.setLocale(locale);
+ }
}
Modified: trunk/java/org/apache/el/parser/AstValue.java
===================================================================
--- trunk/java/org/apache/el/parser/AstValue.java 2007-12-23 21:53:10 UTC (rev 383)
+++ trunk/java/org/apache/el/parser/AstValue.java 2008-01-02 10:28:19 UTC (rev 384)
@@ -10,6 +10,7 @@
import javax.el.MethodInfo;
import javax.el.PropertyNotFoundException;
+import org.apache.el.lang.ELSupport;
import org.apache.el.lang.EvaluationContext;
import org.apache.el.util.MessageFactory;
import org.apache.el.util.ReflectionUtil;
@@ -111,7 +112,11 @@
throws ELException {
Target t = getTarget(ctx);
ctx.setPropertyResolved(false);
- ctx.getELResolver().setValue(ctx, t.base, t.property, value);
+ ELResolver resolver = ctx.getELResolver();
+ resolver.setValue(ctx, t.base, t.property,
+ // coerce to the expected type
+ ELSupport.coerceToType(value,
+ resolver.getType(ctx, t.base, t.property)));
}
public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes)
Modified: trunk/java/org/apache/jasper/compiler/Node.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Node.java 2007-12-23 21:53:10 UTC (rev 383)
+++ trunk/java/org/apache/jasper/compiler/Node.java 2008-01-02 10:28:19 UTC (rev 384)
@@ -831,12 +831,17 @@
*/
public String getText() {
String ret = text;
- if ((ret == null) && (body != null)) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < body.size(); i++) {
- buf.append(body.getNode(i).getText());
+ if (ret == null) {
+ if (body != null) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < body.size(); i++) {
+ buf.append(body.getNode(i).getText());
+ }
+ ret = buf.toString();
+ } else {
+ // Nulls cause NPEs further down the line
+ ret = "";
}
- ret = buf.toString();
}
return ret;
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2007-12-23 21:53:10 UTC (rev 383)
+++ trunk/webapps/docs/changelog.xml 2008-01-02 10:28:19 UTC (rev 384)
@@ -120,6 +120,10 @@
<bug>43241</bug>: Make ServletContext.getResourceAsStream() conform
to
the specification. Patch provided by John Kew. (markt)
</fix>
+ <fix>
+ <bug>44084</bug>: JASSRealm was broken for application provided
+ Principals. Patch provided by Noah Levitt. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -153,6 +157,20 @@
in the JSP with the error, use the SMAP info and the knowledge that for
a scriptlet there is a one to one line mapping. (markt)
</fix>
+ <fix>
+ <bug>43285</bug>: Missing EL Coercion causes argument type mismatch.
+ Patch provided by Bernhard Huemer. (funkman/jim)
+ </fix>
+ <fix>
+ <bug>43909</bug>: Make sure locale maps to wrapped ELContext. Patch
+ provided by Tuomas Kiviaho. (markt)
+ </fix>
+ <fix>
+ <bug>43944</bug>: Fix a missing resource exception. (markt)
+ </fix>
+ <fix>
+ <bug>43758</bug>: Fix NPE with empty scripting elements. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Webapps">
@@ -162,6 +180,9 @@
for a context defined in server.xml rather than failing silently.
(markt)
</fix>
+ <fix>
+ <bug>44088</bug>: Fix expire session button in manager. (markt)
+ </fix>
</changelog>
</subsection>
</section>