Author: remy.maucherat(a)jboss.com
Date: 2009-07-20 12:46:09 -0400 (Mon, 20 Jul 2009)
New Revision: 1139
Modified:
trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/compiler/JspConfig.java
trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
trunk/java/org/apache/tomcat/util/res/StringManager.java
trunk/webapps/docs/changelog.xml
Log:
- Port Tomcat patches.
- JspConfig needs reasonable thread safety.
- Type coercion for certain EL expressions.
- Improve StringManager.
Modified: trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
===================================================================
--- trunk/java/org/apache/catalina/filters/WebdavFixFilter.java 2009-07-20 16:06:34 UTC
(rev 1138)
+++ trunk/java/org/apache/catalina/filters/WebdavFixFilter.java 2009-07-20 16:46:09 UTC
(rev 1139)
@@ -74,11 +74,9 @@
private static final String UA_MINIDIR_5_2_3790 =
"Microsoft-WebDAV-MiniRedir/5.2.3790";
- @Override
public void init(FilterConfig filterConfig) throws ServletException {
}
- @Override
public void destroy() {
}
@@ -86,7 +84,6 @@
* Check for the broken MS WebDAV client and if detected issue a re-direct
* that hopefully will cause the non-broken client to be used.
*/
- @Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (!(request instanceof HttpServletRequest) ||
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2009-07-20 16:06:34 UTC (rev
1138)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2009-07-20 16:46:09 UTC (rev
1139)
@@ -863,6 +863,10 @@
// Composite expression - must coerce to String
type = String.class;
}
+ if (i+1 < size) {
+ // Composite expression - must coerce to String
+ type = String.class;
+ }
output.append(quote(tx.substring(mark, i)));
}
mark = i;
Modified: trunk/java/org/apache/jasper/compiler/JspConfig.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JspConfig.java 2009-07-20 16:06:34 UTC (rev
1138)
+++ trunk/java/org/apache/jasper/compiler/JspConfig.java 2009-07-20 16:46:09 UTC (rev
1139)
@@ -92,88 +92,91 @@
private void init() throws JasperException {
if (!initialized) {
- //processWebDotXml(ctxt);
- HashMap<String, org.apache.catalina.deploy.JspPropertyGroup>
jspPropertyGroups =
- (HashMap<String, org.apache.catalina.deploy.JspPropertyGroup>)
- ctxt.getAttribute(Globals.JSP_PROPERTY_GROUPS);
+ synchronized (this) {
+ if (!initialized) {
+ HashMap<String, org.apache.catalina.deploy.JspPropertyGroup>
jspPropertyGroups =
+ (HashMap<String,
org.apache.catalina.deploy.JspPropertyGroup>)
+ ctxt.getAttribute(Globals.JSP_PROPERTY_GROUPS);
- String versionString = (String) ctxt.getAttribute(Globals.SERVLET_VERSION);
- double version = 2.3;
- if (versionString != null) {
- try {
- version = Double.parseDouble(versionString);
- } catch (NumberFormatException e) {
- }
- }
- if (version < 2.4) {
- defaultIsELIgnored = "true";
- }
-
- jspProperties = new ArrayList<JspPropertyGroup>();
- Iterator<String> urlPatternIterator =
jspPropertyGroups.keySet().iterator();
- while (urlPatternIterator.hasNext()) {
- String urlPattern = urlPatternIterator.next();
- org.apache.catalina.deploy.JspPropertyGroup jspPropertyGroup =
- jspPropertyGroups.get(urlPattern);
-
- String path = null;
- String extension = null;
-
- if (urlPattern.indexOf('*') < 0) {
- // Exact match
- path = urlPattern;
- } else {
- int i = urlPattern.lastIndexOf('/');
- String file;
- if (i >= 0) {
- path = urlPattern.substring(0,i+1);
- file = urlPattern.substring(i+1);
- } else {
- file = urlPattern;
+ String versionString = (String)
ctxt.getAttribute(Globals.SERVLET_VERSION);
+ double version = 2.3;
+ if (versionString != null) {
+ try {
+ version = Double.parseDouble(versionString);
+ } catch (NumberFormatException e) {
+ }
}
+ if (version < 2.4) {
+ defaultIsELIgnored = "true";
+ }
- // pattern must be "*", or of the form "*.jsp"
- if (file.equals("*")) {
- extension = "*";
- } else if (file.startsWith("*.")) {
- extension = file.substring(file.indexOf('.')+1);
+ jspProperties = new ArrayList<JspPropertyGroup>();
+ Iterator<String> urlPatternIterator =
jspPropertyGroups.keySet().iterator();
+ while (urlPatternIterator.hasNext()) {
+ String urlPattern = urlPatternIterator.next();
+ org.apache.catalina.deploy.JspPropertyGroup jspPropertyGroup =
+ jspPropertyGroups.get(urlPattern);
+
+ String path = null;
+ String extension = null;
+
+ if (urlPattern.indexOf('*') < 0) {
+ // Exact match
+ path = urlPattern;
+ } else {
+ int i = urlPattern.lastIndexOf('/');
+ String file;
+ if (i >= 0) {
+ path = urlPattern.substring(0,i+1);
+ file = urlPattern.substring(i+1);
+ } else {
+ file = urlPattern;
+ }
+
+ // pattern must be "*", or of the form
"*.jsp"
+ if (file.equals("*")) {
+ extension = "*";
+ } else if (file.startsWith("*.")) {
+ extension = file.substring(file.indexOf('.')+1);
+ }
+
+ // The url patterns are reconstructed as the follwoing:
+ // path != null, extension == null: / or /foo/bar.ext
+ // path == null, extension != null: *.ext
+ // path != null, extension == "*": /foo/*
+ boolean isStar = "*".equals(extension);
+ if ((path == null && (extension == null || isStar))
+ || (path != null && !isStar)) {
+ log.warn(Localizer.getMessage(
+
"jsp.warning.bad.urlpattern.propertygroup",
+ urlPattern));
+ continue;
+ }
+ }
+
+ JspProperty property = new
JspProperty(jspPropertyGroup.getIsXml(),
+ jspPropertyGroup.getElIgnored(),
+ jspPropertyGroup.getScriptingInvalid(),
+ jspPropertyGroup.getPageEncoding(),
+ jspPropertyGroup.getIncludePreludes(),
+ jspPropertyGroup.getIncludeCodas(),
+ jspPropertyGroup.getDeferredSyntaxAllowedAsLiteral(),
+ jspPropertyGroup.getTrimDirectiveWhitespaces());
+ JspPropertyGroup propertyGroup =
+ new JspPropertyGroup(path, extension, property);
+
+ jspProperties.add(propertyGroup);
+
}
- // The url patterns are reconstructed as the follwoing:
- // path != null, extension == null: / or /foo/bar.ext
- // path == null, extension != null: *.ext
- // path != null, extension == "*": /foo/*
- boolean isStar = "*".equals(extension);
- if ((path == null && (extension == null || isStar))
- || (path != null && !isStar)) {
- log.warn(Localizer.getMessage(
- "jsp.warning.bad.urlpattern.propertygroup",
- urlPattern));
- continue;
- }
+ defaultJspProperty = new JspProperty(defaultIsXml,
+ defaultIsELIgnored,
+ defaultIsScriptingInvalid,
+ null, null, null, defaultDeferedSyntaxAllowedAsLiteral,
+ defaultTrimDirectiveWhitespaces);
+ initialized = true;
}
-
- JspProperty property = new JspProperty(jspPropertyGroup.getIsXml(),
- jspPropertyGroup.getElIgnored(),
- jspPropertyGroup.getScriptingInvalid(),
- jspPropertyGroup.getPageEncoding(),
- jspPropertyGroup.getIncludePreludes(),
- jspPropertyGroup.getIncludeCodas(),
- jspPropertyGroup.getDeferredSyntaxAllowedAsLiteral(),
- jspPropertyGroup.getTrimDirectiveWhitespaces());
- JspPropertyGroup propertyGroup =
- new JspPropertyGroup(path, extension, property);
-
- jspProperties.add(propertyGroup);
-
}
-
- defaultJspProperty = new JspProperty(defaultIsXml,
- defaultIsELIgnored,
- defaultIsScriptingInvalid,
- null, null, null, defaultDeferedSyntaxAllowedAsLiteral,
- defaultTrimDirectiveWhitespaces);
- initialized = true;
}
}
Modified: trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2009-07-20 16:06:34 UTC (rev
1138)
+++ trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2009-07-20 16:46:09 UTC (rev
1139)
@@ -24,7 +24,6 @@
import org.apache.jasper.Constants;
import org.apache.tomcat.InstanceManager;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
* Pool of tag handlers that can be reused.
@@ -35,8 +34,8 @@
private Tag[] handlers;
- public static String OPTION_TAGPOOL="tagpoolClassName";
- public static String OPTION_MAXSIZE="tagpoolMaxSize";
+ public static final String OPTION_TAGPOOL="tagpoolClassName";
+ public static final String OPTION_MAXSIZE="tagpoolMaxSize";
private Logger log = Logger.getLogger(TagHandlerPool.class);
Modified: trunk/java/org/apache/tomcat/util/res/StringManager.java
===================================================================
--- trunk/java/org/apache/tomcat/util/res/StringManager.java 2009-07-20 16:06:34 UTC (rev
1138)
+++ trunk/java/org/apache/tomcat/util/res/StringManager.java 2009-07-20 16:46:09 UTC (rev
1139)
@@ -69,9 +69,25 @@
*/
private StringManager(String packageName) {
String bundleName = packageName + ".LocalStrings";
- bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
+ try {
+ bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
+ } catch( MissingResourceException ex ) {
+ // Try from the current loader (that's the case for trusted apps)
+ // Should only be required if using a TC5 style classloader structure
+ // where common != shared != server
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if( cl != null ) {
+ try {
+ bundle = ResourceBundle.getBundle(
+ bundleName, Locale.getDefault(), cl);
+ } catch(MissingResourceException ex2) {
+ }
+ }
+ }
// Get the actual locale, which may be different from the requested one
- locale = bundle.getLocale();
+ if (bundle != null) {
+ locale = bundle.getLocale();
+ }
}
/**
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-07-20 16:06:34 UTC (rev 1138)
+++ trunk/webapps/docs/changelog.xml 2009-07-20 16:46:09 UTC (rev 1139)
@@ -162,6 +162,12 @@
<fix>
<bug>38797</bug>: Fix getProperty code to what it used to be in
Tomcat 5.5.12. (markt)
</fix>
+ <fix>
+ <bug>41661</bug>: JspConfig.init() needs a minimal amount of thread
safety. (markt)
+ </fix>
+ <fix>
+ <bug>47413</bug>: First part of a composite expression
"${a}${b}" was not coerced to String. (kkolinko)
+ </fix>
</changelog>
</subsection>
</section>