Author: remy.maucherat(a)jboss.com
Date: 2008-09-27 13:44:11 -0400 (Sat, 27 Sep 2008)
New Revision: 793
Modified:
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
trunk/java/org/apache/catalina/ssi/SSIMediator.java
trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java
trunk/java/org/apache/naming/resources/BaseDirContext.java
trunk/java/org/apache/naming/resources/ProxyDirContext.java
trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
trunk/webapps/docs/changelog.xml
Log:
- Port the bunch of fixes found by usage of the auto tool.
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2008-09-25 14:54:16 UTC (rev
792)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2008-09-27 17:44:11 UTC (rev
793)
@@ -244,7 +244,7 @@
/**
* The broadcaster that sends j2ee notifications.
*/
- private NotificationBroadcasterSupport broadcaster = null;
+ private transient NotificationBroadcasterSupport broadcaster = null;
/**
* The Locale to character set mapper for this application.
@@ -401,7 +401,7 @@
/**
* The mapper associated with this context.
*/
- private org.apache.tomcat.util.http.mapper.Mapper mapper =
+ private transient org.apache.tomcat.util.http.mapper.Mapper mapper =
new org.apache.tomcat.util.http.mapper.Mapper();
@@ -640,6 +640,12 @@
/**
+ * Cache object max size in KB.
+ */
+ protected int cacheObjectMaxSize = 256; // 256K
+
+
+ /**
* Cache TTL in ms.
*/
protected int cacheTTL = 5000;
@@ -803,6 +809,22 @@
/**
+ * Return the maximum size of objects to be cached in KB.
+ */
+ public int getCacheObjectMaxSize() {
+ return cacheObjectMaxSize;
+ }
+
+
+ /**
+ * Set the maximum size of objects to be placed the cache in KB.
+ */
+ public void setCacheObjectMaxSize(int cacheObjectMaxSize) {
+ this.cacheObjectMaxSize = cacheObjectMaxSize;
+ }
+
+
+ /**
* Return the "follow standard delegation model" flag used to configure
* our ClassLoader.
*/
@@ -1896,6 +1918,7 @@
((BaseDirContext) resources).setCached(isCachingAllowed());
((BaseDirContext) resources).setCacheTTL(getCacheTTL());
((BaseDirContext) resources).setCacheMaxSize(getCacheMaxSize());
+ ((BaseDirContext) resources).setCacheObjectMaxSize(getCacheObjectMaxSize());
}
if (resources instanceof FileDirContext) {
filesystemBased = true;
Modified: trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
===================================================================
--- trunk/java/org/apache/catalina/core/mbeans-descriptors.xml 2008-09-25 14:54:16 UTC
(rev 792)
+++ trunk/java/org/apache/catalina/core/mbeans-descriptors.xml 2008-09-27 17:44:11 UTC
(rev 793)
@@ -41,6 +41,10 @@
description="Maximum cache size in KB"
type="int"/>
+ <attribute name="cacheObjectMaxSize"
+ description="Maximum cached object size in KB"
+ type="int"/>
+
<attribute name="cacheTTL"
description="Time interval in ms between cache refeshes"
type="int"/>
Modified: trunk/java/org/apache/catalina/ssi/SSIMediator.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIMediator.java 2008-09-25 14:54:16 UTC (rev 792)
+++ trunk/java/org/apache/catalina/ssi/SSIMediator.java 2008-09-27 17:44:11 UTC (rev 793)
@@ -211,10 +211,10 @@
if (val.indexOf('$') < 0 && val.indexOf('&') <
0) return val;
// HTML decoding
- val.replace("<", "<");
- val.replace(">", ">");
- val.replace(""", "\"");
- val.replace("&", "&");
+ val = val.replace("<", "<");
+ val = val.replace(">", ">");
+ val = val.replace(""", "\"");
+ val = val.replace("&", "&");
StringBuffer sb = new StringBuffer(val);
int charStart = sb.indexOf("&#");
Modified: trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java
===================================================================
--- trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java 2008-09-25 14:54:16 UTC (rev
792)
+++ trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java 2008-09-27 17:44:11 UTC (rev
793)
@@ -112,7 +112,7 @@
}
int count = fInputStream.read(fBuffer, 0, length);
for (int i = 0; i < count; i++) {
- int b0 = fBuffer[i];
+ int b0 = (0xff & fBuffer[i]); // Convert to unsigned
if (b0 > 0x80) {
throw new
IOException(Localizer.getMessage("jsp.error.xml.invalidASCII",
Integer.toString(b0)));
Modified: trunk/java/org/apache/naming/resources/BaseDirContext.java
===================================================================
--- trunk/java/org/apache/naming/resources/BaseDirContext.java 2008-09-25 14:54:16 UTC
(rev 792)
+++ trunk/java/org/apache/naming/resources/BaseDirContext.java 2008-09-27 17:44:11 UTC
(rev 793)
@@ -105,11 +105,17 @@
/**
- * Max size of resources which will have their content cached.
+ * Max size of cache.
*/
protected int cacheMaxSize = 10240; // 10 MB
+ /**
+ * Max size of resources that will be content cached.
+ */
+ protected int cacheObjectMaxSize = 256; // 256 K
+
+
// ------------------------------------------------------------- Properties
@@ -192,6 +198,22 @@
}
+ /**
+ * Return the maximum size of objects to be cached in KB.
+ */
+ public int getCacheObjectMaxSize() {
+ return cacheObjectMaxSize;
+ }
+
+
+ /**
+ * Set the maximum size of objects to be placed the cache in KB.
+ */
+ public void setCacheObjectMaxSize(int cacheObjectMaxSize) {
+ this.cacheObjectMaxSize = cacheObjectMaxSize;
+ }
+
+
// --------------------------------------------------------- Public Methods
Modified: trunk/java/org/apache/naming/resources/ProxyDirContext.java
===================================================================
--- trunk/java/org/apache/naming/resources/ProxyDirContext.java 2008-09-25 14:54:16 UTC
(rev 792)
+++ trunk/java/org/apache/naming/resources/ProxyDirContext.java 2008-09-27 17:44:11 UTC
(rev 793)
@@ -76,7 +76,12 @@
}
cache.setCacheMaxSize(baseDirContext.getCacheMaxSize());
cacheTTL = baseDirContext.getCacheTTL();
- cacheObjectMaxSize = baseDirContext.getCacheMaxSize() / 20;
+ cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();
+ // cacheObjectMaxSize must be less than cacheMaxSize
+ // Set a sensible limit
+ if (cacheObjectMaxSize > baseDirContext.getCacheMaxSize()/32) {
+ cacheObjectMaxSize = baseDirContext.getCacheMaxSize()/32;
+ }
}
}
hostName = (String) env.get(HOST);
Modified: trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
===================================================================
--- trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2008-09-25 14:54:16 UTC (rev
792)
+++ trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2008-09-27 17:44:11 UTC (rev
793)
@@ -477,6 +477,9 @@
*/
public static String replaceProperties(String value, Hashtable staticProp,
PropertySource dynamicProp[]) {
+ if (value.indexOf("$") < 0) {
+ return value;
+ }
StringBuffer sb = new StringBuffer();
int prev = 0;
// assert value!=nil
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-09-25 14:54:16 UTC (rev 792)
+++ trunk/webapps/docs/changelog.xml 2008-09-27 17:44:11 UTC (rev 793)
@@ -37,6 +37,12 @@
<add>
LockOutRealm to lock out users after a number of failed authentication attempts.
(markt)
</add>
+ <fix>
+ Fix SSI HTML replacement bug. (markt)
+ </fix>
+ <fix>
+ Tighten up the max size for content caching (which is often useless due to
sendfile). (markt, remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -44,6 +50,10 @@
<add>
Package renamed JSON library. (remm)
</add>
+ <fix>
+ IntrospectionUtils.replaceProperties should return the original String if no
substitutions are
+ needed. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
@@ -65,6 +75,9 @@
<fix>
Remove unused code in ELSupport. (markt)
</fix>
+ <fix>
+ Ascii parsing bug. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Others">