JBossWeb SVN: r1240 - in trunk/java/org/apache/catalina: core and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-04 17:25:59 -0500 (Wed, 04 Nov 2009)
New Revision: 1240
Modified:
trunk/java/org/apache/catalina/Wrapper.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
Log:
- The behavior of setServletSecurity has been simplified, avoiding the need to save what the pattern set was at the time
the method was called.
Modified: trunk/java/org/apache/catalina/Wrapper.java
===================================================================
--- trunk/java/org/apache/catalina/Wrapper.java 2009-11-04 22:24:35 UTC (rev 1239)
+++ trunk/java/org/apache/catalina/Wrapper.java 2009-11-04 22:25:59 UTC (rev 1240)
@@ -429,18 +429,10 @@
/**
* Set an associated ServletSecurity.
- */
- public void setServletSecurity(ServletSecurityElement servletSecurity);
-
-
- /**
- * Set an associated ServletSecurity on mappings which are currently associated
- * with the Servlet. This will not set security on patters which are currently
- * defined in a security constraint.
- *
+ *
* @return the set of patterns for which the servlet security will not be defined
- */
- public Set<String> setServletSecurityOnCurrentMappings(ServletSecurityElement servletSecurity);
+ */
+ public Set<String> setServletSecurity(ServletSecurityElement servletSecurity);
/**
@@ -448,9 +440,4 @@
*/
public ServletSecurityElement getServletSecurity();
- /**
- * Get an associated ServletSecurity patterns, if any.
- */
- public Set<String> getServletSecurityPatterns();
-
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-11-04 22:24:35 UTC (rev 1239)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-11-04 22:25:59 UTC (rev 1240)
@@ -231,12 +231,6 @@
/**
- * Associated servlet security patterns.
- */
- protected Set<String> servletSecurityPatterns = null;
-
-
- /**
* The notification sequence number.
*/
protected long sequenceNumber = 0;
@@ -654,39 +648,28 @@
/**
- * Set an associated ServletSecurity.
- */
- public void setServletSecurity(ServletSecurityElement servletSecurity) {
- ServletSecurityElement oldServletSecurity = this.servletSecurity;
- this.servletSecurity = servletSecurity;
- support.firePropertyChange("servletSecurity", oldServletSecurity, this.servletSecurity);
- }
-
-
- /**
* Set an associated ServletSecurity on mappings which are currently associated
* with the Servlet. This will not set security on patters which are currently
* defined in a security constraint.
*
* @return the set of patterns for which the servlet security will not be defined
*/
- public Set<String> setServletSecurityOnCurrentMappings(ServletSecurityElement servletSecurity) {
+ public Set<String> setServletSecurity(ServletSecurityElement servletSecurity) {
ServletSecurityElement oldServletSecurity = this.servletSecurity;
this.servletSecurity = servletSecurity;
support.firePropertyChange("servletSecurity", oldServletSecurity, this.servletSecurity);
// Now find to which mappings this servlet security will apply, and return the list
// for which is will not apply
Set<String> ignoredPatterns = new HashSet<String>();
- servletSecurityPatterns = new HashSet<String>();
+ HashSet<String> currentMappings = new HashSet<String>();
for (String mapping : findMappings()) {
- servletSecurityPatterns.add(mapping);
+ currentMappings.add(mapping);
}
SecurityConstraint[] constraints = ((Context) getParent()).findConstraints();
for (SecurityConstraint constraint : constraints) {
for (SecurityCollection collection : constraint.findCollections()) {
for (String pattern : collection.findPatterns()) {
- if (servletSecurityPatterns.contains(pattern)) {
- servletSecurityPatterns.remove(pattern);
+ if (currentMappings.contains(pattern)) {
ignoredPatterns.add(pattern);
}
}
@@ -697,14 +680,6 @@
/**
- * Get an associated ServletSecurity patterns, if any.
- */
- public Set<String> getServletSecurityPatterns() {
- return servletSecurityPatterns;
- }
-
-
- /**
* Return the fully qualified servlet class name for this servlet.
*/
public String getServletClass() {
Modified: trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-11-04 22:24:35 UTC (rev 1239)
+++ trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-11-04 22:25:59 UTC (rev 1240)
@@ -291,7 +291,7 @@
if (servletSecurity == null) {
throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
}
- return wrapper.setServletSecurityOnCurrentMappings(servletSecurity);
+ return wrapper.setServletSecurity(servletSecurity);
}
public void setMultipartConfig(MultipartConfigElement multipartConfig) {
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-11-04 22:24:35 UTC (rev 1239)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-11-04 22:25:59 UTC (rev 1240)
@@ -2134,30 +2134,25 @@
}
SecurityCollection collection = new SecurityCollection();
collection.addMethod(httpMethodConstraint.getMethodName());
- if (wrapper.getServletSecurityPatterns() != null) {
- for (String urlPattern : wrapper.getServletSecurityPatterns()) {
- collection.addPattern(urlPattern);
- }
- } else {
- String[] urlPatterns = wrapper.findMappings();
- Set<String> servletSecurityPatterns = new HashSet<String>();
- for (String urlPattern : urlPatterns) {
- servletSecurityPatterns.add(urlPattern);
- }
- SecurityConstraint[] constraints = context.findConstraints();
- for (SecurityConstraint constraint2 : constraints) {
- for (SecurityCollection collection2 : constraint2.findCollections()) {
- for (String urlPattern : collection2.findPatterns()) {
- if (servletSecurityPatterns.contains(urlPattern)) {
- servletSecurityPatterns.remove(urlPattern);
- }
+ // Determine pattern set
+ String[] urlPatterns = wrapper.findMappings();
+ Set<String> servletSecurityPatterns = new HashSet<String>();
+ for (String urlPattern : urlPatterns) {
+ servletSecurityPatterns.add(urlPattern);
+ }
+ SecurityConstraint[] constraints = context.findConstraints();
+ for (SecurityConstraint constraint2 : constraints) {
+ for (SecurityCollection collection2 : constraint2.findCollections()) {
+ for (String urlPattern : collection2.findPatterns()) {
+ if (servletSecurityPatterns.contains(urlPattern)) {
+ servletSecurityPatterns.remove(urlPattern);
}
}
}
- for (String urlPattern : servletSecurityPatterns) {
- collection.addPattern(urlPattern);
- }
}
+ for (String urlPattern : servletSecurityPatterns) {
+ collection.addPattern(urlPattern);
+ }
constraint.addCollection(collection);
context.addConstraint(constraint);
}
@@ -2185,30 +2180,25 @@
constraint.setUserConstraint(org.apache.catalina.realm.Constants.CONFIDENTIAL_TRANSPORT);
}
SecurityCollection collection = new SecurityCollection();
- if (wrapper.getServletSecurityPatterns() != null) {
- for (String urlPattern : wrapper.getServletSecurityPatterns()) {
- collection.addPattern(urlPattern);
- }
- } else {
- String[] urlPatterns = wrapper.findMappings();
- Set<String> servletSecurityPatterns = new HashSet<String>();
- for (String urlPattern : urlPatterns) {
- servletSecurityPatterns.add(urlPattern);
- }
- SecurityConstraint[] constraints = context.findConstraints();
- for (SecurityConstraint constraint2 : constraints) {
- for (SecurityCollection collection2 : constraint2.findCollections()) {
- for (String urlPattern : collection2.findPatterns()) {
- if (servletSecurityPatterns.contains(urlPattern)) {
- servletSecurityPatterns.remove(urlPattern);
- }
+ // Determine pattern set
+ String[] urlPatterns = wrapper.findMappings();
+ Set<String> servletSecurityPatterns = new HashSet<String>();
+ for (String urlPattern : urlPatterns) {
+ servletSecurityPatterns.add(urlPattern);
+ }
+ SecurityConstraint[] constraints = context.findConstraints();
+ for (SecurityConstraint constraint2 : constraints) {
+ for (SecurityCollection collection2 : constraint2.findCollections()) {
+ for (String urlPattern : collection2.findPatterns()) {
+ if (servletSecurityPatterns.contains(urlPattern)) {
+ servletSecurityPatterns.remove(urlPattern);
}
}
}
- for (String urlPattern : servletSecurityPatterns) {
- collection.addPattern(urlPattern);
- }
}
+ for (String urlPattern : servletSecurityPatterns) {
+ collection.addPattern(urlPattern);
+ }
for (String methodOmission : methodOmissions) {
collection.addMethodOmission(methodOmission);
}
15 years, 2 months
JBossWeb SVN: r1239 - in trunk/java/javax/servlet: annotation and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-04 17:24:35 -0500 (Wed, 04 Nov 2009)
New Revision: 1239
Modified:
trunk/java/javax/servlet/ServletRegistration.java
trunk/java/javax/servlet/annotation/WebServlet.java
trunk/java/javax/servlet/http/Cookie.java
trunk/java/javax/servlet/http/LocalStrings.properties
Log:
- Today's spec update.
Modified: trunk/java/javax/servlet/ServletRegistration.java
===================================================================
--- trunk/java/javax/servlet/ServletRegistration.java 2009-11-04 18:02:20 UTC (rev 1238)
+++ trunk/java/javax/servlet/ServletRegistration.java 2009-11-04 22:24:35 UTC (rev 1239)
@@ -102,9 +102,9 @@
*
* <p>A <tt>loadOnStartup</tt> value of greater than or equal to
* zero indicates to the container the initialization priority of
- * the Servlet. In this case, the container must instantiate and
+ * the Servlet. In this case, the container must instantiate and
* initialize the Servlet during the initialization phase of the
- * ServletContext, that is, after it has invoked all of the
+ * ServletContext, that is, after it has invoked all of the
* ServletContextListener objects configured for the ServletContext
* at their {@link ServletContextListener#contextInitialized}
* method.
@@ -125,46 +125,47 @@
/**
* Sets the {@link ServletSecurityElement} to be applied to the
- * mappings currently assigned to this
- * <code>ServletRegistration</code>.
+ * mappings defined for this <code>ServletRegistration</code>.
*
- * <p>Any mappings added to this ServletRegistration after a call
- * to this method may be secured by a subsequent call to this method.
- *
- * <p>If a url-pattern of this ServletRegistration is an exact
- * target of a <code>security-constraint</code> that was established
- * via the portable deployment descriptor, then this method does not
- * change the <code>security-constraint</code> for that pattern, and
- * the pattern will be included in the return value.
- *
- * <p>If a url-pattern of this ServletRegistration is an exact target
- * of a security constraint that was established via the
- * {@link javax.servlet.annotation.ServletSecurity} annotation or a
- * previous call to this method, then this method replaces the
- * security constraint for that pattern.
+ * <p>This method applies to all mappings added to this
+ * <code>ServletRegistration</code> up until the point that the
+ * <code>ServletContext</code> from which it was obtained has been
+ * initialized.
*
- * <p>If a url-pattern of this ServletRegistration is neither the
- * exact target of a security constraint that was established via the
- * {@link javax.servlet.annotation.ServletSecurity} annotation or
- * a previous call to this method, nor the exact target of a
- * </code>security-constraint</code> in the portable deployment
- * descriptor, then this method establishes the security
- * constraint for that pattern from the argument
- * ServletSecurityElement.
+ * <p>If a URL pattern of this ServletRegistration is an exact target
+ * of a <code>security-constraint</code> that was established via
+ * the portable deployment descriptor, then this method does not
+ * change the <code>security-constraint</code> for that pattern,
+ * and the pattern will be included in the return value.
*
+ * <p>If a URL pattern of this ServletRegistration is an exact
+ * target of a security constraint that was established via the
+ * {@link javax.servlet.annotation.ServletSecurity} annotation
+ * or a previous call to this method, then this method replaces
+ * the security constraint for that pattern.
+ *
+ * <p>If a URL pattern of this ServletRegistration is neither the
+ * exact target of a security constraint that was established via
+ * the {@link javax.servlet.annotation.ServletSecurity} annotation
+ * or a previous call to this method, nor the exact target of a
+ * <code>security-constraint</code> in the portable deployment
+ * descriptor, then this method establishes the security constraint
+ * for that pattern from the argument
+ * <code>ServletSecurityElement</code>.
+ *
* @param constraint the {@link ServletSecurityElement} to be applied
- * to the patterns currently mapped to this ServletRegistration
+ * to the patterns mapped to this ServletRegistration
*
* @return the (possibly empty) Set of URL patterns that were already
* the exact target of a <code>security-constraint</code> that was
* established via the portable deployment descriptor. This method
- * has no effect on the patterns included in the returned set.
+ * has no effect on the patterns included in the returned set
*
* @throws IllegalArgumentException if <tt>constraint</tt> is null
*
* @throws IllegalStateException if the {@link ServletContext} from
- * which this ServletRegistration was obtained has already been
- * initialized
+ * which this <code>ServletRegistration</code> was obtained has
+ * already been initialized
*/
public Set<String> setServletSecurity(ServletSecurityElement constraint);
@@ -175,7 +176,7 @@
* effects of the former.
*
* @param multipartConfig the {@link MultipartConfigElement} to be
- * applied to the patterns mapped to the registration
+ * applied to the patterns mapped to the registration
*
* @throws IllegalArgumentException if <tt>multipartConfig</tt> is
* null
@@ -188,10 +189,10 @@
MultipartConfigElement multipartConfig);
/**
- * Sets the name of the runAs role for the
+ * Sets the name of the <code>runAs</code> role for this
* <code>ServletRegistration</code>.
*
- * @param roleName
+ * @param roleName the name of the <code>runAs</code> role
*
* @throws IllegalArgumentException if <tt>roleName</tt> is null
*
Modified: trunk/java/javax/servlet/annotation/WebServlet.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebServlet.java 2009-11-04 18:02:20 UTC (rev 1238)
+++ trunk/java/javax/servlet/annotation/WebServlet.java 2009-11-04 22:24:35 UTC (rev 1239)
@@ -108,4 +108,9 @@
*/
String description() default "";
+ /**
+ * * The display name of the filter
+ */
+ String displayName() default "";
+
}
Modified: trunk/java/javax/servlet/http/Cookie.java
===================================================================
--- trunk/java/javax/servlet/http/Cookie.java 2009-11-04 18:02:20 UTC (rev 1238)
+++ trunk/java/javax/servlet/http/Cookie.java 2009-11-04 22:24:35 UTC (rev 1239)
@@ -52,10 +52,9 @@
* limitations under the License.
*/
-
-
package javax.servlet.http;
+import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ResourceBundle;
@@ -93,20 +92,19 @@
* (by RFC 2109) cookie specifications. By default, cookies are
* created using Version 0 to ensure the best interoperability.
*
- *
* @author Various
*/
+public class Cookie implements Cloneable, Serializable {
-// XXX would implement java.io.Serializable too, but can't do that
-// so long as sun.servlet.* must run on older JDK 1.02 JVMs which
-// don't include that support.
+ private static final long serialVersionUID = -6454587001725327448L;
-public class Cookie implements Cloneable {
+ private static final String tspecials = "/()<>@,;:\\\"[]?={} \t";
private static final String LSTRING_FILE =
- "javax.servlet.http.LocalStrings";
+ "javax.servlet.http.LocalStrings";
+
private static ResourceBundle lStrings =
- ResourceBundle.getBundle(LSTRING_FILE);
+ ResourceBundle.getBundle(LSTRING_FILE);
//
// The value of the cookie itself.
@@ -127,11 +125,9 @@
private boolean secure; // ;Secure ... e.g. use SSL
private int version = 0; // ;Version=1 ... means RFC 2109++ style
private boolean isHttpOnly = false;
-
-
/**
- * Constructs a cookie with a specified name and value.
+ * Constructs a cookie with the specified name and value.
*
* <p>The name must conform to RFC 2109. That means it can contain
* only ASCII alphanumeric characters and cannot contain commas,
@@ -147,49 +143,45 @@
* cookie specification. The version can be changed with the
* <code>setVersion</code> method.
*
+ * @param name the name of the cookie
*
- * @param name a <code>String</code> specifying the name of the cookie
+ * @param value the value of the cookie
*
- * @param value a <code>String</code> specifying the value of the cookie
+ * @throws IllegalArgumentException if the cookie name is null or
+ * empty or contains any illegal characters (for example, a comma,
+ * space, or semicolon) or matches a token reserved for use by the
+ * cookie protocol
*
- * @throws IllegalArgumentException if the cookie name contains illegal characters
- * (for example, a comma, space, or semicolon)
- * or it is one of the tokens reserved for use
- * by the cookie protocol
* @see #setValue
* @see #setVersion
- *
*/
-
public Cookie(String name, String value) {
- if (!isToken(name)
- || name.equalsIgnoreCase("Comment") // rfc2019
- || name.equalsIgnoreCase("Discard") // 2019++
- || name.equalsIgnoreCase("Domain")
- || name.equalsIgnoreCase("Expires") // (old cookies)
- || name.equalsIgnoreCase("Max-Age") // rfc2019
- || name.equalsIgnoreCase("Path")
- || name.equalsIgnoreCase("Secure")
- || name.equalsIgnoreCase("Version")
- || name.startsWith("$")
- ) {
- String errMsg = lStrings.getString("err.cookie_name_is_token");
- Object[] errArgs = new Object[1];
- errArgs[0] = name;
- errMsg = MessageFormat.format(errMsg, errArgs);
- throw new IllegalArgumentException(errMsg);
- }
+ if (name == null || name.length() == 0) {
+ throw new IllegalArgumentException(
+ lStrings.getString("err.cookie_name_blank"));
+ }
+ if (!isToken(name) ||
+ name.equalsIgnoreCase("Comment") || // rfc2019
+ name.equalsIgnoreCase("Discard") || // 2019++
+ name.equalsIgnoreCase("Domain") ||
+ name.equalsIgnoreCase("Expires") || // (old cookies)
+ name.equalsIgnoreCase("Max-Age") || // rfc2019
+ name.equalsIgnoreCase("Path") ||
+ name.equalsIgnoreCase("Secure") ||
+ name.equalsIgnoreCase("Version") ||
+ name.startsWith("$")) {
+ String errMsg = lStrings.getString("err.cookie_name_is_token");
+ Object[] errArgs = new Object[1];
+ errArgs[0] = name;
+ errMsg = MessageFormat.format(errMsg, errArgs);
+ throw new IllegalArgumentException(errMsg);
+ }
- this.name = name;
- this.value = value;
+ this.name = name;
+ this.value = value;
}
-
-
-
-
/**
- *
* Specifies a comment that describes a cookie's purpose.
* The comment is useful if the browser presents the cookie
* to the user. Comments
@@ -199,35 +191,23 @@
* to display to the user
*
* @see #getComment
- *
*/
-
public void setComment(String purpose) {
- comment = purpose;
+ comment = purpose;
}
-
-
-
/**
* Returns the comment describing the purpose of this cookie, or
* <code>null</code> if the cookie has no comment.
*
- * @return a <code>String</code> containing the comment,
- * or <code>null</code> if none
+ * @return the comment of the cookie, or <code>null</code> if unspecified
*
* @see #setComment
- *
*/
-
public String getComment() {
- return comment;
+ return comment;
}
-
-
-
-
/**
*
* Specifies the domain within which this cookie should be presented.
@@ -239,42 +219,30 @@
* <code>a.b.foo.com</code>). By default, cookies are only returned
* to the server that sent them.
*
+ * @param domain the domain name within which this cookie is visible;
+ * form is according to RFC 2109
*
- * @param pattern a <code>String</code> containing the domain name
- * within which this cookie is visible;
- * form is according to RFC 2109
- *
* @see #getDomain
- *
*/
-
- public void setDomain(String pattern) {
- domain = pattern.toLowerCase(); // IE allegedly needs this
+ public void setDomain(String domain) {
+ this.domain = domain.toLowerCase(); // IE allegedly needs this
}
-
-
-
-
/**
- * Returns the domain name set for this cookie. The form of
- * the domain name is set by RFC 2109.
+ * Gets the domain name of this Cookie.
*
- * @return a <code>String</code> containing the domain name
+ * <p>Domain names are formatted according to RFC 2109.
*
- * @see #setDomain
+ * @return the domain name of this Cookie
*
+ * @see #setDomain
*/
-
public String getDomain() {
- return domain;
+ return domain;
}
-
-
-
/**
- * Sets the maximum age of the cookie in seconds.
+ * Sets the maximum age in seconds for this Cookie.
*
* <p>A positive value indicates that the cookie will expire
* after that many seconds have passed. Note that the value is
@@ -291,40 +259,28 @@
* the cookie is not stored; if zero, deletes
* the cookie
*
- *
* @see #getMaxAge
- *
*/
-
public void setMaxAge(int expiry) {
- maxAge = expiry;
+ maxAge = expiry;
}
-
-
-
/**
- * Returns the maximum age of the cookie, specified in seconds,
- * By default, <code>-1</code> indicating the cookie will persist
- * until browser shutdown.
+ * Gets the maximum age in seconds of this Cookie.
*
+ * <p>By default, <code>-1</code> is returned, which indicates that
+ * the cookie will persist until browser shutdown.
*
* @return an integer specifying the maximum age of the
* cookie in seconds; if negative, means
* the cookie persists until browser shutdown
*
- *
* @see #setMaxAge
- *
*/
-
public int getMaxAge() {
- return maxAge;
+ return maxAge;
}
-
-
-
/**
* Specifies a path for the cookie
* to which the client should return the cookie.
@@ -341,140 +297,96 @@
*
* @param uri a <code>String</code> specifying a path
*
- *
* @see #getPath
- *
*/
-
public void setPath(String uri) {
- path = uri;
+ path = uri;
}
-
-
-
/**
* Returns the path on the server
* to which the browser returns this cookie. The
* cookie is visible to all subpaths on the server.
*
- *
* @return a <code>String</code> specifying a path that contains
* a servlet name, for example, <i>/catalog</i>
*
* @see #setPath
- *
*/
-
public String getPath() {
- return path;
+ return path;
}
-
-
-
-
/**
* Indicates to the browser whether the cookie should only be sent
* using a secure protocol, such as HTTPS or SSL.
*
* <p>The default value is <code>false</code>.
*
- * @param flag if <code>true</code>, sends the cookie from the browser
- * to the server only when using a secure protocol;
- * if <code>false</code>, sent on any protocol
+ * @param flag if <code>true</code>, sends the cookie from the browser
+ * to the server only when using a secure protocol; if <code>false</code>,
+ * sent on any protocol
*
* @see #getSecure
- *
*/
-
public void setSecure(boolean flag) {
- secure = flag;
+ secure = flag;
}
-
-
-
/**
* Returns <code>true</code> if the browser is sending cookies
* only over a secure protocol, or <code>false</code> if the
* browser can send cookies using any protocol.
*
- * @return <code>true</code> if the browser uses a secure protocol;
- * otherwise, <code>true</code>
+ * @return <code>true</code> if the browser uses a secure protocol,
+ * <code>false</code> otherwise
*
* @see #setSecure
- *
*/
-
public boolean getSecure() {
- return secure;
+ return secure;
}
-
-
-
-
/**
* Returns the name of the cookie. The name cannot be changed after
* creation.
*
- * @return a <code>String</code> specifying the cookie's name
- *
+ * @return the name of the cookie
*/
-
public String getName() {
- return name;
+ return name;
}
-
-
-
-
/**
+ * Assigns a new value to this Cookie.
+ *
+ * <p>If you use a binary value, you may want to use BASE64 encoding.
*
- * Assigns a new value to a cookie after the cookie is created.
- * If you use a binary value, you may want to use BASE64 encoding.
- *
* <p>With Version 0 cookies, values should not contain white
* space, brackets, parentheses, equals signs, commas,
* double quotes, slashes, question marks, at signs, colons,
* and semicolons. Empty values may not behave the same way
* on all browsers.
*
- * @param newValue a <code>String</code> specifying the new value
+ * @param newValue the new value of the cookie
*
- *
* @see #getValue
- * @see Cookie
- *
*/
-
public void setValue(String newValue) {
- value = newValue;
+ value = newValue;
}
-
-
-
/**
- * Returns the value of the cookie.
+ * Gets the current value of this Cookie.
*
- * @return a <code>String</code> containing the cookie's
- * present value
+ * @return the current value of this Cookie
*
* @see #setValue
- * @see Cookie
- *
*/
-
public String getValue() {
- return value;
+ return value;
}
-
-
-
/**
* Returns the version of the protocol this cookie complies
* with. Version 1 complies with RFC 2109,
@@ -482,126 +394,98 @@
* cookie specification drafted by Netscape. Cookies provided
* by a browser use and identify the browser's cookie version.
*
- *
* @return 0 if the cookie complies with the
* original Netscape specification; 1
* if the cookie complies with RFC 2109
*
* @see #setVersion
- *
*/
-
public int getVersion() {
- return version;
+ return version;
}
-
-
-
/**
- * Sets the version of the cookie protocol this cookie complies
- * with. Version 0 complies with the original Netscape cookie
+ * Sets the version of the cookie protocol that this Cookie complies
+ * with.
+ *
+ * <p>Version 0 complies with the original Netscape cookie
* specification. Version 1 complies with RFC 2109.
*
* <p>Since RFC 2109 is still somewhat new, consider
* version 1 as experimental; do not use it yet on production sites.
*
+ * @param v 0 if the cookie should comply with the original Netscape
+ * specification; 1 if the cookie should comply with RFC 2109
*
- * @param v 0 if the cookie should comply with
- * the original Netscape specification;
- * 1 if the cookie should comply with RFC 2109
- *
* @see #getVersion
- *
*/
-
public void setVersion(int v) {
- version = v;
+ version = v;
}
- // Note -- disabled for now to allow full Netscape compatibility
- // from RFC 2068, token special case characters
- //
- // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
-
- private static final String tspecials = ",; ";
-
-
-
-
/*
* Tests a string and returns true if the string counts as a
* reserved token in the Java language.
*
- * @param value the <code>String</code> to be tested
+ * @param value the <code>String</code> to be tested
*
- * @return <code>true</code> if the <code>String</code> is
- * a reserved token; <code>false</code>
- * if it is not
+ * @return <code>true</code> if the <code>String</code> is a reserved
+ * token; <code>false</code> otherwise
*/
-
private boolean isToken(String value) {
- int len = value.length();
+ int len = value.length();
+ for (int i = 0; i < len; i++) {
+ char c = value.charAt(i);
+ if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1) {
+ return false;
+ }
+ }
- for (int i = 0; i < len; i++) {
- char c = value.charAt(i);
+ return true;
+ }
- if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1)
- return false;
- }
- return true;
+ /**
+ * Overrides the standard <code>java.lang.Object.clone</code>
+ * method to return a copy of this Cookie.
+ */
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e.getMessage());
+ }
}
-
-
-
-
-
/**
+ * Marks or unmarks this Cookie as <i>HttpOnly</i>.
*
- * Overrides the standard <code>java.lang.Object.clone</code>
- * method to return a copy of this cookie.
- *
+ * <p>If <tt>isHttpOnly</tt> is set to <tt>true</tt>, this cookie is
+ * marked as <i>HttpOnly</i>, by adding the <tt>HttpOnly</tt> attribute
+ * to it.
*
+ * <p><i>HttpOnly</i> cookies are not supposed to be exposed to
+ * client-side scripting code, and may therefore help mitigate certain
+ * kinds of cross-site scripting attacks.
+ *
+ * @param isHttpOnly true if this cookie is to be marked as
+ * <i>HttpOnly</i>, false otherwise
+ *
+ * @since Servlet 3.0
*/
-
- public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e.getMessage());
- }
+ public void setHttpOnly(boolean isHttpOnly) {
+ this.isHttpOnly = isHttpOnly;
}
- /**
- * Marks or unmarks this cookie as <i>HttpOnly</i>.
- *
- * <p>If <tt>isHttpOnly</tt> is set to <tt>true</tt>, this cookie is
- * marked as <i>HttpOnly</i>, by adding the <tt>HttpOnly</tt> attribute
- * to it.
- *
- * <p><i>HttpOnly</i> cookies are not supposed to be exposed to
- * client-side scripting code, and may therefore help mitigate certain
- * kinds of cross-site scripting attacks.
- *
- * @param isHttpOnly true if this cookie is to be marked as
- * <i>HttpOnly</i>, false otherwise
- *
- * @since Servlet 3.0
- */
- public void setHttpOnly(boolean isHttpOnly) {
- this.isHttpOnly = isHttpOnly;
- }
- /**
- * Checks whether this cookie has been marked as <i>HttpOnly</i>.
- *
- * @return true if this cookie has been marked as <i>HttpOnly</i>,
- * false otherwise
- *
- * @since Servlet 3.0
- */
- public boolean isHttpOnly() {
- return isHttpOnly;
- }
+ /**
+ * Checks whether this Cookie has been marked as <i>HttpOnly</i>.
+ *
+ * @return true if this Cookie has been marked as <i>HttpOnly</i>,
+ * false otherwise
+ *
+ * @since Servlet 3.0
+ */
+ public boolean isHttpOnly() {
+ return isHttpOnly;
+ }
}
Modified: trunk/java/javax/servlet/http/LocalStrings.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings.properties 2009-11-04 18:02:20 UTC (rev 1238)
+++ trunk/java/javax/servlet/http/LocalStrings.properties 2009-11-04 22:24:35 UTC (rev 1239)
@@ -56,6 +56,7 @@
# Localized for Locale en_US
err.cookie_name_is_token=Cookie name \"{0}\" is a reserved token
+err.cookie_name_blank=Cookie name must not be null or empty
err.io.negativelength=Negative length given in write method
err.io.short_read=Short Read
err.ise.getWriter=Illegal to call getWriter() after getOutputStream() has been called
15 years, 2 months
JBossWeb SVN: r1238 - trunk/java/javax/servlet/http.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-04 13:02:20 -0500 (Wed, 04 Nov 2009)
New Revision: 1238
Modified:
trunk/java/javax/servlet/http/Cookie.java
trunk/java/javax/servlet/http/LocalStrings.properties
Log:
- Revert to the base cookie.
Modified: trunk/java/javax/servlet/http/Cookie.java
===================================================================
--- trunk/java/javax/servlet/http/Cookie.java 2009-11-03 01:55:48 UTC (rev 1237)
+++ trunk/java/javax/servlet/http/Cookie.java 2009-11-04 18:02:20 UTC (rev 1238)
@@ -1,19 +1,59 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You 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.
-*/
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 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 javax.servlet.http;
import java.text.MessageFormat;
@@ -54,9 +94,7 @@
* created using Version 0 to ensure the best interoperability.
*
*
- * @author Various
- * @version $Version$
- *
+ * @author Various
*/
// XXX would implement java.io.Serializable too, but can't do that
@@ -66,30 +104,31 @@
public class Cookie implements Cloneable {
private static final String LSTRING_FILE =
- "javax.servlet.http.LocalStrings";
+ "javax.servlet.http.LocalStrings";
private static ResourceBundle lStrings =
- ResourceBundle.getBundle(LSTRING_FILE);
+ ResourceBundle.getBundle(LSTRING_FILE);
//
// The value of the cookie itself.
//
- private String name; // NAME= ... "$Name" style is reserved
- private String value; // value of NAME
+ private String name; // NAME= ... "$Name" style is reserved
+ private String value; // value of NAME
//
// Attributes encoded in the header's cookie fields.
//
- private String comment; // ;Comment=VALUE ... describes cookie's use
- // ;Discard ... implied by maxAge < 0
- private String domain; // ;Domain=VALUE ... domain that sees cookie
- private int maxAge = -1; // ;Max-Age=VALUE ... cookies auto-expire
- private String path; // ;Path=VALUE ... URLs that see the cookie
- private boolean secure; // ;Secure ... e.g. use SSL
- private int version = 0; // ;Version=1 ... means RFC 2109++ style
- private boolean httpOnly; // Not in cookie specs, but supported by browsers
+ private String comment; // ;Comment=VALUE ... describes cookie's use
+ // ;Discard ... implied by maxAge < 0
+ private String domain; // ;Domain=VALUE ... domain that sees cookie
+ private int maxAge = -1; // ;Max-Age=VALUE ... cookies auto-expire
+ private String path; // ;Path=VALUE ... URLs that see the cookie
+ private boolean secure; // ;Secure ... e.g. use SSL
+ private int version = 0; // ;Version=1 ... means RFC 2109++ style
+ private boolean isHttpOnly = false;
+
/**
* Constructs a cookie with a specified name and value.
@@ -109,44 +148,40 @@
* <code>setVersion</code> method.
*
*
- * @param name a <code>String</code> specifying the name of the cookie
+ * @param name a <code>String</code> specifying the name of the cookie
*
- * @param value a <code>String</code> specifying the value of the cookie
+ * @param value a <code>String</code> specifying the value of the cookie
*
- * @throws IllegalArgumentException if the cookie name contains illegal characters
- * (for example, a comma, space, or semicolon)
- * or it is one of the tokens reserved for use
- * by the cookie protocol
+ * @throws IllegalArgumentException if the cookie name contains illegal characters
+ * (for example, a comma, space, or semicolon)
+ * or it is one of the tokens reserved for use
+ * by the cookie protocol
* @see #setValue
* @see #setVersion
*
*/
public Cookie(String name, String value) {
- if (name == null || name.length() == 0) {
- throw new IllegalArgumentException(
- lStrings.getString("err.cookie_name_blank"));
- }
- if (!isToken(name)
- || name.equalsIgnoreCase("Comment") // rfc2019
- || name.equalsIgnoreCase("Discard") // 2019++
- || name.equalsIgnoreCase("Domain")
- || name.equalsIgnoreCase("Expires") // (old cookies)
- || name.equalsIgnoreCase("Max-Age") // rfc2019
- || name.equalsIgnoreCase("Path")
- || name.equalsIgnoreCase("Secure")
- || name.equalsIgnoreCase("Version")
- || name.startsWith("$")
- ) {
- String errMsg = lStrings.getString("err.cookie_name_is_token");
- Object[] errArgs = new Object[1];
- errArgs[0] = name;
- errMsg = MessageFormat.format(errMsg, errArgs);
- throw new IllegalArgumentException(errMsg);
- }
+ if (!isToken(name)
+ || name.equalsIgnoreCase("Comment") // rfc2019
+ || name.equalsIgnoreCase("Discard") // 2019++
+ || name.equalsIgnoreCase("Domain")
+ || name.equalsIgnoreCase("Expires") // (old cookies)
+ || name.equalsIgnoreCase("Max-Age") // rfc2019
+ || name.equalsIgnoreCase("Path")
+ || name.equalsIgnoreCase("Secure")
+ || name.equalsIgnoreCase("Version")
+ || name.startsWith("$")
+ ) {
+ String errMsg = lStrings.getString("err.cookie_name_is_token");
+ Object[] errArgs = new Object[1];
+ errArgs[0] = name;
+ errMsg = MessageFormat.format(errMsg, errArgs);
+ throw new IllegalArgumentException(errMsg);
+ }
- this.name = name;
- this.value = value;
+ this.name = name;
+ this.value = value;
}
@@ -160,15 +195,15 @@
* to the user. Comments
* are not supported by Netscape Version 0 cookies.
*
- * @param purpose a <code>String</code> specifying the comment
- * to display to the user
+ * @param purpose a <code>String</code> specifying the comment
+ * to display to the user
*
* @see #getComment
*
*/
public void setComment(String purpose) {
- comment = purpose;
+ comment = purpose;
}
@@ -178,15 +213,15 @@
* Returns the comment describing the purpose of this cookie, or
* <code>null</code> if the cookie has no comment.
*
- * @return a <code>String</code> containing the comment,
- * or <code>null</code> if none
+ * @return a <code>String</code> containing the comment,
+ * or <code>null</code> if none
*
* @see #setComment
*
*/
public String getComment() {
- return comment;
+ return comment;
}
@@ -205,16 +240,16 @@
* to the server that sent them.
*
*
- * @param pattern a <code>String</code> containing the domain name
- * within which this cookie is visible;
- * form is according to RFC 2109
+ * @param pattern a <code>String</code> containing the domain name
+ * within which this cookie is visible;
+ * form is according to RFC 2109
*
* @see #getDomain
*
*/
public void setDomain(String pattern) {
- domain = pattern.toLowerCase(); // IE allegedly needs this
+ domain = pattern.toLowerCase(); // IE allegedly needs this
}
@@ -225,14 +260,14 @@
* Returns the domain name set for this cookie. The form of
* the domain name is set by RFC 2109.
*
- * @return a <code>String</code> containing the domain name
+ * @return a <code>String</code> containing the domain name
*
* @see #setDomain
*
*/
public String getDomain() {
- return domain;
+ return domain;
}
@@ -251,10 +286,10 @@
* when the Web browser exits. A zero value causes the cookie
* to be deleted.
*
- * @param expiry an integer specifying the maximum age of the
- * cookie in seconds; if negative, means
- * the cookie is not stored; if zero, deletes
- * the cookie
+ * @param expiry an integer specifying the maximum age of the
+ * cookie in seconds; if negative, means
+ * the cookie is not stored; if zero, deletes
+ * the cookie
*
*
* @see #getMaxAge
@@ -262,7 +297,7 @@
*/
public void setMaxAge(int expiry) {
- maxAge = expiry;
+ maxAge = expiry;
}
@@ -274,9 +309,9 @@
* until browser shutdown.
*
*
- * @return an integer specifying the maximum age of the
- * cookie in seconds; if negative, means
- * the cookie persists until browser shutdown
+ * @return an integer specifying the maximum age of the
+ * cookie in seconds; if negative, means
+ * the cookie persists until browser shutdown
*
*
* @see #setMaxAge
@@ -284,7 +319,7 @@
*/
public int getMaxAge() {
- return maxAge;
+ return maxAge;
}
@@ -304,7 +339,7 @@
* information on setting path names for cookies.
*
*
- * @param uri a <code>String</code> specifying a path
+ * @param uri a <code>String</code> specifying a path
*
*
* @see #getPath
@@ -312,7 +347,7 @@
*/
public void setPath(String uri) {
- path = uri;
+ path = uri;
}
@@ -324,15 +359,15 @@
* cookie is visible to all subpaths on the server.
*
*
- * @return a <code>String</code> specifying a path that contains
- * a servlet name, for example, <i>/catalog</i>
+ * @return a <code>String</code> specifying a path that contains
+ * a servlet name, for example, <i>/catalog</i>
*
* @see #setPath
*
*/
public String getPath() {
- return path;
+ return path;
}
@@ -345,16 +380,16 @@
*
* <p>The default value is <code>false</code>.
*
- * @param flag if <code>true</code>, sends the cookie from the browser
- * to the server only when using a secure protocol;
- * if <code>false</code>, sent on any protocol
+ * @param flag if <code>true</code>, sends the cookie from the browser
+ * to the server only when using a secure protocol;
+ * if <code>false</code>, sent on any protocol
*
* @see #getSecure
*
*/
public void setSecure(boolean flag) {
- secure = flag;
+ secure = flag;
}
@@ -365,15 +400,15 @@
* only over a secure protocol, or <code>false</code> if the
* browser can send cookies using any protocol.
*
- * @return <code>true</code> if the browser uses a secure protocol;
- * otherwise, <code>true</code>
+ * @return <code>true</code> if the browser uses a secure protocol;
+ * otherwise, <code>true</code>
*
* @see #setSecure
*
*/
public boolean getSecure() {
- return secure;
+ return secure;
}
@@ -384,12 +419,12 @@
* Returns the name of the cookie. The name cannot be changed after
* creation.
*
- * @return a <code>String</code> specifying the cookie's name
+ * @return a <code>String</code> specifying the cookie's name
*
*/
public String getName() {
- return name;
+ return name;
}
@@ -407,7 +442,7 @@
* and semicolons. Empty values may not behave the same way
* on all browsers.
*
- * @param newValue a <code>String</code> specifying the new value
+ * @param newValue a <code>String</code> specifying the new value
*
*
* @see #getValue
@@ -416,7 +451,7 @@
*/
public void setValue(String newValue) {
- value = newValue;
+ value = newValue;
}
@@ -425,8 +460,8 @@
/**
* Returns the value of the cookie.
*
- * @return a <code>String</code> containing the cookie's
- * present value
+ * @return a <code>String</code> containing the cookie's
+ * present value
*
* @see #setValue
* @see Cookie
@@ -434,7 +469,7 @@
*/
public String getValue() {
- return value;
+ return value;
}
@@ -448,16 +483,16 @@
* by a browser use and identify the browser's cookie version.
*
*
- * @return 0 if the cookie complies with the
- * original Netscape specification; 1
- * if the cookie complies with RFC 2109
+ * @return 0 if the cookie complies with the
+ * original Netscape specification; 1
+ * if the cookie complies with RFC 2109
*
* @see #setVersion
*
*/
public int getVersion() {
- return version;
+ return version;
}
@@ -472,16 +507,16 @@
* version 1 as experimental; do not use it yet on production sites.
*
*
- * @param v 0 if the cookie should comply with
- * the original Netscape specification;
- * 1 if the cookie should comply with RFC 2109
+ * @param v 0 if the cookie should comply with
+ * the original Netscape specification;
+ * 1 if the cookie should comply with RFC 2109
*
* @see #getVersion
*
*/
public void setVersion(int v) {
- version = v;
+ version = v;
}
// Note -- disabled for now to allow full Netscape compatibility
@@ -490,124 +525,83 @@
// private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
private static final String tspecials = ",; ";
- private static final String tspecials2NoSlash = "()<>@,;:\\\"[]?={} \t";
- private static final String tspecials2WithSlash = tspecials2NoSlash + "/";
- private static final String tspecials2;
- /**
- * If set to true, we parse cookies strictly according to the servlet,
- * cookie and HTTP specs by default.
- */
- private static final boolean STRICT_SERVLET_COMPLIANCE;
-
- /**
- * If set to true, the <code>/</code> character will be treated as a
- * separator. Default is usually false. If STRICT_SERVLET_COMPLIANCE==true
- * then default is true. Explicitly setting always takes priority.
- */
- private static final boolean FWD_SLASH_IS_SEPARATOR;
-
- /**
- * If set to true, enforce the cookie naming rules in the spec that require
- * no separators in the cookie name. Default is usually false. If
- * STRICT_SERVLET_COMPLIANCE==true then default is true. Explicitly setting
- * always takes priority.
- */
- private static final boolean STRICT_NAMING;
-
-
- static {
- STRICT_SERVLET_COMPLIANCE = Boolean.valueOf(System.getProperty(
- "org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
- "false")).booleanValue();
-
- String fwdSlashIsSeparator = System.getProperty(
- "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
- if (fwdSlashIsSeparator == null) {
- FWD_SLASH_IS_SEPARATOR = STRICT_SERVLET_COMPLIANCE;
- } else {
- FWD_SLASH_IS_SEPARATOR =
- Boolean.valueOf(fwdSlashIsSeparator).booleanValue();
- }
-
- if (FWD_SLASH_IS_SEPARATOR) {
- tspecials2 = tspecials2WithSlash;
- } else {
- tspecials2 = tspecials2NoSlash;
- }
-
- String strictNaming = System.getProperty(
- "org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING");
- if (strictNaming == null) {
- STRICT_NAMING = STRICT_SERVLET_COMPLIANCE;
- } else {
- STRICT_NAMING =
- Boolean.valueOf(strictNaming).booleanValue();
- }
-
- }
-
-
+
/*
* Tests a string and returns true if the string counts as a
* reserved token in the Java language.
*
- * @param value the <code>String</code> to be tested
+ * @param value the <code>String</code> to be tested
*
- * @return <code>true</code> if the <code>String</code> is
- * a reserved token; <code>false</code>
- * if it is not
+ * @return <code>true</code> if the <code>String</code> is
+ * a reserved token; <code>false</code>
+ * if it is not
*/
+
private boolean isToken(String value) {
- int len = value.length();
+ int len = value.length();
- for (int i = 0; i < len; i++) {
- char c = value.charAt(i);
+ for (int i = 0; i < len; i++) {
+ char c = value.charAt(i);
- if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1 ||
- (STRICT_NAMING && tspecials2.indexOf(c) != -1)) {
- return false;
- }
- }
- return true;
+ if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1)
+ return false;
+ }
+ return true;
}
+
+
+
/**
*
* Overrides the standard <code>java.lang.Object.clone</code>
* method to return a copy of this cookie.
- *
+ *
*
*/
public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e.getMessage());
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e.getMessage());
+ }
}
- }
-
- /**
- *
- * @return
- * @since Servlet 3.0
- */
- public boolean isHttpOnly() {
- return httpOnly;
- }
-
- /**
- *
- * @param httpOnly
- * @since Servlet 3.0
- */
- public void setHttpOnly(boolean httpOnly) {
- this.httpOnly = httpOnly;
- }
+ /**
+ * Marks or unmarks this cookie as <i>HttpOnly</i>.
+ *
+ * <p>If <tt>isHttpOnly</tt> is set to <tt>true</tt>, this cookie is
+ * marked as <i>HttpOnly</i>, by adding the <tt>HttpOnly</tt> attribute
+ * to it.
+ *
+ * <p><i>HttpOnly</i> cookies are not supposed to be exposed to
+ * client-side scripting code, and may therefore help mitigate certain
+ * kinds of cross-site scripting attacks.
+ *
+ * @param isHttpOnly true if this cookie is to be marked as
+ * <i>HttpOnly</i>, false otherwise
+ *
+ * @since Servlet 3.0
+ */
+ public void setHttpOnly(boolean isHttpOnly) {
+ this.isHttpOnly = isHttpOnly;
+ }
+
+ /**
+ * Checks whether this cookie has been marked as <i>HttpOnly</i>.
+ *
+ * @return true if this cookie has been marked as <i>HttpOnly</i>,
+ * false otherwise
+ *
+ * @since Servlet 3.0
+ */
+ public boolean isHttpOnly() {
+ return isHttpOnly;
+ }
}
Modified: trunk/java/javax/servlet/http/LocalStrings.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings.properties 2009-11-03 01:55:48 UTC (rev 1237)
+++ trunk/java/javax/servlet/http/LocalStrings.properties 2009-11-04 18:02:20 UTC (rev 1238)
@@ -56,7 +56,6 @@
# Localized for Locale en_US
err.cookie_name_is_token=Cookie name \"{0}\" is a reserved token
-err.cookie_name_blank=Cookie name may not be null or zero length
err.io.negativelength=Negative length given in write method
err.io.short_read=Short Read
err.ise.getWriter=Illegal to call getWriter() after getOutputStream() has been called
15 years, 2 months
JBossWeb SVN: r1237 - in trunk/java/org/apache: catalina/authenticator and 39 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-02 20:55:48 -0500 (Mon, 02 Nov 2009)
New Revision: 1237
Modified:
trunk/java/org/apache/catalina/LifecycleException.java
trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
trunk/java/org/apache/catalina/authenticator/SingleSignOn.java
trunk/java/org/apache/catalina/connector/ClientAbortException.java
trunk/java/org/apache/catalina/connector/CoyotePrincipal.java
trunk/java/org/apache/catalina/connector/CoyoteReader.java
trunk/java/org/apache/catalina/connector/HttpEventImpl.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
trunk/java/org/apache/catalina/core/ContainerBase.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardEngine.java
trunk/java/org/apache/catalina/core/StandardHost.java
trunk/java/org/apache/catalina/core/StandardServer.java
trunk/java/org/apache/catalina/core/StandardService.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/deploy/ApplicationParameter.java
trunk/java/org/apache/catalina/deploy/ContextEjb.java
trunk/java/org/apache/catalina/deploy/ContextEnvironment.java
trunk/java/org/apache/catalina/deploy/ContextHandler.java
trunk/java/org/apache/catalina/deploy/ContextLocalEjb.java
trunk/java/org/apache/catalina/deploy/ContextResource.java
trunk/java/org/apache/catalina/deploy/ContextResourceEnvRef.java
trunk/java/org/apache/catalina/deploy/ContextResourceLink.java
trunk/java/org/apache/catalina/deploy/ContextService.java
trunk/java/org/apache/catalina/deploy/ContextTransaction.java
trunk/java/org/apache/catalina/deploy/ErrorPage.java
trunk/java/org/apache/catalina/deploy/FilterDef.java
trunk/java/org/apache/catalina/deploy/FilterMap.java
trunk/java/org/apache/catalina/deploy/LoginConfig.java
trunk/java/org/apache/catalina/deploy/MessageDestination.java
trunk/java/org/apache/catalina/deploy/MessageDestinationRef.java
trunk/java/org/apache/catalina/deploy/SecurityCollection.java
trunk/java/org/apache/catalina/deploy/SecurityConstraint.java
trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
trunk/java/org/apache/catalina/loader/WebappClassLoader.java
trunk/java/org/apache/catalina/loader/WebappLoader.java
trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
trunk/java/org/apache/catalina/manager/JspHelper.java
trunk/java/org/apache/catalina/manager/ManagerServlet.java
trunk/java/org/apache/catalina/manager/StatusTransformer.java
trunk/java/org/apache/catalina/manager/host/HTMLHostManagerServlet.java
trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
trunk/java/org/apache/catalina/realm/DataSourceRealm.java
trunk/java/org/apache/catalina/realm/GenericPrincipal.java
trunk/java/org/apache/catalina/realm/JDBCRealm.java
trunk/java/org/apache/catalina/realm/JNDIRealm.java
trunk/java/org/apache/catalina/realm/RealmBase.java
trunk/java/org/apache/catalina/servlets/CGIServlet.java
trunk/java/org/apache/catalina/servlets/DefaultServlet.java
trunk/java/org/apache/catalina/servlets/WebdavServlet.java
trunk/java/org/apache/catalina/session/ManagerBase.java
trunk/java/org/apache/catalina/session/StandardSession.java
trunk/java/org/apache/catalina/ssi/ExpressionParseTree.java
trunk/java/org/apache/catalina/ssi/SSIFsize.java
trunk/java/org/apache/catalina/ssi/SSIMediator.java
trunk/java/org/apache/catalina/ssi/SSIProcessor.java
trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/startup/PasswdUserDatabase.java
trunk/java/org/apache/catalina/startup/SetNextNamingRule.java
trunk/java/org/apache/catalina/startup/WebRuleSet.java
trunk/java/org/apache/catalina/util/DOMWriter.java
trunk/java/org/apache/catalina/util/Extension.java
trunk/java/org/apache/catalina/util/HexUtils.java
trunk/java/org/apache/catalina/util/ManifestResource.java
trunk/java/org/apache/catalina/util/RequestUtil.java
trunk/java/org/apache/catalina/util/Strftime.java
trunk/java/org/apache/catalina/util/URLEncoder.java
trunk/java/org/apache/catalina/util/XMLWriter.java
trunk/java/org/apache/catalina/valves/AccessLogValve.java
trunk/java/org/apache/catalina/valves/ErrorReportValve.java
trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
trunk/java/org/apache/catalina/valves/ValveBase.java
trunk/java/org/apache/coyote/Response.java
trunk/java/org/apache/coyote/ajp/AjpMessage.java
trunk/java/org/apache/el/parser/AstCompositeExpression.java
trunk/java/org/apache/el/parser/AstLiteralExpression.java
trunk/java/org/apache/el/parser/AstString.java
trunk/java/org/apache/el/parser/ParseException.java
trunk/java/org/apache/el/parser/TokenMgrError.java
trunk/java/org/apache/el/util/ReflectionUtil.java
trunk/java/org/apache/jasper/JspCompilationContext.java
trunk/java/org/apache/jasper/compiler/DefaultErrorHandler.java
trunk/java/org/apache/jasper/compiler/Dumper.java
trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java
trunk/java/org/apache/jasper/compiler/ELParser.java
trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/compiler/JCICompiler.java
trunk/java/org/apache/jasper/compiler/JDTCompiler.java
trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
trunk/java/org/apache/jasper/compiler/JspReader.java
trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
trunk/java/org/apache/jasper/compiler/JspUtil.java
trunk/java/org/apache/jasper/compiler/Node.java
trunk/java/org/apache/jasper/compiler/PageDataImpl.java
trunk/java/org/apache/jasper/compiler/Parser.java
trunk/java/org/apache/jasper/compiler/SmapGenerator.java
trunk/java/org/apache/jasper/compiler/SmapStratum.java
trunk/java/org/apache/jasper/compiler/TextOptimizer.java
trunk/java/org/apache/jasper/compiler/Validator.java
trunk/java/org/apache/jasper/runtime/CharBuffer.java
trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
trunk/java/org/apache/jasper/runtime/PageContextImpl.java
trunk/java/org/apache/jasper/security/SecurityUtil.java
trunk/java/org/apache/jasper/tagplugins/jstl/Util.java
trunk/java/org/apache/jasper/tagplugins/jstl/core/Import.java
trunk/java/org/apache/jasper/xmlparser/TreeNode.java
trunk/java/org/apache/juli/JdkLoggerFormatter.java
trunk/java/org/apache/juli/OneLineFormatter.java
trunk/java/org/apache/naming/HandlerRef.java
trunk/java/org/apache/naming/ResourceRef.java
trunk/java/org/apache/naming/ServiceRef.java
trunk/java/org/apache/naming/StringManager.java
trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
trunk/java/org/apache/tomcat/bayeux/ChannelImpl.java
trunk/java/org/apache/tomcat/bayeux/ClientImpl.java
trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
trunk/java/org/apache/tomcat/util/buf/CharChunk.java
trunk/java/org/apache/tomcat/util/buf/UDecoder.java
trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java
trunk/java/org/apache/tomcat/util/digester/CallParamRule.java
trunk/java/org/apache/tomcat/util/digester/Digester.java
trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java
trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java
trunk/java/org/apache/tomcat/util/digester/ObjectParamRule.java
trunk/java/org/apache/tomcat/util/digester/PathCallParamRule.java
trunk/java/org/apache/tomcat/util/digester/SetNextRule.java
trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java
trunk/java/org/apache/tomcat/util/digester/SetRootRule.java
trunk/java/org/apache/tomcat/util/digester/SetTopRule.java
trunk/java/org/apache/tomcat/util/http/HttpMessages.java
trunk/java/org/apache/tomcat/util/http/Parameters.java
trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java
trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
trunk/java/org/apache/tomcat/util/modeler/AttributeInfo.java
trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java
trunk/java/org/apache/tomcat/util/modeler/NotificationInfo.java
trunk/java/org/apache/tomcat/util/net/URL.java
trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
Log:
- Port patch: StringBuffer -> StringBuilder.
Modified: trunk/java/org/apache/catalina/LifecycleException.java
===================================================================
--- trunk/java/org/apache/catalina/LifecycleException.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/LifecycleException.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -127,7 +127,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("LifecycleException: ");
+ StringBuilder sb = new StringBuilder("LifecycleException: ");
if (message != null) {
sb.append(message);
if (throwable != null) {
Modified: trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -595,7 +595,7 @@
bytes = getDigest().digest(bytes);
// Render the result as a String of hexadecimal digits
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
byte b1 = (byte) ((bytes[i] & 0xf0) >> 4);
byte b2 = (byte) (bytes[i] & 0x0f);
Modified: trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -547,7 +547,7 @@
(SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
if (saved == null)
return (null);
- StringBuffer sb = new StringBuffer(saved.getRequestURI());
+ StringBuilder sb = new StringBuilder(saved.getRequestURI());
if (saved.getQueryString() != null) {
sb.append('?');
sb.append(saved.getQueryString());
Modified: trunk/java/org/apache/catalina/authenticator/SingleSignOn.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/SingleSignOn.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/authenticator/SingleSignOn.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -412,7 +412,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SingleSignOn[");
+ StringBuilder sb = new StringBuilder("SingleSignOn[");
if (container == null )
sb.append("Container is null");
else
Modified: trunk/java/org/apache/catalina/connector/ClientAbortException.java
===================================================================
--- trunk/java/org/apache/catalina/connector/ClientAbortException.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/connector/ClientAbortException.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -127,7 +127,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ClientAbortException: ");
+ StringBuilder sb = new StringBuilder("ClientAbortException: ");
if (message != null) {
sb.append(message);
if (throwable != null) {
Modified: trunk/java/org/apache/catalina/connector/CoyotePrincipal.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyotePrincipal.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/connector/CoyotePrincipal.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -64,7 +64,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("CoyotePrincipal[");
+ StringBuilder sb = new StringBuilder("CoyotePrincipal[");
sb.append(this.name);
sb.append("]");
return (sb.toString());
Modified: trunk/java/org/apache/catalina/connector/CoyoteReader.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteReader.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/connector/CoyoteReader.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -151,7 +151,7 @@
int pos = 0;
int end = -1;
int skip = -1;
- StringBuffer aggregator = null;
+ StringBuilder aggregator = null;
while (end < 0) {
mark(MAX_LINE_LENGTH);
while ((pos < MAX_LINE_LENGTH) && (end < 0)) {
@@ -187,7 +187,7 @@
}
if (end < 0) {
if (aggregator == null) {
- aggregator = new StringBuffer();
+ aggregator = new StringBuilder();
}
aggregator.append(lineBuffer);
pos = 0;
Modified: trunk/java/org/apache/catalina/connector/HttpEventImpl.java
===================================================================
--- trunk/java/org/apache/catalina/connector/HttpEventImpl.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/connector/HttpEventImpl.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -114,7 +114,7 @@
}
public String toString() {
- StringBuffer buf = new StringBuffer("HttpEventImpl[");
+ StringBuilder buf = new StringBuilder("HttpEventImpl[");
buf.append(super.toString());
buf.append("] Event:");
buf.append(getType());
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -2581,7 +2581,7 @@
return null;
if (s.indexOf('\\') == -1)
return s;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i=0; i<s.length(); i++) {
char c = s.charAt(i);
if (c!='\\') buf.append(c);
@@ -2892,7 +2892,7 @@
if (white < 0)
white = value.indexOf('\t');
if (white >= 0) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int len = value.length();
for (int i = 0; i < len; i++) {
char ch = value.charAt(i);
@@ -3143,7 +3143,7 @@
public String toString() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(sm.getString("coyoteRequest.servletStack", Thread.currentThread().getName()));
if (eventMode) {
buf.append(" [event]");
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/connector/Response.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -1647,7 +1647,7 @@
anchor = path.substring(pound);
path = path.substring(0, pound);
}
- StringBuffer sb = new StringBuffer(path);
+ StringBuilder sb = new StringBuilder(path);
if( sb.length() > 0 ) { // jsessionid can't be first.
sb.append(";");
sb.append(Globals.SESSION_PARAMETER_NAME);
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -1394,7 +1394,7 @@
while (childPaths.hasMoreElements()) {
Binding binding = (Binding) childPaths.nextElement();
String name = binding.getName();
- StringBuffer childPath = new StringBuffer(path);
+ StringBuilder childPath = new StringBuilder(path);
if (!"/".equals(path) && !path.endsWith("/"))
childPath.append("/");
childPath.append(name);
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -247,7 +247,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ApplicationFilterConfig[");
+ StringBuilder sb = new StringBuilder("ApplicationFilterConfig[");
sb.append("name=");
sb.append(filterDef.getFilterName());
sb.append(", filterClass=");
Modified: trunk/java/org/apache/catalina/core/ContainerBase.java
===================================================================
--- trunk/java/org/apache/catalina/core/ContainerBase.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/ContainerBase.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -1570,7 +1570,7 @@
Container host=null;
Container servlet=null;
- StringBuffer suffix=new StringBuffer();
+ StringBuilder suffix=new StringBuilder();
if( container instanceof StandardHost ) {
host=container;
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -4757,7 +4757,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (getParent() != null) {
sb.append(getParent().toString());
sb.append(".");
@@ -5047,7 +5047,7 @@
namingContextName = getName();
} else {
Stack stk = new Stack();
- StringBuffer buff = new StringBuffer();
+ StringBuilder buff = new StringBuilder();
while (parent != null) {
stk.push(parent.getName());
parent = parent.getParent();
@@ -5254,7 +5254,7 @@
}
BufferedReader br = new BufferedReader(
new InputStreamReader(stream));
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
String strRead = "";
try {
while (strRead != null) {
Modified: trunk/java/org/apache/catalina/core/StandardEngine.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardEngine.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/StandardEngine.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -461,7 +461,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("StandardEngine[");
+ StringBuilder sb = new StringBuilder("StandardEngine[");
sb.append(getName());
sb.append("]");
return (sb.toString());
Modified: trunk/java/org/apache/catalina/core/StandardHost.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardHost.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/StandardHost.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -587,7 +587,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (getParent() != null) {
sb.append(getParent().toString());
sb.append(".");
Modified: trunk/java/org/apache/catalina/core/StandardServer.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardServer.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/StandardServer.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -411,7 +411,7 @@
}
// Read a set of characters from the socket
- StringBuffer command = new StringBuffer();
+ StringBuilder command = new StringBuilder();
int expected = 1024; // Cut off to avoid DoS attack
while (expected < shutdown.length()) {
if (random == null)
@@ -575,7 +575,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("StandardServer[");
+ StringBuilder sb = new StringBuilder("StandardServer[");
sb.append(getPort());
sb.append("]");
return (sb.toString());
Modified: trunk/java/org/apache/catalina/core/StandardService.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardService.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/StandardService.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -382,7 +382,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("StandardService[");
+ StringBuilder sb = new StringBuilder("StandardService[");
sb.append(getName());
sb.append("]");
return (sb.toString());
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -1394,7 +1394,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (getParent() != null) {
sb.append(getParent().toString());
sb.append(".");
Modified: trunk/java/org/apache/catalina/deploy/ApplicationParameter.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ApplicationParameter.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ApplicationParameter.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -102,7 +102,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ApplicationParameter[");
+ StringBuilder sb = new StringBuilder("ApplicationParameter[");
sb.append("name=");
sb.append(name);
if (description != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextEjb.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextEjb.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextEjb.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -87,7 +87,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextEjb[");
+ StringBuilder sb = new StringBuilder("ContextEjb[");
sb.append("name=");
sb.append(getName());
if (getDescription() != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextEnvironment.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextEnvironment.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextEnvironment.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -127,7 +127,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextEnvironment[");
+ StringBuilder sb = new StringBuilder("ContextEnvironment[");
sb.append("name=");
sb.append(name);
if (description != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextHandler.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextHandler.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextHandler.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -122,7 +122,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextHandler[");
+ StringBuilder sb = new StringBuilder("ContextHandler[");
sb.append("name=");
sb.append(getName());
if (handlerclass != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextLocalEjb.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextLocalEjb.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextLocalEjb.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -86,7 +86,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextLocalEjb[");
+ StringBuilder sb = new StringBuilder("ContextLocalEjb[");
sb.append("name=");
sb.append(getName());
if (getDescription() != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextResource.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextResource.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextResource.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -73,7 +73,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextResource[");
+ StringBuilder sb = new StringBuilder("ContextResource[");
sb.append("name=");
sb.append(getName());
if (getDescription() != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextResourceEnvRef.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextResourceEnvRef.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextResourceEnvRef.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -57,7 +57,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextResourceEnvRef[");
+ StringBuilder sb = new StringBuilder("ContextResourceEnvRef[");
sb.append("name=");
sb.append(getName());
if (getType() != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextResourceLink.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextResourceLink.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextResourceLink.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -58,7 +58,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextResourceLink[");
+ StringBuilder sb = new StringBuilder("ContextResourceLink[");
sb.append("name=");
sb.append(getName());
if (getType() != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextService.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextService.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextService.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -185,7 +185,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ContextService[");
+ StringBuilder sb = new StringBuilder("ContextService[");
sb.append("name=");
sb.append(getName());
if (getDescription() != null) {
Modified: trunk/java/org/apache/catalina/deploy/ContextTransaction.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ContextTransaction.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ContextTransaction.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -79,7 +79,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("Transaction[");
+ StringBuilder sb = new StringBuilder("Transaction[");
sb.append("]");
return (sb.toString());
Modified: trunk/java/org/apache/catalina/deploy/ErrorPage.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/ErrorPage.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/ErrorPage.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -152,7 +152,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ErrorPage[");
+ StringBuilder sb = new StringBuilder("ErrorPage[");
if (exceptionType == null) {
sb.append("errorCode=");
sb.append(errorCode);
Modified: trunk/java/org/apache/catalina/deploy/FilterDef.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/FilterDef.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/FilterDef.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -182,7 +182,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("FilterDef[");
+ StringBuilder sb = new StringBuilder("FilterDef[");
sb.append("filterName=");
sb.append(this.filterName);
sb.append(", filterClass=");
Modified: trunk/java/org/apache/catalina/deploy/FilterMap.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/FilterMap.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/FilterMap.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -297,7 +297,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("FilterMap[");
+ StringBuilder sb = new StringBuilder("FilterMap[");
sb.append("filterName=");
sb.append(this.filterName);
for (int i = 0; i < servletNames.length; i++) {
Modified: trunk/java/org/apache/catalina/deploy/LoginConfig.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/LoginConfig.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/LoginConfig.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -143,7 +143,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("LoginConfig[");
+ StringBuilder sb = new StringBuilder("LoginConfig[");
sb.append("authMethod=");
sb.append(authMethod);
if (realmName != null) {
Modified: trunk/java/org/apache/catalina/deploy/MessageDestination.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/MessageDestination.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/MessageDestination.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -113,7 +113,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("MessageDestination[");
+ StringBuilder sb = new StringBuilder("MessageDestination[");
sb.append("name=");
sb.append(name);
if (displayName != null) {
Modified: trunk/java/org/apache/catalina/deploy/MessageDestinationRef.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/MessageDestinationRef.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/MessageDestinationRef.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -127,7 +127,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("MessageDestination[");
+ StringBuilder sb = new StringBuilder("MessageDestination[");
sb.append("name=");
sb.append(name);
if (link != null) {
Modified: trunk/java/org/apache/catalina/deploy/SecurityCollection.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/SecurityCollection.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/SecurityCollection.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -399,7 +399,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SecurityCollection[");
+ StringBuilder sb = new StringBuilder("SecurityCollection[");
sb.append(name);
if (description != null) {
sb.append(", ");
Modified: trunk/java/org/apache/catalina/deploy/SecurityConstraint.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/SecurityConstraint.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/deploy/SecurityConstraint.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -385,7 +385,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SecurityConstraint[");
+ StringBuilder sb = new StringBuilder("SecurityConstraint[");
for (int i = 0; i < collections.length; i++) {
if (i > 0)
sb.append(", ");
Modified: trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
===================================================================
--- trunk/java/org/apache/catalina/filters/WebdavFixFilter.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/filters/WebdavFixFilter.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -123,8 +123,8 @@
}
private String buildRedirect(HttpServletRequest request) {
- StringBuffer location =
- new StringBuffer(request.getRequestURL().length());
+ StringBuilder location =
+ new StringBuilder(request.getRequestURL().length());
location.append(request.getScheme());
location.append("://");
location.append(request.getServerName());
Modified: trunk/java/org/apache/catalina/loader/WebappClassLoader.java
===================================================================
--- trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -458,7 +458,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("WebappClassLoader\r\n");
+ StringBuilder sb = new StringBuilder("WebappClassLoader\r\n");
sb.append(" delegate: ");
sb.append(delegate);
sb.append("\r\n");
Modified: trunk/java/org/apache/catalina/loader/WebappLoader.java
===================================================================
--- trunk/java/org/apache/catalina/loader/WebappLoader.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/loader/WebappLoader.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -434,7 +434,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("WebappLoader[");
+ StringBuilder sb = new StringBuilder("WebappLoader[");
if (container != null)
sb.append(container.getName());
sb.append("]");
Modified: trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/JMXProxyServlet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/manager/JMXProxyServlet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -201,7 +201,7 @@
if( idx < 0 ) return value;
int prev=0;
- StringBuffer sb=new StringBuffer();
+ StringBuilder sb=new StringBuilder();
while( idx >= 0 ) {
appendHead(sb, value, prev, idx);
@@ -215,7 +215,7 @@
return sb.toString();
}
- private void appendHead( StringBuffer sb, String value, int start, int end) {
+ private void appendHead( StringBuilder sb, String value, int start, int end) {
if (end < 1) return;
int pos=start;
Modified: trunk/java/org/apache/catalina/manager/JspHelper.java
===================================================================
--- trunk/java/org/apache/catalina/manager/JspHelper.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/manager/JspHelper.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -108,7 +108,7 @@
}
public static String secondsToTimeString(long in_seconds) {
- StringBuffer buff = new StringBuffer(9);
+ StringBuilder buff = new StringBuilder(9);
long rest = in_seconds;
long hour = rest / 3600;
rest = rest % 3600;
@@ -208,16 +208,16 @@
int start = 0;
int length = buffer.length();
char[] arrayBuffer = buffer.toCharArray();
- StringBuffer escapedBuffer = null;
+ StringBuilder escapedBuffer = null;
for (int i = 0; i < length; i++) {
char c = arrayBuffer[i];
if (c <= HIGHEST_SPECIAL) {
char[] escaped = specialCharactersRepresentation[c];
if (escaped != null) {
- // create StringBuffer to hold escaped xml string
+ // create StringBuilder to hold escaped xml string
if (start == 0) {
- escapedBuffer = new StringBuffer(length + 5);
+ escapedBuffer = new StringBuilder(length + 5);
}
// add unescaped portion
if (start < i) {
Modified: trunk/java/org/apache/catalina/manager/ManagerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/ManagerServlet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/manager/ManagerServlet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -1009,7 +1009,7 @@
if (debug >= 1)
log("serverinfo");
try {
- StringBuffer props = new StringBuffer();
+ StringBuilder props = new StringBuilder();
props.append("OK - Server info");
props.append("\nTomcat Version: ");
props.append(ServerInfo.getServerInfo());
Modified: trunk/java/org/apache/catalina/manager/StatusTransformer.java
===================================================================
--- trunk/java/org/apache/catalina/manager/StatusTransformer.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/manager/StatusTransformer.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -863,7 +863,7 @@
char content[] = new char[message.length()];
message.getChars(0, message.length(), content, 0);
- StringBuffer result = new StringBuffer(content.length + 50);
+ StringBuilder result = new StringBuilder(content.length + 50);
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
case '<':
Modified: trunk/java/org/apache/catalina/manager/host/HTMLHostManagerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/host/HTMLHostManagerServlet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/manager/host/HTMLHostManagerServlet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -270,7 +270,7 @@
args = new Object[3];
args[0] = RequestUtil.filter(hostName);
String[] aliases = host.findAliases();
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (aliases.length > 0) {
buf.append(aliases[0]);
for (int j = 1; j < aliases.length; j++) {
Modified: trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -549,7 +549,7 @@
Host host = (Host) hosts[i];
String name = host.getName();
String[] aliases = host.findAliases();
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (aliases.length > 0) {
buf.append(aliases[0]);
for (int j = 1; j < aliases.length; j++) {
Modified: trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/MBeanUtils.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/mbeans/MBeanUtils.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -620,7 +620,7 @@
String serviceName = null;
if (service != null)
serviceName = service.getName();
- StringBuffer sb = new StringBuffer(domain);
+ StringBuilder sb = new StringBuilder(domain);
sb.append(":type=Connector");
sb.append(",port=" + port);
if ((address != null) && (address.length()>0)) {
Modified: trunk/java/org/apache/catalina/realm/DataSourceRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/DataSourceRealm.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/realm/DataSourceRealm.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -623,7 +623,7 @@
super.start();
// Create the roles PreparedStatement string
- StringBuffer temp = new StringBuffer("SELECT ");
+ StringBuilder temp = new StringBuilder("SELECT ");
temp.append(roleNameCol);
temp.append(" FROM ");
temp.append(userRoleTable);
@@ -633,7 +633,7 @@
preparedRoles = temp.toString();
// Create the credentials PreparedStatement string
- temp = new StringBuffer("SELECT ");
+ temp = new StringBuilder("SELECT ");
temp.append(userCredCol);
temp.append(" FROM ");
temp.append(userTable);
Modified: trunk/java/org/apache/catalina/realm/GenericPrincipal.java
===================================================================
--- trunk/java/org/apache/catalina/realm/GenericPrincipal.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/realm/GenericPrincipal.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -231,7 +231,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("GenericPrincipal[");
+ StringBuilder sb = new StringBuilder("GenericPrincipal[");
sb.append(this.name);
sb.append("(");
for( int i=0;i<roles.length; i++ ) {
Modified: trunk/java/org/apache/catalina/realm/JDBCRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/JDBCRealm.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/realm/JDBCRealm.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -482,7 +482,7 @@
throws SQLException {
if (preparedCredentials == null) {
- StringBuffer sb = new StringBuffer("SELECT ");
+ StringBuilder sb = new StringBuilder("SELECT ");
sb.append(userCredCol);
sb.append(" FROM ");
sb.append(userTable);
@@ -734,7 +734,7 @@
throws SQLException {
if (preparedRoles == null) {
- StringBuffer sb = new StringBuffer("SELECT ");
+ StringBuilder sb = new StringBuilder("SELECT ");
sb.append(roleNameCol);
sb.append(" FROM ");
sb.append(userRoleTable);
Modified: trunk/java/org/apache/catalina/realm/JNDIRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/JNDIRealm.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/realm/JNDIRealm.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -2077,7 +2077,7 @@
* @return String the escaped/encoded result
*/
protected String doRFC2254Encoding(String inString) {
- StringBuffer buf = new StringBuffer(inString.length());
+ StringBuilder buf = new StringBuilder(inString.length());
for (int i = 0; i < inString.length(); i++) {
char c = inString.charAt(i);
switch (c) {
Modified: trunk/java/org/apache/catalina/realm/RealmBase.java
===================================================================
--- trunk/java/org/apache/catalina/realm/RealmBase.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/realm/RealmBase.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -946,7 +946,7 @@
}
// Redirect to the corresponding SSL port
- StringBuffer file = new StringBuffer();
+ StringBuilder file = new StringBuilder();
String protocol = "https";
String host = request.getServerName();
// Protocol
Modified: trunk/java/org/apache/catalina/servlets/CGIServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/CGIServlet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/servlets/CGIServlet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -1099,8 +1099,8 @@
* directory to enable CGI script to be executed.
*/
protected void expandCGIScript() {
- StringBuffer srcPath = new StringBuffer();
- StringBuffer destPath = new StringBuffer();
+ StringBuilder srcPath = new StringBuilder();
+ StringBuilder destPath = new StringBuilder();
InputStream is = null;
// paths depend on mapping
@@ -1191,7 +1191,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("<TABLE border=2>");
@@ -1606,7 +1606,7 @@
int bufRead = -1;
//create query arguments
- StringBuffer cmdAndArgs = new StringBuffer();
+ StringBuilder cmdAndArgs = new StringBuilder();
if (command.indexOf(" ") < 0) {
cmdAndArgs.append(command);
} else {
@@ -1629,7 +1629,7 @@
}
}
- StringBuffer command = new StringBuffer(cgiExecutable);
+ StringBuilder command = new StringBuilder(cgiExecutable);
command.append(" ");
command.append(cmdAndArgs.toString());
cmdAndArgs = command;
Modified: trunk/java/org/apache/catalina/servlets/DefaultServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/DefaultServlet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/servlets/DefaultServlet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -591,7 +591,7 @@
/**
* Display the size of a file.
*/
- protected void displaySize(StringBuffer buf, int filesize) {
+ protected void displaySize(StringBuilder buf, int filesize) {
int leftside = filesize / 1024;
int rightside = (filesize % 1024) / 103; // makes 1 digit
@@ -1105,7 +1105,7 @@
InputStream xsltInputStream)
throws IOException, ServletException {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("<?xml version=\"1.0\"?>");
sb.append("<listing ");
@@ -1231,7 +1231,7 @@
OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8");
PrintWriter writer = new PrintWriter(osWriter);
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
// rewriteUrl(contextPath) is expensive. cache result for later reuse
String rewrittenContextPath = rewriteUrl(contextPath);
Modified: trunk/java/org/apache/catalina/servlets/WebdavServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -406,7 +406,7 @@
resp.addHeader("DAV", "1,2");
- StringBuffer methodsAllowed = determineMethodsAllowed(resources,
+ StringBuilder methodsAllowed = determineMethodsAllowed(resources,
req);
resp.addHeader("Allow", methodsAllowed.toString());
@@ -423,7 +423,7 @@
if (!listings) {
// Get allowed methods
- StringBuffer methodsAllowed = determineMethodsAllowed(resources,
+ StringBuilder methodsAllowed = determineMethodsAllowed(resources,
req);
resp.addHeader("Allow", methodsAllowed.toString());
@@ -728,7 +728,7 @@
// path
if (exists) {
// Get allowed methods
- StringBuffer methodsAllowed = determineMethodsAllowed(resources,
+ StringBuilder methodsAllowed = determineMethodsAllowed(resources,
req);
resp.addHeader("Allow", methodsAllowed.toString());
@@ -2594,7 +2594,7 @@
* Get creation date in ISO format.
*/
private String getISOCreationDate(long creationDate) {
- StringBuffer creationDateValue = new StringBuffer
+ StringBuilder creationDateValue = new StringBuilder
(creationDateFormat.format
(new Date(creationDate)));
/*
@@ -2621,10 +2621,10 @@
* Determines the methods normally allowed for the resource.
*
*/
- private StringBuffer determineMethodsAllowed(DirContext resources,
+ private StringBuilder determineMethodsAllowed(DirContext resources,
HttpServletRequest req) {
- StringBuffer methodsAllowed = new StringBuffer();
+ StringBuilder methodsAllowed = new StringBuilder();
boolean exists = true;
Object object = null;
try {
Modified: trunk/java/org/apache/catalina/session/ManagerBase.java
===================================================================
--- trunk/java/org/apache/catalina/session/ManagerBase.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/session/ManagerBase.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -958,11 +958,11 @@
String result = null;
// Render the result as a String of hexadecimal digits
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
do {
int resultLenBytes = 0;
if (result != null) {
- buffer = new StringBuffer();
+ buffer = new StringBuilder();
duplicates++;
}
@@ -1136,7 +1136,7 @@
*
*/
public String listSessionIds() {
- StringBuffer sb=new StringBuffer();
+ StringBuilder sb=new StringBuilder();
Iterator keys = sessions.keySet().iterator();
while (keys.hasNext()) {
sb.append(keys.next()).append(" ");
Modified: trunk/java/org/apache/catalina/session/StandardSession.java
===================================================================
--- trunk/java/org/apache/catalina/session/StandardSession.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/session/StandardSession.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -907,7 +907,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("StandardSession[");
sb.append(id);
sb.append("]");
Modified: trunk/java/org/apache/catalina/ssi/ExpressionParseTree.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/ExpressionParseTree.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/ssi/ExpressionParseTree.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -211,12 +211,12 @@
* A node the represents a String value
*/
private class StringNode extends Node {
- StringBuffer value;
+ StringBuilder value;
String resolved = null;
public StringNode(String value) {
- this.value = new StringBuffer(value);
+ this.value = new StringBuilder(value);
}
Modified: trunk/java/org/apache/catalina/ssi/SSIFsize.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIFsize.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/ssi/SSIFsize.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -74,7 +74,7 @@
if (numChars < 0) {
throw new IllegalArgumentException("Num chars can't be negative");
}
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i = 0; i < numChars; i++) {
buf.append(aChar);
}
Modified: trunk/java/org/apache/catalina/ssi/SSIMediator.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIMediator.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/ssi/SSIMediator.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -216,7 +216,7 @@
val = val.replace(""", "\"");
val = val.replace("&", "&");
- StringBuffer sb = new StringBuffer(val);
+ StringBuilder sb = new StringBuilder(val);
int charStart = sb.indexOf("&#");
while (charStart > -1) {
int charEnd = sb.indexOf(";", charStart);
Modified: trunk/java/org/apache/catalina/ssi/SSIProcessor.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIProcessor.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/ssi/SSIProcessor.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -97,7 +97,7 @@
stringWriter = null;
int index = 0;
boolean inside = false;
- StringBuffer command = new StringBuffer();
+ StringBuilder command = new StringBuilder();
try {
while (index < fileContents.length()) {
char c = fileContents.charAt(index);
@@ -175,19 +175,19 @@
/**
- * Parse a StringBuffer and take out the param type token. Called from
+ * Parse a StringBuilder and take out the param type token. Called from
* <code>requestHandler</code>
*
* @param cmd
- * a value of type 'StringBuffer'
+ * a value of type 'StringBuilder'
* @return a value of type 'String[]'
*/
- protected String[] parseParamNames(StringBuffer cmd, int start) {
+ protected String[] parseParamNames(StringBuilder cmd, int start) {
int bIdx = start;
int i = 0;
int quotes = 0;
boolean inside = false;
- StringBuffer retBuf = new StringBuffer();
+ StringBuilder retBuf = new StringBuilder();
while (bIdx < cmd.length()) {
if (!inside) {
while (bIdx < cmd.length() && isSpace(cmd.charAt(bIdx)))
@@ -225,18 +225,18 @@
/**
- * Parse a StringBuffer and take out the param token. Called from
+ * Parse a StringBuilder and take out the param token. Called from
* <code>requestHandler</code>
*
* @param cmd
- * a value of type 'StringBuffer'
+ * a value of type 'StringBuilder'
* @return a value of type 'String[]'
*/
- protected String[] parseParamValues(StringBuffer cmd, int start, int count) {
+ protected String[] parseParamValues(StringBuilder cmd, int start, int count) {
int valIndex = 0;
boolean inside = false;
String[] vals = new String[count];
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
char endQuote = 0;
for (int bIdx = start; bIdx < cmd.length(); bIdx++) {
if (!inside) {
@@ -276,14 +276,14 @@
/**
- * Parse a StringBuffer and take out the command token. Called from
+ * Parse a StringBuilder and take out the command token. Called from
* <code>requestHandler</code>
*
* @param cmd
- * a value of type 'StringBuffer'
+ * a value of type 'StringBuilder'
* @return a value of type 'String', or null if there is none
*/
- private String parseCmd(StringBuffer cmd) {
+ private String parseCmd(StringBuilder cmd) {
int firstLetter = -1;
int lastLetter = -1;
for (int i = 0; i < cmd.length(); i++) {
Modified: trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -195,7 +195,7 @@
Enumeration acceptHeaders = req.getHeaders(accept);
if (acceptHeaders != null)
if (acceptHeaders.hasMoreElements()) {
- StringBuffer rv = new StringBuffer(
+ StringBuilder rv = new StringBuilder(
(String) acceptHeaders.nextElement());
while (acceptHeaders.hasMoreElements()) {
rv.append(", ");
@@ -312,7 +312,7 @@
} else if (nameParts[1].equals("PROTOCOL")) {
retVal = req.getProtocol();
} else if (nameParts[1].equals("SOFTWARE")) {
- StringBuffer rv = new StringBuffer(context.getServerInfo());
+ StringBuilder rv = new StringBuilder(context.getServerInfo());
rv.append(" ");
rv.append(System.getProperty("java.vm.name"));
rv.append("/");
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -2280,7 +2280,7 @@
protected String getHostConfigPath(String resourceName) {
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
Container container = context;
Container host = null;
Container engine = null;
Modified: trunk/java/org/apache/catalina/startup/PasswdUserDatabase.java
===================================================================
--- trunk/java/org/apache/catalina/startup/PasswdUserDatabase.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/startup/PasswdUserDatabase.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -139,7 +139,7 @@
while (true) {
// Accumulate the next line
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
while (true) {
int ch = reader.read();
if ((ch < 0) || (ch == '\n'))
Modified: trunk/java/org/apache/catalina/startup/SetNextNamingRule.java
===================================================================
--- trunk/java/org/apache/catalina/startup/SetNextNamingRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/startup/SetNextNamingRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -106,7 +106,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SetNextRule[");
+ StringBuilder sb = new StringBuilder("SetNextRule[");
sb.append("methodName=");
sb.append(methodName);
sb.append(", paramType=");
Modified: trunk/java/org/apache/catalina/startup/WebRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebRuleSet.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/startup/WebRuleSet.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -921,7 +921,7 @@
}
if (target == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("[CallMethodRule]{");
sb.append("");
sb.append("} Call target is null (");
Modified: trunk/java/org/apache/catalina/util/DOMWriter.java
===================================================================
--- trunk/java/org/apache/catalina/util/DOMWriter.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/DOMWriter.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -290,7 +290,7 @@
/** Normalizes the given string. */
protected String normalize(String s) {
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
int len = (s != null) ? s.length() : 0;
for ( int i = 0; i < len; i++ ) {
Modified: trunk/java/org/apache/catalina/util/Extension.java
===================================================================
--- trunk/java/org/apache/catalina/util/Extension.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/Extension.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -220,7 +220,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("Extension[");
+ StringBuilder sb = new StringBuilder("Extension[");
sb.append(extensionName);
if (implementationURL != null) {
sb.append(", implementationURL=");
Modified: trunk/java/org/apache/catalina/util/HexUtils.java
===================================================================
--- trunk/java/org/apache/catalina/util/HexUtils.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/HexUtils.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -112,7 +112,7 @@
*/
public static String convert(byte bytes[]) {
- StringBuffer sb = new StringBuffer(bytes.length * 2);
+ StringBuilder sb = new StringBuilder(bytes.length * 2);
for (int i = 0; i < bytes.length; i++) {
sb.append(convertDigit((int) (bytes[i] >> 4)));
sb.append(convertDigit((int) (bytes[i] & 0x0f)));
Modified: trunk/java/org/apache/catalina/util/ManifestResource.java
===================================================================
--- trunk/java/org/apache/catalina/util/ManifestResource.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/ManifestResource.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -129,7 +129,7 @@
public String toString() {
- StringBuffer sb = new StringBuffer("ManifestResource[");
+ StringBuilder sb = new StringBuilder("ManifestResource[");
sb.append(resourceName);
sb.append(", isFulfilled=");
Modified: trunk/java/org/apache/catalina/util/RequestUtil.java
===================================================================
--- trunk/java/org/apache/catalina/util/RequestUtil.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/RequestUtil.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -60,7 +60,7 @@
char content[] = new char[message.length()];
message.getChars(0, message.length(), content, 0);
- StringBuffer result = new StringBuffer(content.length + 50);
+ StringBuilder result = new StringBuilder(content.length + 50);
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
case '<':
Modified: trunk/java/org/apache/catalina/util/Strftime.java
===================================================================
--- trunk/java/org/apache/catalina/util/Strftime.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/Strftime.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -169,7 +169,7 @@
boolean mark = false;
boolean modifiedCommand = false;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for(int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
@@ -231,7 +231,7 @@
* @param oldInside Flag value
* @return True if new is inside buffer
*/
- protected boolean translateCommand( StringBuffer buf, String pattern, int index, boolean oldInside ) {
+ protected boolean translateCommand( StringBuilder buf, String pattern, int index, boolean oldInside ) {
char firstChar = pattern.charAt( index );
boolean newInside = oldInside;
Modified: trunk/java/org/apache/catalina/util/URLEncoder.java
===================================================================
--- trunk/java/org/apache/catalina/util/URLEncoder.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/URLEncoder.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -60,7 +60,7 @@
public String encode( String path ) {
int maxBytesPerChar = 10;
int caseDiff = ('a' - 'A');
- StringBuffer rewrittenPath = new StringBuffer(path.length());
+ StringBuilder rewrittenPath = new StringBuilder(path.length());
ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar);
OutputStreamWriter writer = null;
try {
Modified: trunk/java/org/apache/catalina/util/XMLWriter.java
===================================================================
--- trunk/java/org/apache/catalina/util/XMLWriter.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/util/XMLWriter.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -55,7 +55,7 @@
/**
* Buffer.
*/
- protected StringBuffer buffer = new StringBuffer();
+ protected StringBuilder buffer = new StringBuilder();
/**
@@ -236,7 +236,7 @@
throws IOException {
if (writer != null) {
writer.write(buffer.toString());
- buffer = new StringBuffer();
+ buffer = new StringBuilder();
}
}
Modified: trunk/java/org/apache/catalina/valves/AccessLogValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/AccessLogValve.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/valves/AccessLogValve.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -575,7 +575,7 @@
}
Date date = getDate();
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
for (int i = 0; i < logElements.length; i++) {
logElements[i].addElement(result, date, request, response, time);
@@ -781,7 +781,7 @@
private String calculateTimeZoneOffset(long offset) {
- StringBuffer tz = new StringBuffer();
+ StringBuilder tz = new StringBuilder();
if ((offset < 0)) {
tz.append("-");
offset = -offset;
@@ -901,7 +901,7 @@
* AccessLogElement writes the partial message into the buffer.
*/
protected interface AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time);
}
@@ -910,7 +910,7 @@
* write thread name - %I
*/
protected class ThreadNameElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
RequestInfo info = request.getCoyoteRequest().getRequestProcessor();
if(info != null) {
@@ -928,7 +928,7 @@
private String value = null;
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (value == null) {
synchronized (this) {
@@ -947,7 +947,7 @@
* write remote IP address - %a
*/
protected class RemoteAddrElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(request.getRemoteAddr());
}
@@ -957,7 +957,7 @@
* write remote host name - %h
*/
protected class HostElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(request.getRemoteHost());
}
@@ -967,7 +967,7 @@
* write remote logical username from identd (always returns '-') - %l
*/
protected class LogicalUserNameElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append('-');
}
@@ -977,7 +977,7 @@
* write request protocol - %H
*/
protected class ProtocolElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(request.getProtocol());
}
@@ -987,7 +987,7 @@
* write remote user that was authenticated (if any), else '-' - %u
*/
protected class UserElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (request != null) {
String value = request.getRemoteUser();
@@ -1010,12 +1010,12 @@
private String currentDateString = null;
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (currentDate != date) {
synchronized (this) {
if (currentDate != date) {
- StringBuffer current = new StringBuffer(32);
+ StringBuilder current = new StringBuilder(32);
current.append('[');
current.append(dayFormatter.format(date)); // Day
current.append('/');
@@ -1040,7 +1040,7 @@
* write first line of the request (method and request URI) - %r
*/
protected class RequestElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (request != null) {
buf.append(request.getMethod());
@@ -1062,7 +1062,7 @@
* write HTTP status code of the response - %s
*/
protected class HttpStatusCodeElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (response != null) {
buf.append(response.getStatus());
@@ -1076,7 +1076,7 @@
* write local port on which this request was received - %p
*/
protected class LocalPortElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(request.getServerPort());
}
@@ -1095,7 +1095,7 @@
this.conversion = conversion;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
long length = response.getContentCountLong() ;
if (length <= 0 && conversion) {
@@ -1110,7 +1110,7 @@
* write request method (GET, POST, etc.) - %m
*/
protected class MethodElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (request != null) {
buf.append(request.getMethod());
@@ -1132,7 +1132,7 @@
this.millis = millis;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (millis) {
buf.append(time);
@@ -1153,7 +1153,7 @@
* write Query string (prepended with a '?' if it exists) - %q
*/
protected class QueryElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
String query = null;
if (request != null)
@@ -1169,7 +1169,7 @@
* write user session ID - %S
*/
protected class SessionIdElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (request != null) {
if (request.getSession(false) != null) {
@@ -1188,7 +1188,7 @@
* write requested URL path - %U
*/
protected class RequestURIElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (request != null) {
buf.append(request.getRequestURI());
@@ -1202,7 +1202,7 @@
* write local server name - %v
*/
protected class LocalServerNameElement implements AccessLogElement {
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(request.getServerName());
}
@@ -1218,7 +1218,7 @@
this.str = str;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(str);
}
@@ -1234,7 +1234,7 @@
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
String value = request.getHeader(header);
if (value == null) {
@@ -1255,7 +1255,7 @@
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
String value = "-";
Cookie[] c = request.getCookies();
@@ -1281,7 +1281,7 @@
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (null != response) {
String[] values = response.getHeaderValues(header);
@@ -1309,7 +1309,7 @@
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
Object value = null;
if (request != null) {
@@ -1339,7 +1339,7 @@
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
Object value = null;
if (null != request) {
@@ -1370,7 +1370,7 @@
protected AccessLogElement[] createLogElements() {
List<AccessLogElement> list = new ArrayList<AccessLogElement>();
boolean replace = false;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i = 0; i < pattern.length(); i++) {
char ch = pattern.charAt(i);
if (replace) {
@@ -1379,7 +1379,7 @@
* not enounter a closing } - then I ignore the {
*/
if ('{' == ch) {
- StringBuffer name = new StringBuffer();
+ StringBuilder name = new StringBuilder();
int j = i + 1;
for (; j < pattern.length() && '}' != pattern.charAt(j); j++) {
name.append(pattern.charAt(j));
@@ -1402,7 +1402,7 @@
} else if (ch == '%') {
replace = true;
list.add(new StringElement(buf.toString()));
- buf = new StringBuffer();
+ buf = new StringBuilder();
} else {
buf.append(ch);
}
Modified: trunk/java/org/apache/catalina/valves/ErrorReportValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/ErrorReportValve.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/valves/ErrorReportValve.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -172,7 +172,7 @@
if (report == null)
return;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("<html><head><title>");
sb.append(ServerInfo.getServerInfo()).append(" - ");
@@ -267,7 +267,7 @@
* occurrence of javax.servlet.).
*/
protected String getPartialServletStackTrace(Throwable t) {
- StringBuffer trace = new StringBuffer();
+ StringBuilder trace = new StringBuilder();
trace.append(t.toString()).append('\n');
StackTraceElement[] elements = t.getStackTrace();
int pos = elements.length;
Modified: trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -186,7 +186,7 @@
}
/* Wrap all quotes in double quotes. */
- StringBuffer buffer = new StringBuffer(svalue.length() + 2);
+ StringBuilder buffer = new StringBuilder(svalue.length() + 2);
buffer.append('\'');
int i = 0;
while (i < svalue.length()) {
@@ -236,7 +236,7 @@
dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (currentDate != date) {
synchronized (this) {
@@ -265,7 +265,7 @@
timeFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (currentDate != date) {
synchronized (this) {
@@ -285,7 +285,7 @@
public RequestHeaderElement(String header) {
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(wrap(request.getHeader(header)));
}
@@ -298,7 +298,7 @@
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(wrap(response.getHeader(header)));
}
@@ -310,7 +310,7 @@
public ServletContextElement(String attribute) {
this.attribute = attribute;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(wrap(request.getContext().getServletContext()
.getAttribute(attribute)));
@@ -323,7 +323,7 @@
public CookieElement(String name) {
this.name = name;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
Cookie[] c = request.getCookies();
for (int i = 0; c != null && i < c.length; i++) {
@@ -344,12 +344,12 @@
this.header = header;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
if (null != response) {
String[] values = response.getHeaderValues(header);
if(values.length > 0) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int i = 0; i < values.length; i++) {
String string = values[i];
buffer.append(string) ;
@@ -371,7 +371,7 @@
this.attribute = attribute;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(wrap(request.getAttribute(attribute)));
}
@@ -383,7 +383,7 @@
public SessionAttributeElement(String attribute) {
this.attribute = attribute;
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
HttpSession session = null;
if (request != null) {
@@ -410,7 +410,7 @@
return URLEncoder.encode(value);
}
- public void addElement(StringBuffer buf, Date date, Request request,
+ public void addElement(StringBuilder buf, Date date, Request request,
Response response, long time) {
buf.append(wrap(urlEncode(request.getParameter(parameter))));
}
@@ -418,7 +418,7 @@
protected class PatternTokenizer {
private StringReader sr = null;
- private StringBuffer buf = new StringBuffer();
+ private StringBuilder buf = new StringBuilder();
private boolean ended = false;
private boolean subToken;
private boolean parameter;
@@ -448,22 +448,22 @@
switch (c) {
case ' ':
result = buf.toString();
- buf = new StringBuffer();
+ buf = new StringBuilder();
buf.append((char) c);
return result;
case '-':
result = buf.toString();
- buf = new StringBuffer();
+ buf = new StringBuilder();
subToken = true;
return result;
case '(':
result = buf.toString();
- buf = new StringBuffer();
+ buf = new StringBuilder();
parameter = true;
return result;
case ')':
result = buf.toString();
- buf = new StringBuffer();
+ buf = new StringBuilder();
break;
default:
buf.append((char) c);
@@ -488,7 +488,7 @@
while (c != -1) {
if (c == ')') {
result = buf.toString();
- buf = new StringBuffer();
+ buf = new StringBuilder();
return result;
}
buf.append((char) c);
@@ -500,10 +500,10 @@
public String getWhiteSpaces() throws IOException {
if(isEnded())
return "" ;
- StringBuffer whiteSpaces = new StringBuffer();
+ StringBuilder whiteSpaces = new StringBuilder();
if (buf.length() > 0) {
whiteSpaces.append(buf);
- buf = new StringBuffer();
+ buf = new StringBuilder();
}
int c = sr.read();
while (Character.isWhitespace((char) c)) {
@@ -523,7 +523,7 @@
}
public String getRemains() throws IOException {
- StringBuffer remains = new StringBuffer();
+ StringBuilder remains = new StringBuilder();
for(int c = sr.read(); c != -1; c = sr.read()) {
remains.append((char) c);
}
@@ -608,7 +608,7 @@
return new LocalAddrElement();
} else if ("dns".equals(nextToken)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
String value;
try {
@@ -646,7 +646,7 @@
return new RequestURIElement();
} else if ("query".equals(token)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response,
long time) {
String query = request.getQueryString();
@@ -660,7 +660,7 @@
}
} else {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
String query = request.getQueryString();
if (query == null) {
@@ -762,28 +762,28 @@
protected AccessLogElement getServletRequestElement(String parameter) {
if ("authType".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap(request.getAuthType()));
}
};
} else if ("remoteUser".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap(request.getRemoteUser()));
}
};
} else if ("requestedSessionId".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap(request.getRequestedSessionId()));
}
};
} else if ("requestedSessionIdFromCookie".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap(""
+ request.isRequestedSessionIdFromCookie()));
@@ -791,49 +791,49 @@
};
} else if ("requestedSessionIdValid".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap("" + request.isRequestedSessionIdValid()));
}
};
} else if ("contentLength".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap("" + request.getContentLength()));
}
};
} else if ("characterEncoding".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap(request.getCharacterEncoding()));
}
};
} else if ("locale".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap(request.getLocale()));
}
};
} else if ("protocol".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap(request.getProtocol()));
}
};
} else if ("scheme".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(request.getScheme());
}
};
} else if ("secure".equals(parameter)) {
return new AccessLogElement() {
- public void addElement(StringBuffer buf, Date date,
+ public void addElement(StringBuilder buf, Date date,
Request request, Response response, long time) {
buf.append(wrap("" + request.isSecure()));
}
Modified: trunk/java/org/apache/catalina/valves/ValveBase.java
===================================================================
--- trunk/java/org/apache/catalina/valves/ValveBase.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/catalina/valves/ValveBase.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -205,7 +205,7 @@
* Return a String rendering of this object.
*/
public String toString() {
- StringBuffer sb = new StringBuffer(this.getClass().getName());
+ StringBuilder sb = new StringBuilder(this.getClass().getName());
sb.append("[");
if (container != null)
sb.append(container.getName());
Modified: trunk/java/org/apache/coyote/Response.java
===================================================================
--- trunk/java/org/apache/coyote/Response.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/coyote/Response.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -412,7 +412,7 @@
contentLanguage = locale.getLanguage();
if ((contentLanguage != null) && (contentLanguage.length() > 0)) {
String country = locale.getCountry();
- StringBuffer value = new StringBuffer(contentLanguage);
+ StringBuilder value = new StringBuilder(contentLanguage);
if ((country != null) && (country.length() > 0)) {
value.append('-');
value.append(country);
Modified: trunk/java/org/apache/coyote/ajp/AjpMessage.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpMessage.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/coyote/ajp/AjpMessage.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -432,7 +432,7 @@
protected static String hexLine(byte buf[], int start, int len) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = start; i < start + 16 ; i++) {
if (i < len + 4) {
sb.append(hex(buf[i]) + " ");
Modified: trunk/java/org/apache/el/parser/AstCompositeExpression.java
===================================================================
--- trunk/java/org/apache/el/parser/AstCompositeExpression.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/el/parser/AstCompositeExpression.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -40,7 +40,7 @@
public Object getValue(EvaluationContext ctx)
throws ELException {
- StringBuffer sb = new StringBuffer(16);
+ StringBuilder sb = new StringBuilder(16);
Object obj = null;
if (this.children != null) {
for (int i = 0; i < this.children.length; i++) {
Modified: trunk/java/org/apache/el/parser/AstLiteralExpression.java
===================================================================
--- trunk/java/org/apache/el/parser/AstLiteralExpression.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/el/parser/AstLiteralExpression.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -46,7 +46,7 @@
return;
}
int size = image.length();
- StringBuffer buf = new StringBuffer(size);
+ StringBuilder buf = new StringBuilder(size);
for (int i = 0; i < size; i++) {
char c = image.charAt(i);
if (c == '\\' && i + 1 < size) {
Modified: trunk/java/org/apache/el/parser/AstString.java
===================================================================
--- trunk/java/org/apache/el/parser/AstString.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/el/parser/AstString.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -57,7 +57,7 @@
return;
}
int size = image.length();
- StringBuffer buf = new StringBuffer(size);
+ StringBuilder buf = new StringBuilder(size);
for (int i = 0; i < size; i++) {
char c = image.charAt(i);
if (c == '\\' && i + 1 < size) {
Modified: trunk/java/org/apache/el/parser/ParseException.java
===================================================================
--- trunk/java/org/apache/el/parser/ParseException.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/el/parser/ParseException.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -100,7 +100,7 @@
if (!specialConstructor) {
return super.getMessage();
}
- StringBuffer expected = new StringBuffer();
+ StringBuilder expected = new StringBuilder();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
@@ -150,7 +150,7 @@
* string literal.
*/
protected String add_escapes(String str) {
- StringBuffer retval = new StringBuffer();
+ StringBuilder retval = new StringBuilder();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
Modified: trunk/java/org/apache/el/parser/TokenMgrError.java
===================================================================
--- trunk/java/org/apache/el/parser/TokenMgrError.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/el/parser/TokenMgrError.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -41,7 +41,7 @@
* equivalents in the given string
*/
protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
+ StringBuilder retval = new StringBuilder();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
Modified: trunk/java/org/apache/el/util/ReflectionUtil.java
===================================================================
--- trunk/java/org/apache/el/util/ReflectionUtil.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/el/util/ReflectionUtil.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -144,7 +144,7 @@
protected static final String paramString(Class[] types) {
if (types != null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < types.length; i++) {
sb.append(types[i].getName()).append(", ");
}
Modified: trunk/java/org/apache/jasper/JspCompilationContext.java
===================================================================
--- trunk/java/org/apache/jasper/JspCompilationContext.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/JspCompilationContext.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -701,7 +701,7 @@
protected static final String canonicalURI(String s) {
if (s == null) return null;
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
final int len = s.length();
int pos = 0;
while (pos < len) {
Modified: trunk/java/org/apache/jasper/compiler/DefaultErrorHandler.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/DefaultErrorHandler.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/DefaultErrorHandler.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -64,7 +64,7 @@
}
Object[] args = null;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i=0; i < details.length; i++) {
if (details[i].getJspBeginLineNumber() >= 0) {
Modified: trunk/java/org/apache/jasper/compiler/Dumper.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Dumper.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/Dumper.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -29,7 +29,7 @@
if (attrs == null)
return "";
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i=0; i < attrs.getLength(); i++) {
buf.append(" " + attrs.getQName(i) + "=\""
+ attrs.getValue(i) + "\"");
Modified: trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -33,8 +33,8 @@
public class ELFunctionMapper {
static private int currFunc = 0;
private ErrorDispatcher err;
- StringBuffer ds; // Contains codes to initialize the functions mappers.
- StringBuffer ss; // Contains declarations of the functions mappers.
+ StringBuilder ds; // Contains codes to initialize the functions mappers.
+ StringBuilder ss; // Contains declarations of the functions mappers.
/**
* Creates the functions mappers for all EL expressions in the JSP page.
@@ -48,8 +48,8 @@
currFunc = 0;
ELFunctionMapper map = new ELFunctionMapper();
map.err = compiler.getErrorDispatcher();
- map.ds = new StringBuffer();
- map.ss = new StringBuffer();
+ map.ds = new StringBuilder();
+ map.ss = new StringBuilder();
page.visit(map.new ELFunctionVisitor());
Modified: trunk/java/org/apache/jasper/compiler/ELParser.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/ELParser.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/ELParser.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -86,7 +86,7 @@
*/
private ELNode.Nodes parseEL() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
ELexpr = new ELNode.Nodes();
while (hasNext()) {
curToken = nextToken();
@@ -176,7 +176,7 @@
*/
private String skipUntilEL() {
char prev = 0;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
while (hasNextChar()) {
char ch = nextChar();
if (prev == '\\') {
@@ -227,7 +227,7 @@
if (hasNextChar()) {
char ch = nextChar();
if (Character.isJavaIdentifierStart(ch)) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(ch);
while ((ch = peekChar()) != -1
&& Character.isJavaIdentifierPart(ch)) {
@@ -252,7 +252,7 @@
* '\\', and ('\"', or "\'")
*/
private Token parseQuotedChars(char quote) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(quote);
while (hasNextChar()) {
char ch = nextChar();
Modified: trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -431,7 +431,7 @@
throws IOException, JasperException {
ArrayList<JavacErrorDetail> errors = new ArrayList<JavacErrorDetail>();
- StringBuffer errMsgBuf = null;
+ StringBuilder errMsgBuf = null;
int lineNum = -1;
JavacErrorDetail javacError = null;
@@ -465,7 +465,7 @@
lineNum = -1;
}
- errMsgBuf = new StringBuffer();
+ errMsgBuf = new StringBuilder();
javacError = createJavacError(fname, page, errMsgBuf, lineNum);
}
@@ -503,7 +503,7 @@
* @throws JasperException
*/
public static JavacErrorDetail createJavacError(String fname,
- Node.Nodes page, StringBuffer errMsgBuf, int lineNum)
+ Node.Nodes page, StringBuilder errMsgBuf, int lineNum)
throws JasperException {
return createJavacError(fname, page, errMsgBuf, lineNum, null);
}
@@ -519,7 +519,7 @@
* @throws JasperException
*/
public static JavacErrorDetail createJavacError(String fname,
- Node.Nodes page, StringBuffer errMsgBuf, int lineNum,
+ Node.Nodes page, StringBuilder errMsgBuf, int lineNum,
JspCompilationContext ctxt) throws JasperException {
JavacErrorDetail javacError;
// Attempt to map javac error line number to line in JSP page
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -129,7 +129,7 @@
if (s == null)
return "";
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '"')
@@ -151,7 +151,7 @@
*/
static String quote(char c) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
b.append('\'');
if (c == '\'')
b.append('\\').append('\'');
@@ -169,7 +169,7 @@
private String createJspId() throws JasperException {
if (this.jspIdPrefix == null) {
- StringBuffer sb = new StringBuffer(32);
+ StringBuilder sb = new StringBuilder(32);
String name = ctxt.getServletJavaFileName();
sb.append("jsp_").append(Math.abs(name.hashCode())).append('_');
this.jspIdPrefix = sb.toString();
@@ -846,7 +846,7 @@
if (tx==null) return null;
Class<?> type = expectedType;
int size = tx.length();
- StringBuffer output = new StringBuffer(size);
+ StringBuilder output = new StringBuilder(size);
boolean el = false;
int i = 0;
int mark = 0;
@@ -2015,7 +2015,7 @@
n.setBeginJavaLine(out.getJavaLine());
out.printin();
- StringBuffer sb = new StringBuffer("out.write(\"");
+ StringBuilder sb = new StringBuilder("out.write(\"");
int initLength = sb.length();
int count = JspUtil.CHUNKSIZE;
int srcLine = 0; // relative to starting srouce line
@@ -2843,7 +2843,7 @@
} else if (attr.isELInterpreterInput()) {
// results buffer
- StringBuffer sb = new StringBuffer(64);
+ StringBuilder sb = new StringBuilder(64);
TagAttributeInfo tai = attr.getTagAttributeInfo();
Modified: trunk/java/org/apache/jasper/compiler/JCICompiler.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JCICompiler.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/JCICompiler.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -97,7 +97,7 @@
for (int i = 0; i < problems.length; i++) {
CompilationProblem problem = problems[i];
problemList.add(ErrorDispatcher.createJavacError
- (problem.getFileName(), pageNodes, new StringBuffer(problem.getMessage()),
+ (problem.getFileName(), pageNodes, new StringBuilder(problem.getMessage()),
problem.getStartLine(), ctxt));
}
} catch (JasperException e) {
Modified: trunk/java/org/apache/jasper/compiler/JDTCompiler.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JDTCompiler.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/JDTCompiler.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -106,7 +106,7 @@
new BufferedReader(new InputStreamReader(is, ctxt.getOptions().getJavaEncoding()));
if (reader != null) {
char[] chars = new char[8192];
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
int count;
while ((count = reader.read(chars, 0,
chars.length)) > 0) {
@@ -375,7 +375,7 @@
new String(problems[i].getOriginatingFileName());
try {
problemList.add(ErrorDispatcher.createJavacError
- (name, pageNodes, new StringBuffer(problem.getMessage()),
+ (name, pageNodes, new StringBuilder(problem.getMessage()),
problem.getSourceLineNumber(), ctxt));
} catch (JasperException e) {
log.error("Error visiting node", e);
Modified: trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -39,7 +39,7 @@
private int javaLineNum;
private String jspFileName;
private int jspBeginLineNum;
- private StringBuffer errMsg;
+ private StringBuilder errMsg;
private String jspExtract = null;
/**
@@ -52,7 +52,7 @@
*/
public JavacErrorDetail(String javaFileName,
int javaLineNum,
- StringBuffer errMsg) {
+ StringBuilder errMsg) {
this.javaFileName = javaFileName;
this.javaLineNum = javaLineNum;
@@ -76,7 +76,7 @@
int javaLineNum,
String jspFileName,
int jspBeginLineNum,
- StringBuffer errMsg) {
+ StringBuilder errMsg) {
this(javaFileName, javaLineNum, jspFileName, jspBeginLineNum, errMsg,
null);
@@ -86,7 +86,7 @@
int javaLineNum,
String jspFileName,
int jspBeginLineNum,
- StringBuffer errMsg,
+ StringBuilder errMsg,
JspCompilationContext ctxt) {
this(javaFileName, javaLineNum, errMsg);
@@ -119,7 +119,7 @@
}
// copy out a fragment of JSP to display to the user
- StringBuffer fragment = new StringBuffer(1024);
+ StringBuilder fragment = new StringBuilder(1024);
int startIndex = Math.max(0, this.jspBeginLineNum-1-3);
int endIndex = Math.min(
jspLines.length-1, this.jspBeginLineNum-1+3);
Modified: trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JspDocumentParser.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/JspDocumentParser.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -69,7 +69,7 @@
private JspCompilationContext ctxt;
private PageInfo pageInfo;
private String path;
- private StringBuffer charBuffer;
+ private StringBuilder charBuffer;
// Node representing the XML element currently being parsed
private Node current;
@@ -458,7 +458,7 @@
public void characters(char[] buf, int offset, int len) {
if (charBuffer == null) {
- charBuffer = new StringBuffer();
+ charBuffer = new StringBuilder();
}
charBuffer.append(buf, offset, len);
}
Modified: trunk/java/org/apache/jasper/compiler/JspReader.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JspReader.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/JspReader.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -420,9 +420,9 @@
* @param quoted If <strong>true</strong> accept quoted strings.
*/
String parseToken(boolean quoted) throws JasperException {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder StringBuilder = new StringBuilder();
skipSpaces();
- stringBuffer.setLength(0);
+ StringBuilder.setLength(0);
if (!hasMoreInput()) {
return "";
@@ -440,7 +440,7 @@
ch = nextChar()) {
if (ch == '\\')
ch = nextChar();
- stringBuffer.append((char) ch);
+ StringBuilder.append((char) ch);
}
// Check end of quote, skip closing quote:
if (ch == -1) {
@@ -460,12 +460,12 @@
peekChar() == '>' || peekChar() == '%')
ch = nextChar();
}
- stringBuffer.append((char) ch);
+ StringBuilder.append((char) ch);
} while (!isDelimiter());
}
}
- return stringBuffer.toString();
+ return StringBuilder.toString();
}
void setSingleFile(boolean val) {
Modified: trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -324,7 +324,7 @@
}
URL [] urls = ((URLClassLoader) parentClassLoader).getURLs();
- StringBuffer cpath = new StringBuffer();
+ StringBuilder cpath = new StringBuilder();
String sep = System.getProperty("path.separator");
for(int i = 0; i < urls.length; i++) {
Modified: trunk/java/org/apache/jasper/compiler/JspUtil.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JspUtil.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/JspUtil.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -102,7 +102,7 @@
int n = s.indexOf("%\\>");
if (n < 0)
break;
- StringBuffer sb = new StringBuffer(s.substring(0, n));
+ StringBuilder sb = new StringBuilder(s.substring(0, n));
sb.append("%>");
sb.append(s.substring(n + 3));
s = sb.toString();
@@ -335,7 +335,7 @@
*/
public static String escapeXml(String s) {
if (s == null) return null;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for(int i=0; i<s.length(); i++) {
char c = s.charAt(i);
if (c == '<') {
@@ -360,7 +360,7 @@
* string <tt>with</tt>.
*/
public static String replace(String name, char replace, String with) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
int begin = 0;
int end;
int last = name.length();
@@ -555,7 +555,7 @@
// the generated Servlet/SimpleTag implements FunctionMapper, so
// that machinery is already in place (mroth).
targetType = toJavaSourceType(targetType);
- StringBuffer call = new StringBuffer(
+ StringBuilder call = new StringBuilder(
"(" + targetType + ") "
+ "org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate"
+ "(" + Generator.quote(expression) + ", "
@@ -907,7 +907,7 @@
}
private static String getClassNameBase(String urn) {
- StringBuffer base = new StringBuffer("org.apache.jsp.tag.meta.");
+ StringBuilder base = new StringBuilder("org.apache.jsp.tag.meta.");
if (urn != null) {
base.append(makeJavaPackage(urn));
base.append('.');
@@ -924,7 +924,7 @@
*/
public static final String makeJavaPackage(String path) {
String classNameComponents[] = split(path,"/");
- StringBuffer legalClassNames = new StringBuffer();
+ StringBuilder legalClassNames = new StringBuilder();
for (int i = 0; i < classNameComponents.length; i++) {
legalClassNames.append(makeJavaIdentifier(classNameComponents[i]));
if (i < classNameComponents.length - 1) {
@@ -970,8 +970,8 @@
* @return Legal Java identifier corresponding to the given identifier
*/
public static final String makeJavaIdentifier(String identifier) {
- StringBuffer modifiedIdentifier =
- new StringBuffer(identifier.length());
+ StringBuilder modifiedIdentifier =
+ new StringBuilder(identifier.length());
if (!Character.isJavaIdentifierStart(identifier.charAt(0))) {
modifiedIdentifier.append('_');
}
@@ -1123,7 +1123,7 @@
break;
}
}
- StringBuffer resultType = new StringBuffer(t);
+ StringBuilder resultType = new StringBuilder(t);
for (; dims > 0; dims--) {
resultType.append("[]");
}
@@ -1146,7 +1146,7 @@
return binaryName;
}
- StringBuffer buf = new StringBuffer(binaryName);
+ StringBuilder buf = new StringBuilder(binaryName);
do {
buf.setCharAt(c.getName().length(), '.');
c = c.getDeclaringClass();
Modified: trunk/java/org/apache/jasper/compiler/Node.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Node.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/Node.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -851,7 +851,7 @@
String ret = text;
if (ret == null) {
if (body != null) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i = 0; i < body.size(); i++) {
buf.append(body.getNode(i).getText());
}
Modified: trunk/java/org/apache/jasper/compiler/PageDataImpl.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/PageDataImpl.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/PageDataImpl.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -53,7 +53,7 @@
private static final String CDATA_END_SECTION = "]]>\n";
// string buffer used to build XML view
- private StringBuffer buf;
+ private StringBuilder buf;
/**
* Constructor.
@@ -69,7 +69,7 @@
page.visit(firstPass);
// Second pass
- buf = new StringBuffer();
+ buf = new StringBuilder();
SecondPassVisitor secondPass
= new SecondPassVisitor(page.getRoot(), buf, compiler,
firstPass.getJspIdPrefix());
@@ -82,7 +82,7 @@
* @return the input stream of the XML view
*/
public InputStream getInputStream() {
- // Turn StringBuffer into InputStream
+ // Turn StringBuilder into InputStream
try {
return new ByteArrayInputStream(buf.toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException uee) {
@@ -234,7 +234,7 @@
implements TagConstants {
private Node.Root root;
- private StringBuffer buf;
+ private StringBuilder buf;
private Compiler compiler;
private String jspIdPrefix;
private boolean resetDefaultNS = false;
@@ -245,7 +245,7 @@
/*
* Constructor
*/
- public SecondPassVisitor(Node.Root root, StringBuffer buf,
+ public SecondPassVisitor(Node.Root root, StringBuilder buf,
Compiler compiler, String jspIdPrefix) {
this.root = root;
this.buf = buf;
Modified: trunk/java/org/apache/jasper/compiler/Parser.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Parser.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/Parser.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -218,7 +218,7 @@
private String parseName() throws JasperException {
char ch = (char) reader.peekChar();
if (Character.isLetter(ch) || ch == '_' || ch == ':') {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(ch);
reader.nextChar();
ch = (char) reader.peekChar();
@@ -261,7 +261,7 @@
*/
private String parseQuoted(Mark start, String tx, char quote)
throws JasperException {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
int size = tx.length();
int i = 0;
while (i < size) {
Modified: trunk/java/org/apache/jasper/compiler/SmapGenerator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/SmapGenerator.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/SmapGenerator.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -111,7 +111,7 @@
// check state and initialize buffer
if (outputFileName == null)
throw new IllegalStateException();
- StringBuffer out = new StringBuffer();
+ StringBuilder out = new StringBuilder();
// start the SMAP
out.append("SMAP\n");
Modified: trunk/java/org/apache/jasper/compiler/SmapStratum.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/SmapStratum.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/SmapStratum.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -93,7 +93,7 @@
public String getString() {
if (inputStartLine == -1 || outputStartLine == -1)
throw new IllegalStateException();
- StringBuffer out = new StringBuffer();
+ StringBuilder out = new StringBuilder();
out.append(inputStartLine);
if (lineFileIDSet)
out.append("#" + lineFileID);
@@ -295,7 +295,7 @@
if (fileNameList.size() == 0 || lineData.size() == 0)
return null;
- StringBuffer out = new StringBuffer();
+ StringBuilder out = new StringBuilder();
// print StratumSection
out.append("*S " + stratumName + "\n");
Modified: trunk/java/org/apache/jasper/compiler/TextOptimizer.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/TextOptimizer.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/TextOptimizer.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -32,7 +32,7 @@
private PageInfo pageInfo;
private int textNodeCount = 0;
private Node.TemplateText firstTextNode = null;
- private StringBuffer textBuffer;
+ private StringBuilder textBuffer;
private final String emptyText = new String("");
public TextCatVisitor(Compiler compiler) {
@@ -80,7 +80,7 @@
if (textNodeCount++ == 0) {
firstTextNode = n;
- textBuffer = new StringBuffer(n.getText());
+ textBuffer = new StringBuilder(n.getText());
} else {
// Append text to text buffer
textBuffer.append(n.getText());
Modified: trunk/java/org/apache/jasper/compiler/Validator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Validator.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/compiler/Validator.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -419,7 +419,7 @@
private ClassLoader loader;
- private final StringBuffer buf = new StringBuffer(32);
+ private final StringBuilder buf = new StringBuilder(32);
private static final JspUtil.ValidAttribute[] jspRootAttrs = {
new JspUtil.ValidAttribute("xsi:schemaLocation"),
@@ -716,7 +716,7 @@
}
// build expression
- StringBuffer expr = this.getBuffer();
+ StringBuilder expr = this.getBuffer();
expr.append(n.getType()).append('{').append(n.getText())
.append('}');
ELNode.Nodes el = ELParser.parse(expr.toString());
@@ -1388,9 +1388,9 @@
}
/*
- * Return an empty StringBuffer [not thread-safe]
+ * Return an empty StringBuilder [not thread-safe]
*/
- private StringBuffer getBuffer() {
+ private StringBuilder getBuffer() {
this.buf.setLength(0);
return this.buf;
}
@@ -1699,7 +1699,7 @@
ValidationMessage[] errors = tagInfo.validate(n.getTagData());
if (errors != null && errors.length != 0) {
- StringBuffer errMsg = new StringBuffer();
+ StringBuilder errMsg = new StringBuilder();
errMsg.append("<h3>");
errMsg.append(Localizer.getMessage(
"jsp.error.tei.invalid.attributes", n.getQName()));
@@ -1789,7 +1789,7 @@
private static void validateXmlView(PageData xmlView, Compiler compiler)
throws JasperException {
- StringBuffer errMsg = null;
+ StringBuilder errMsg = null;
ErrorDispatcher errDisp = compiler.getErrorDispatcher();
for (Iterator iter = compiler.getPageInfo().getTaglibs().iterator(); iter
@@ -1803,7 +1803,7 @@
ValidationMessage[] errors = tli.validate(xmlView);
if ((errors != null) && (errors.length != 0)) {
if (errMsg == null) {
- errMsg = new StringBuffer();
+ errMsg = new StringBuilder();
}
errMsg.append("<h3>");
errMsg.append(Localizer.getMessage(
Modified: trunk/java/org/apache/jasper/runtime/CharBuffer.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/CharBuffer.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/runtime/CharBuffer.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -216,7 +216,7 @@
*/
public String toString()
{
- StringBuffer sb = new StringBuffer(size());
+ StringBuilder sb = new StringBuilder(size());
for (Iterator iter = this.bufList.iterator(); iter.hasNext();) {
char[] curBuf = (char[]) iter.next();
sb.append(curBuf);
Modified: trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -42,7 +42,7 @@
// Logger
private Logger log = Logger.getLogger(JspFactoryImpl.class);
- private static final String SPEC_VERSION = "2.1";
+ private static final String SPEC_VERSION = "2.2";
private static final boolean USE_POOL =
Boolean.valueOf(System.getProperty("org.apache.jasper.runtime.JspFactoryImpl.USE_POOL", "true")).booleanValue();
private static final int POOL_SIZE =
Modified: trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -989,7 +989,7 @@
enc = "ISO-8859-1"; // The default request encoding
}
- StringBuffer out = new StringBuffer(s.length());
+ StringBuilder out = new StringBuilder(s.length());
ByteArrayOutputStream buf = new ByteArrayOutputStream();
OutputStreamWriter writer = null;
try {
Modified: trunk/java/org/apache/jasper/runtime/PageContextImpl.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/PageContextImpl.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/runtime/PageContextImpl.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -866,7 +866,7 @@
private static String XmlEscape(String s) {
if (s == null)
return null;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '<') {
Modified: trunk/java/org/apache/jasper/security/SecurityUtil.java
===================================================================
--- trunk/java/org/apache/jasper/security/SecurityUtil.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/security/SecurityUtil.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -55,7 +55,7 @@
char content[] = new char[message.length()];
message.getChars(0, message.length(), content, 0);
- StringBuffer result = new StringBuffer(content.length + 50);
+ StringBuilder result = new StringBuilder(content.length + 50);
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
case '<':
Modified: trunk/java/org/apache/jasper/tagplugins/jstl/Util.java
===================================================================
--- trunk/java/org/apache/jasper/tagplugins/jstl/Util.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/tagplugins/jstl/Util.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -150,7 +150,7 @@
* taken from org.apache.taglibs.standard.tag.common.core.ImportSupport
*/
public static String stripSession(String url) {
- StringBuffer u = new StringBuffer(url);
+ StringBuilder u = new StringBuilder(url);
int sessionStart;
while ((sessionStart = u.toString().indexOf(";" + Constants.SESSION_PARAMETER_NAME + "=")) != -1) {
int sessionEnd = u.toString().indexOf(";", sessionStart + 1);
@@ -182,16 +182,16 @@
int start = 0;
int length = buffer.length();
char[] arrayBuffer = buffer.toCharArray();
- StringBuffer escapedBuffer = null;
+ StringBuilder escapedBuffer = null;
for (int i = 0; i < length; i++) {
char c = arrayBuffer[i];
if (c <= HIGHEST_SPECIAL) {
char[] escaped = specialCharactersRepresentation[c];
if (escaped != null) {
- // create StringBuffer to hold escaped xml string
+ // create StringBuilder to hold escaped xml string
if (start == 0) {
- escapedBuffer = new StringBuffer(length + 5);
+ escapedBuffer = new StringBuilder(length + 5);
}
// add unescaped portion
if (start < i) {
Modified: trunk/java/org/apache/jasper/tagplugins/jstl/core/Import.java
===================================================================
--- trunk/java/org/apache/jasper/tagplugins/jstl/core/Import.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/tagplugins/jstl/core/Import.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -52,7 +52,7 @@
String requestDispatcherName = ctxt.getTemporaryVariableName();
String irwName = ctxt.getTemporaryVariableName(); //ImportResponseWrapper name
String brName = ctxt.getTemporaryVariableName(); //BufferedReader name
- String sbName = ctxt.getTemporaryVariableName(); //StringBuffer name
+ String sbName = ctxt.getTemporaryVariableName(); //StringBuilder name
String tempStringName = ctxt.getTemporaryVariableName();
//is absolute url
@@ -300,7 +300,7 @@
ctxt.generateJavaSource(" }");
ctxt.generateJavaSource(" java.io.BufferedReader " + brName + " = new java.io.BufferedReader(" + tempReaderName + ");");
- ctxt.generateJavaSource(" StringBuffer " + sbName + " = new StringBuffer();");
+ ctxt.generateJavaSource(" StringBuilder " + sbName + " = new StringBuilder();");
String index = ctxt.getTemporaryVariableName();
ctxt.generateJavaSource(" int " + index + ";");
ctxt.generateJavaSource(" while(("+index+" = "+brName+".read()) != -1) "+sbName+".append((char)"+index+");");
Modified: trunk/java/org/apache/jasper/xmlparser/TreeNode.java
===================================================================
--- trunk/java/org/apache/jasper/xmlparser/TreeNode.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/jasper/xmlparser/TreeNode.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -291,7 +291,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
toString(sb, 0, this);
return (sb.toString());
@@ -302,14 +302,14 @@
/**
- * Append to the specified StringBuffer a character representation of
+ * Append to the specified StringBuilder a character representation of
* this node, with the specified amount of indentation.
*
- * @param sb The StringBuffer to append to
+ * @param sb The StringBuilder to append to
* @param indent Number of characters of indentation
* @param node The TreeNode to be printed
*/
- protected void toString(StringBuffer sb, int indent,
+ protected void toString(StringBuilder sb, int indent,
TreeNode node) {
int indent2 = indent + 2;
Modified: trunk/java/org/apache/juli/JdkLoggerFormatter.java
===================================================================
--- trunk/java/org/apache/juli/JdkLoggerFormatter.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/juli/JdkLoggerFormatter.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -61,7 +61,7 @@
name = name.substring(name.lastIndexOf(".") + 1);
// Use a string buffer for better performance
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(time);
buf.append(" ");
Modified: trunk/java/org/apache/juli/OneLineFormatter.java
===================================================================
--- trunk/java/org/apache/juli/OneLineFormatter.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/juli/OneLineFormatter.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -54,7 +54,7 @@
@Override
public String format(LogRecord record) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
// Timestamp
addTimestamp(sb, new Date(record.getMillis()));
@@ -89,11 +89,11 @@
return sb.toString();
}
- public void addTimestamp(StringBuffer buf, Date date) {
+ public void addTimestamp(StringBuilder buf, Date date) {
if (currentDate != date) {
synchronized (this) {
if (currentDate != date) {
- StringBuffer current = new StringBuffer(32);
+ StringBuilder current = new StringBuilder(32);
current.append(dayFormatter.format(date)); // Day
current.append('-');
current.append(lookup(monthFormatter.format(date))); // Month
Modified: trunk/java/org/apache/naming/HandlerRef.java
===================================================================
--- trunk/java/org/apache/naming/HandlerRef.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/naming/HandlerRef.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -159,7 +159,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("HandlerRef[");
+ StringBuilder sb = new StringBuilder("HandlerRef[");
sb.append("className=");
sb.append(getClassName());
sb.append(",factoryClassLocation=");
Modified: trunk/java/org/apache/naming/ResourceRef.java
===================================================================
--- trunk/java/org/apache/naming/ResourceRef.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/naming/ResourceRef.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -140,7 +140,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ResourceRef[");
+ StringBuilder sb = new StringBuilder("ResourceRef[");
sb.append("className=");
sb.append(getClassName());
sb.append(",factoryClassLocation=");
Modified: trunk/java/org/apache/naming/ServiceRef.java
===================================================================
--- trunk/java/org/apache/naming/ServiceRef.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/naming/ServiceRef.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -188,7 +188,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ServiceRef[");
+ StringBuilder sb = new StringBuilder("ServiceRef[");
sb.append("className=");
sb.append(getClassName());
sb.append(",factoryClassLocation=");
Modified: trunk/java/org/apache/naming/StringManager.java
===================================================================
--- trunk/java/org/apache/naming/StringManager.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/naming/StringManager.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -120,7 +120,7 @@
iString = MessageFormat.format(value, nonNullArgs);
} catch (IllegalArgumentException iae) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(value);
for (int i = 0; i < args.length; i++) {
buf.append(" arg[" + i + "]=" + args[i]);
Modified: trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
===================================================================
--- trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -97,7 +97,7 @@
* Override as part of the fix for 36534, to ensure toString is correct.
*/
protected String toExternalForm(URL u) {
- // pre-compute length of StringBuffer
+ // pre-compute length of StringBuilder
int len = u.getProtocol().length() + 1;
if (u.getPath() != null) {
len += u.getPath().length();
@@ -107,7 +107,7 @@
}
if (u.getRef() != null)
len += 1 + u.getRef().length();
- StringBuffer result = new StringBuffer(len);
+ StringBuilder result = new StringBuilder(len);
result.append(u.getProtocol());
result.append(":");
if (u.getPath() != null) {
Modified: trunk/java/org/apache/tomcat/bayeux/ChannelImpl.java
===================================================================
--- trunk/java/org/apache/tomcat/bayeux/ChannelImpl.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/bayeux/ChannelImpl.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -178,7 +178,7 @@
}
public String toString() {
- StringBuffer buf = new StringBuffer(super.toString());
+ StringBuilder buf = new StringBuilder(super.toString());
buf.append("; channelId=").append(getId());
return buf.toString();
}
Modified: trunk/java/org/apache/tomcat/bayeux/ClientImpl.java
===================================================================
--- trunk/java/org/apache/tomcat/bayeux/ClientImpl.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/bayeux/ClientImpl.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -231,7 +231,7 @@
}
public String toString() {
- StringBuffer buf = new StringBuffer(super.toString());
+ StringBuilder buf = new StringBuilder(super.toString());
buf.append(" id=").append(getId());
return buf.toString();
}
Modified: trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
===================================================================
--- trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -480,7 +480,7 @@
if (value.indexOf("$") < 0) {
return value;
}
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int prev = 0;
// assert value!=nil
int pos;
@@ -958,7 +958,7 @@
if (dbg > 0) {
// debug
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("" + target.getClass().getName() + "." + methodN + "( ");
for (int i = 0; i < params.length; i++) {
if (i > 0)
Modified: trunk/java/org/apache/tomcat/util/buf/CharChunk.java
===================================================================
--- trunk/java/org/apache/tomcat/util/buf/CharChunk.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/buf/CharChunk.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -338,6 +338,35 @@
}
}
+ /** Add data to the buffer
+ */
+ public void append(StringBuilder sb) throws IOException {
+ int len = sb.length();
+
+ // will grow, up to limit
+ makeSpace(len);
+
+ // if we don't have limit: makeSpace can grow as it wants
+ if (limit < 0) {
+ // assert: makeSpace made enough space
+ sb.getChars(0, len, buff, end);
+ end += len;
+ return;
+ }
+
+ int off = 0;
+ int sbOff = off;
+ int sbEnd = off + len;
+ while (sbOff < sbEnd) {
+ int d = min(limit - end, sbEnd - sbOff);
+ sb.getChars(sbOff, sbOff + d, buff, end);
+ sbOff += d;
+ end += d;
+ if (end >= limit)
+ flushBuffer();
+ }
+ }
+
/** Append a string to the buffer
*/
public void append(String s) throws IOException {
Modified: trunk/java/org/apache/tomcat/util/buf/UDecoder.java
===================================================================
--- trunk/java/org/apache/tomcat/util/buf/UDecoder.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/buf/UDecoder.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -204,7 +204,7 @@
if( (!query || str.indexOf( '+' ) < 0) && str.indexOf( '%' ) < 0 )
return str;
- StringBuffer dec = new StringBuffer(); // decoded string output
+ StringBuilder dec = new StringBuilder(); // decoded string output
int strPos = 0;
int strLen = str.length();
Modified: trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -536,7 +536,7 @@
}
if (target == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("[CallMethodRule]{");
sb.append(digester.match);
sb.append("} Call target is null (");
@@ -550,7 +550,7 @@
// Invoke the required method on the top object
if (digester.log.isDebugEnabled()) {
- StringBuffer sb = new StringBuffer("[CallMethodRule]{");
+ StringBuilder sb = new StringBuilder("[CallMethodRule]{");
sb.append(digester.match);
sb.append("} Call ");
sb.append(target.getClass().getName());
@@ -606,7 +606,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("CallMethodRule[");
+ StringBuilder sb = new StringBuilder("CallMethodRule[");
sb.append("methodName=");
sb.append(methodName);
sb.append(", paramCount=");
Modified: trunk/java/org/apache/tomcat/util/digester/CallParamRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/CallParamRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/CallParamRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -191,7 +191,7 @@
if (digester.log.isDebugEnabled()) {
- StringBuffer sb = new StringBuffer("[CallParamRule]{");
+ StringBuilder sb = new StringBuilder("[CallParamRule]{");
sb.append(digester.match);
sb.append("} Save from stack; from stack?").append(fromStack);
sb.append("; object=").append(param);
@@ -247,7 +247,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("CallParamRule[");
+ StringBuilder sb = new StringBuilder("CallParamRule[");
sb.append("paramIndex=");
sb.append(paramIndex);
sb.append(", attributeName=");
Modified: trunk/java/org/apache/tomcat/util/digester/Digester.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/Digester.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/Digester.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -143,7 +143,7 @@
/**
* The body text of the current element.
*/
- protected StringBuffer bodyText = new StringBuffer();
+ protected StringBuilder bodyText = new StringBuilder();
/**
@@ -1069,7 +1069,7 @@
}
// Recover the body text from the surrounding element
- bodyText = (StringBuffer) bodyTexts.pop();
+ bodyText = (StringBuilder) bodyTexts.pop();
if (debug) {
log.debug(" Popping body text '" + bodyText.toString() + "'");
}
@@ -1271,7 +1271,7 @@
if (debug) {
log.debug(" Pushing body text '" + bodyText.toString() + "'");
}
- bodyText = new StringBuffer();
+ bodyText = new StringBuilder();
// the actual element name is either in localName or qName, depending
// on whether the parser is namespace aware
@@ -1281,7 +1281,7 @@
}
// Compute the current matching rule
- StringBuffer sb = new StringBuffer(match);
+ StringBuilder sb = new StringBuilder(match);
if (match.length() > 0) {
sb.append('/');
}
@@ -2825,11 +2825,11 @@
/**
- * Return a new StringBuffer containing the same contents as the
+ * Return a new StringBuilder containing the same contents as the
* input buffer, except that data of form ${varname} have been
* replaced by the value of that var as defined in the system property.
*/
- private StringBuffer updateBodyText(StringBuffer bodyText) {
+ private StringBuilder updateBodyText(StringBuilder bodyText) {
String in = bodyText.toString();
String out;
try {
@@ -2843,7 +2843,7 @@
// a new buffer
return bodyText;
} else {
- return new StringBuffer(out);
+ return new StringBuilder(out);
}
}
Modified: trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -444,7 +444,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("FactoryCreateRule[");
+ StringBuilder sb = new StringBuilder("FactoryCreateRule[");
sb.append("className=");
sb.append(className);
sb.append(", attributeName=");
Modified: trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -228,7 +228,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ObjectCreateRule[");
+ StringBuilder sb = new StringBuilder("ObjectCreateRule[");
sb.append("className=");
sb.append(className);
sb.append(", attributeName=");
Modified: trunk/java/org/apache/tomcat/util/digester/ObjectParamRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/ObjectParamRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/ObjectParamRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -112,7 +112,7 @@
* Render a printable version of this Rule.
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ObjectParamRule[");
+ StringBuilder sb = new StringBuilder("ObjectParamRule[");
sb.append("paramIndex=");
sb.append(paramIndex);
sb.append(", attributeName=");
Modified: trunk/java/org/apache/tomcat/util/digester/PathCallParamRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/PathCallParamRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/PathCallParamRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -84,7 +84,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("PathCallParamRule[");
+ StringBuilder sb = new StringBuilder("PathCallParamRule[");
sb.append("paramIndex=");
sb.append(paramIndex);
sb.append("]");
Modified: trunk/java/org/apache/tomcat/util/digester/SetNextRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/SetNextRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/SetNextRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -201,7 +201,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SetNextRule[");
+ StringBuilder sb = new StringBuilder("SetNextRule[");
sb.append("methodName=");
sb.append(methodName);
sb.append(", paramType=");
Modified: trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -258,7 +258,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SetPropertiesRule[");
+ StringBuilder sb = new StringBuilder("SetPropertiesRule[");
sb.append("]");
return (sb.toString());
Modified: trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -141,7 +141,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SetPropertyRule[");
+ StringBuilder sb = new StringBuilder("SetPropertyRule[");
sb.append("name=");
sb.append(name);
sb.append(", value=");
Modified: trunk/java/org/apache/tomcat/util/digester/SetRootRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/SetRootRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/SetRootRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -202,7 +202,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SetRootRule[");
+ StringBuilder sb = new StringBuilder("SetRootRule[");
sb.append("methodName=");
sb.append(methodName);
sb.append(", paramType=");
Modified: trunk/java/org/apache/tomcat/util/digester/SetTopRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/SetTopRule.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/digester/SetTopRule.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -202,7 +202,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("SetTopRule[");
+ StringBuilder sb = new StringBuilder("SetTopRule[");
sb.append("methodName=");
sb.append(methodName);
sb.append(", paramType=");
Modified: trunk/java/org/apache/tomcat/util/http/HttpMessages.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/HttpMessages.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/http/HttpMessages.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -82,7 +82,7 @@
char content[] = new char[message.length()];
message.getChars(0, message.length(), content, 0);
- StringBuffer result = new StringBuffer(content.length + 50);
+ StringBuilder result = new StringBuilder(content.length + 50);
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
case '<':
Modified: trunk/java/org/apache/tomcat/util/http/Parameters.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/Parameters.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/http/Parameters.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -452,7 +452,7 @@
/** Debug purpose
*/
public String paramsAsString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
Enumeration en = getParameterNames();
while (en.hasMoreElements()) {
String k = (String) en.nextElement();
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -776,7 +776,7 @@
*/
public String toString()
{
- StringBuffer sbTemp = new StringBuffer();
+ StringBuilder sbTemp = new StringBuilder();
sbTemp.append("boundary='");
sbTemp.append(String.valueOf(boundary));
sbTemp.append("'\nbufSize=");
Modified: trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -500,7 +500,7 @@
public String getWrappersString( String host, String context ) {
String names[]=getWrapperNames(host, context);
- StringBuffer sb=new StringBuffer();
+ StringBuilder sb=new StringBuilder();
for( int i=0; i<names.length; i++ ) {
sb.append(names[i]).append(":");
}
Modified: trunk/java/org/apache/tomcat/util/modeler/AttributeInfo.java
===================================================================
--- trunk/java/org/apache/tomcat/util/modeler/AttributeInfo.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/modeler/AttributeInfo.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -146,7 +146,7 @@
*/
private String getMethodName(String name, boolean getter, boolean is) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (getter) {
if (is)
sb.append("is");
Modified: trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java
===================================================================
--- trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -460,7 +460,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("ManagedBean[");
+ StringBuilder sb = new StringBuilder("ManagedBean[");
sb.append("name=");
sb.append(name);
sb.append(", className=");
Modified: trunk/java/org/apache/tomcat/util/modeler/NotificationInfo.java
===================================================================
--- trunk/java/org/apache/tomcat/util/modeler/NotificationInfo.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/modeler/NotificationInfo.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -125,7 +125,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("NotificationInfo[");
+ StringBuilder sb = new StringBuilder("NotificationInfo[");
sb.append("name=");
sb.append(name);
sb.append(", description=");
Modified: trunk/java/org/apache/tomcat/util/net/URL.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/URL.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/net/URL.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -534,7 +534,7 @@
*/
public String toExternalForm() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (protocol != null) {
sb.append(protocol);
sb.append(":");
@@ -563,7 +563,7 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("URL[");
+ StringBuilder sb = new StringBuilder("URL[");
sb.append("authority=");
sb.append(authority);
sb.append(", file=");
Modified: trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2009-11-02 22:17:08 UTC (rev 1236)
+++ trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2009-11-03 01:55:48 UTC (rev 1237)
@@ -211,7 +211,7 @@
byte [] ssl_session = session.getId();
if ( ssl_session == null)
return null;
- StringBuffer buf=new StringBuffer("");
+ StringBuilder buf=new StringBuilder("");
for(int x=0; x<ssl_session.length; x++) {
String digit=Integer.toHexString((int)ssl_session[x]);
if (digit.length()<2) buf.append('0');
15 years, 2 months
JBossWeb SVN: r1236 - trunk/java/org/apache/catalina/core.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-02 17:17:08 -0500 (Mon, 02 Nov 2009)
New Revision: 1236
Modified:
trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
Log:
- Port patch: pass cause exception.
Modified: trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-11-02 01:33:52 UTC (rev 1235)
+++ trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-11-02 22:17:08 UTC (rev 1236)
@@ -675,7 +675,7 @@
try{
return invokeMethod(appContext, methodName, params );
} catch (Throwable t){
- throw new RuntimeException(t.getMessage());
+ throw new RuntimeException(t.getMessage(), t);
}
}
@@ -692,7 +692,7 @@
try{
return invokeMethod(context, methodName, params);
}catch(Throwable t){
- throw new RuntimeException(t.getMessage());
+ throw new RuntimeException(t.getMessage(), t);
}
}
15 years, 2 months
JBossWeb SVN: r1235 - in trunk/java: org/apache/catalina/connector and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-11-01 20:33:52 -0500 (Sun, 01 Nov 2009)
New Revision: 1235
Modified:
trunk/java/javax/servlet/http/Cookie.java
trunk/java/javax/servlet/http/LocalStrings.properties
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/apache/jasper/compiler/Validator.java
trunk/java/org/apache/tomcat/util/http/ServerCookie.java
Log:
- Port patches.
- Error for deferred syntax in template text.
- Filter out null in headers.
- Cookie defaults to version switch.
Modified: trunk/java/javax/servlet/http/Cookie.java
===================================================================
--- trunk/java/javax/servlet/http/Cookie.java 2009-10-31 23:31:38 UTC (rev 1234)
+++ trunk/java/javax/servlet/http/Cookie.java 2009-11-02 01:33:52 UTC (rev 1235)
@@ -88,9 +88,8 @@
private String path; // ;Path=VALUE ... URLs that see the cookie
private boolean secure; // ;Secure ... e.g. use SSL
private int version = 0; // ;Version=1 ... means RFC 2109++ style
- private boolean isHttpOnly = false;
+ private boolean httpOnly; // Not in cookie specs, but supported by browsers
-
/**
* Constructs a cookie with a specified name and value.
@@ -124,26 +123,30 @@
*/
public Cookie(String name, String value) {
- if (!isToken(name)
- || name.equalsIgnoreCase("Comment") // rfc2019
- || name.equalsIgnoreCase("Discard") // 2019++
- || name.equalsIgnoreCase("Domain")
- || name.equalsIgnoreCase("Expires") // (old cookies)
- || name.equalsIgnoreCase("Max-Age") // rfc2019
- || name.equalsIgnoreCase("Path")
- || name.equalsIgnoreCase("Secure")
- || name.equalsIgnoreCase("Version")
- || name.startsWith("$")
- ) {
- String errMsg = lStrings.getString("err.cookie_name_is_token");
- Object[] errArgs = new Object[1];
- errArgs[0] = name;
- errMsg = MessageFormat.format(errMsg, errArgs);
- throw new IllegalArgumentException(errMsg);
- }
+ if (name == null || name.length() == 0) {
+ throw new IllegalArgumentException(
+ lStrings.getString("err.cookie_name_blank"));
+ }
+ if (!isToken(name)
+ || name.equalsIgnoreCase("Comment") // rfc2019
+ || name.equalsIgnoreCase("Discard") // 2019++
+ || name.equalsIgnoreCase("Domain")
+ || name.equalsIgnoreCase("Expires") // (old cookies)
+ || name.equalsIgnoreCase("Max-Age") // rfc2019
+ || name.equalsIgnoreCase("Path")
+ || name.equalsIgnoreCase("Secure")
+ || name.equalsIgnoreCase("Version")
+ || name.startsWith("$")
+ ) {
+ String errMsg = lStrings.getString("err.cookie_name_is_token");
+ Object[] errArgs = new Object[1];
+ errArgs[0] = name;
+ errMsg = MessageFormat.format(errMsg, errArgs);
+ throw new IllegalArgumentException(errMsg);
+ }
- this.name = name;
- this.value = value;
+ this.name = name;
+ this.value = value;
}
@@ -595,7 +598,7 @@
* @since Servlet 3.0
*/
public boolean isHttpOnly() {
- return isHttpOnly;
+ return httpOnly;
}
/**
@@ -604,7 +607,7 @@
* @since Servlet 3.0
*/
public void setHttpOnly(boolean httpOnly) {
- this.isHttpOnly = httpOnly;
+ this.httpOnly = httpOnly;
}
}
Modified: trunk/java/javax/servlet/http/LocalStrings.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings.properties 2009-10-31 23:31:38 UTC (rev 1234)
+++ trunk/java/javax/servlet/http/LocalStrings.properties 2009-11-02 01:33:52 UTC (rev 1235)
@@ -56,6 +56,7 @@
# Localized for Locale en_US
err.cookie_name_is_token=Cookie name \"{0}\" is a reserved token
+err.cookie_name_blank=Cookie name may not be null or zero length
err.io.negativelength=Negative length given in write method
err.io.short_read=Short Read
err.ise.getWriter=Illegal to call getWriter() after getOutputStream() has been called
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2009-10-31 23:31:38 UTC (rev 1234)
+++ trunk/java/org/apache/catalina/connector/Response.java 2009-11-02 01:33:52 UTC (rev 1235)
@@ -1040,6 +1040,10 @@
*/
public void addDateHeader(String name, long value) {
+ if (name == null || name.length() == 0) {
+ return;
+ }
+
if (isCommitted())
return;
@@ -1067,6 +1071,10 @@
*/
public void addHeader(String name, String value) {
+ if (name == null || name.length() == 0 || value == null) {
+ return;
+ }
+
if (isCommitted())
return;
@@ -1087,6 +1095,10 @@
*/
public void addIntHeader(String name, int value) {
+ if (name == null || name.length() == 0) {
+ return;
+ }
+
if (isCommitted())
return;
@@ -1312,6 +1324,10 @@
*/
public void setDateHeader(String name, long value) {
+ if (name == null || name.length() == 0) {
+ return;
+ }
+
if (isCommitted())
return;
@@ -1339,6 +1355,10 @@
*/
public void setHeader(String name, String value) {
+ if (name == null || name.length() == 0 || value == null) {
+ return;
+ }
+
if (isCommitted())
return;
@@ -1359,6 +1379,10 @@
*/
public void setIntHeader(String name, int value) {
+ if (name == null || name.length() == 0) {
+ return;
+ }
+
if (isCommitted())
return;
Modified: trunk/java/org/apache/jasper/compiler/Validator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Validator.java 2009-10-31 23:31:38 UTC (rev 1234)
+++ trunk/java/org/apache/jasper/compiler/Validator.java 2009-11-02 01:33:52 UTC (rev 1235)
@@ -738,10 +738,16 @@
int attrSize = attrs.getLength();
Node.JspAttribute[] jspAttrs = new Node.JspAttribute[attrSize];
for (int i = 0; i < attrSize; i++) {
+ // JSP.2.2 - '#{' not allowed in template text
+ String value = attrs.getValue(i);
+ if (!pageInfo.isDeferredSyntaxAllowedAsLiteral()) {
+ if (containsDeferredSyntax(value)) {
+ err.jspError(n, "jsp.error.el.template.deferred");
+ }
+ }
jspAttrs[i] = getJspAttribute(null, attrs.getQName(i),
- attrs.getURI(i), attrs.getLocalName(i), attrs
- .getValue(i), java.lang.Object.class, n,
- false);
+ attrs.getURI(i), attrs.getLocalName(i), value,
+ java.lang.Object.class, n, false);
}
n.setJspAttributes(jspAttrs);
}
@@ -749,6 +755,31 @@
visitBody(n);
}
+ /**
+ * Look for a #{ sequence that isn't preceded by \.
+ */
+ private boolean containsDeferredSyntax(String value) {
+ if (value == null) {
+ return false;
+ }
+
+ int i = 0;
+ int len = value.length();
+ boolean prevCharIsEscape = false;
+ while (i < value.length()) {
+ char c = value.charAt(i);
+ if (c == '#' && (i+1) < len && value.charAt(i+1) == '{' && !prevCharIsEscape) {
+ return true;
+ } else if (c == '\\') {
+ prevCharIsEscape = true;
+ } else {
+ prevCharIsEscape = false;
+ }
+ i++;
+ }
+ return false;
+ }
+
public void visit(Node.CustomTag n) throws JasperException {
TagInfo tagInfo = n.getTagInfo();
Modified: trunk/java/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-10-31 23:31:38 UTC (rev 1234)
+++ trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-11-02 01:33:52 UTC (rev 1235)
@@ -108,7 +108,7 @@
String allowVersionSwitch = System.getProperty(
"org.apache.tomcat.util.http.ServerCookie.ALLOW_VERSION_SWITCH");
if (allowVersionSwitch == null) {
- ALLOW_VERSION_SWITCH = STRICT_SERVLET_COMPLIANCE;
+ ALLOW_VERSION_SWITCH = true;
} else {
ALLOW_VERSION_SWITCH =
Boolean.valueOf(allowVersionSwitch).booleanValue();
15 years, 2 months