Commit fbc50eab authored by Emmanuel Bourg's avatar Emmanuel Bourg

Imported Upstream version 8.0.12

parent e5dd1732
......@@ -144,7 +144,7 @@ ${tomcat.source}.
The following properties should be added to the ${tomcat.source}/build.properties
file.
proxy.use=on
proxy.use=true
proxy.host=proxy.domain
proxy.port=8080
proxy.user=username
......
......@@ -45,17 +45,14 @@ Tomcat @VERSION_MAJOR_MINOR@ is designed to run on Java SE 7 and later.
API Stability:
==============
*** This is an alpha release. Currently no guarantees are made regarding API ***
*** stability. ***
The public interfaces for the following classes are fixed and will not be
changed at all during the remaining lifetime of the @VERSION_MAJOR@.x series:
- None
- All classes in the javax namespace
The public interfaces for the following classes may be added to in order to
resolve bugs and/or add new features. No existing interface will be removed or
changed although it may be deprecated.
- None
resolve bugs and/or add new features. No existing interface method will be
removed or changed although it may be deprecated.
- org.apache.catalina.* (excluding sub-packages)
Note: As Tomcat @VERSION_MAJOR@ matures, the above list will be added to. The list is not
considered complete at this time.
......
......@@ -105,9 +105,9 @@ test ".$CATALINA_HOME" = . && CATALINA_HOME=`cd "$DIRNAME/.." >/dev/null; pwd`
test ".$CATALINA_BASE" = . && CATALINA_BASE="$CATALINA_HOME"
test ".$CATALINA_MAIN" = . && CATALINA_MAIN=org.apache.catalina.startup.Bootstrap
# If not explicitly set, look for jsvc in CATALINA_BASE first then CATALINA_HOME
if [ -z $JSVC ]; then
if [ -z "$JSVC" ]; then
JSVC="$CATALINA_BASE/bin/jsvc"
if [ ! -x $JSVC ]; then
if [ ! -x "$JSVC" ]; then
JSVC="$CATALINA_HOME/bin/jsvc"
fi
fi
......
......@@ -71,11 +71,18 @@ rem Set the default -Djava.endorsed.dirs argument
set "JAVA_ENDORSED_DIRS=%CATALINA_HOME%\endorsed"
:gotEndorseddir
rem Don't override _RUNJAVA if the user has set it previously
if not "%_RUNJAVA%" == "" goto gotRunJava
rem Set standard command for invoking Java.
rem Note that NT requires a window name argument when using start.
rem Also note the quoting as JRE_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java.exe"
:gotRunJava
rem Don't override _RUNJDB if the user has set it previously
rem Also note the quoting as JAVA_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java"
set _RUNJDB="%JAVA_HOME%\bin\jdb"
if not "%_RUNJDB%" == "" goto gotRunJdb
set _RUNJDB="%JAVA_HOME%\bin\jdb.exe"
:gotRunJdb
goto end
......
......@@ -83,8 +83,12 @@ if [ -z "$JAVA_ENDORSED_DIRS" ]; then
JAVA_ENDORSED_DIRS="$CATALINA_HOME"/endorsed
fi
# Set standard commands for invoking Java.
_RUNJAVA="$JRE_HOME"/bin/java
if [ "$os400" != "true" ]; then
_RUNJDB="$JAVA_HOME"/bin/jdb
# Set standard commands for invoking Java, if not already set.
if [ -z "$_RUNJAVA" ]; then
_RUNJAVA="$JRE_HOME"/bin/java
fi
if [ "$os400" != "true" ]; then
if [ -z "$_RUNJDB" ]; then
_RUNJDB="$JAVA_HOME"/bin/jdb
fi
fi
\ No newline at end of file
......@@ -25,7 +25,7 @@
# ----- Version Control Flags -----
version.major=8
version.minor=0
version.build=9
version.build=12
version.patch=0
version.suffix=
......@@ -48,6 +48,12 @@ test.cobertura=false
# Location of GPG executable (used only for releases)
gpg.exec=/path/to/gpg
# Code signing of Windows installer
do.codesigning=false
codesigning.user=request-via-pmc
codesigning.pwd=request-via-pmc
codesigning.partnercode=request-via-pmc
# ----- Settings to use when downloading files -----
trydownload.httpusecaches=true
......@@ -128,15 +134,15 @@ wsdl4j-lib.home=${base.path}/wsdl4j-${wsdl4j-lib.version}
wsdl4j-lib.loc=${base-maven.loc}/wsdl4j/wsdl4j/${wsdl4j-lib.version}/wsdl4j-${wsdl4j-lib.version}.jar
wsdl4j-lib.jar=${wsdl4j-lib.home}/wsdl4j-${wsdl4j-lib.version}.jar
# ----- Eclipse JDT, version 4.4RC4 or later -----#
jdt.version=4.4RC4
jdt.release=S-4.4RC4-201406061215
# ----- Eclipse JDT, version 4.4 or later -----#
# See https://wiki.apache.org/tomcat/JDTCoreBatchCompiler before updating
jdt.version=4.4
jdt.release=R-4.4-201406061215
jdt.home=${base.path}/ecj-${jdt.version}
jdt.jar=${jdt.home}/ecj-${jdt.version}.jar
# The download will be moved to the archive area eventually. We are taking care of that in advance.
jdt.loc.1=http://archive.eclipse.org/eclipse/downloads/drops4/${jdt.release}/ecj-${jdt.version}.jar
jdt.loc.2=http://download.eclipse.org/eclipse/downloads/drops4/${jdt.release}/ecj-${jdt.version}.jar
# ---- NPN support
npn.version=8.1.2.v20120308
npn.home=${base.path}/npn-${npn.version}
......@@ -144,9 +150,11 @@ npn.jar=${npn.home}/npn-${npn.version}.jar
npn.loc=http://repo1.maven.org/maven2/org/eclipse/jetty/npn/npn-api/${npn.version}/npn-api-${npn.version}.jar
# ----- Tomcat native library -----
tomcat-native.version=1.1.30
tomcat-native.version=1.1.31
tomcat-native.home=${base.path}/tomcat-native-${tomcat-native.version}
tomcat-native.tar.gz=${tomcat-native.home}/tomcat-native.tar.gz
# Required due to packaging error in 1.1.31 - remove once fixed
tomcat-native.win.path=tomcat-native-${tomcat-native.version}-win32-bin
tomcat-native.loc.1=${base-tomcat.loc.1}/tomcat-connectors/native/${tomcat-native.version}/source/tomcat-native-${tomcat-native.version}-src.tar.gz
tomcat-native.loc.2=${base-tomcat.loc.2}/tomcat-connectors/native/${tomcat-native.version}/source/tomcat-native-${tomcat-native.version}-src.tar.gz
tomcat-native.win.1=${base-tomcat.loc.1}/tomcat-connectors/native/${tomcat-native.version}/binaries/tomcat-native-${tomcat-native.version}-win32-bin.zip
......@@ -206,9 +214,9 @@ objenesis.loc=https://objenesis.googlecode.com/files/objenesis-${objenesis.versi
objenesis.jar=${objenesis.home}/objenesis-${objenesis.version}.jar
# ----- Checkstyle, version 5.1 or later -----
checkstyle.version=5.6
checkstyle.version=5.7
checkstyle.home=${base.path}/checkstyle-${checkstyle.version}
checkstyle.loc=${base-sf.loc}/checkstyle/checkstyle-${checkstyle.version}-bin.zip
checkstyle.loc=${base-sf.loc}/checkstyle/checkstyle/${checkstyle.version}/checkstyle-${checkstyle.version}-bin.zip
checkstyle.jar=${checkstyle.home}/checkstyle-${checkstyle.version}-all.jar
# ----- JSON Libraries (for bayeux module) -----
......
......@@ -179,6 +179,9 @@
<available file="/dev/urandom" property="test.jvmarg.egd" value="-Djava.security.egd=file:/dev/./urandom"/>
<property name="test.jvmarg.egd" value="" />
<!-- Location of OpenSSL binary -->
<property name="test.openssl.path" value="" />
<!-- Include .gitignore in src distributions. -->
<!-- .git and .gitignore are in defaultexcludes since Ant 1.8.2 -->
<defaultexcludes add="**/.git" />
......@@ -1044,10 +1047,19 @@
<filterset refid="version.filters"/>
</copy>
<!-- Delete all other versions of Eclipse JDT Compiler and copy the current one -->
<local name="jdt.jar.filename" />
<basename property="jdt.jar.filename" file="${jdt.jar}"/>
<delete verbose="true">
<fileset dir="${tomcat.build}/lib">
<include name="ecj-*.jar"/>
<exclude name="${jdt.jar.filename}"/>
</fileset>
</delete>
<copy file="${jdt.jar}" todir="${tomcat.build}/lib"/>
<!-- Add sources for examples -->
<antcall target="examples-sources" />
<copy file="${jdt.jar}" todir="${tomcat.build}/lib" />
</target>
<target name="compile-webapp-examples" >
......@@ -1327,25 +1339,25 @@
</target>
<target name="test-bio" description="Runs the JUnit test cases for BIO. Does not stop on errors."
depends="test-compile,deploy,cobertura-instrument" if="${execute.test.bio}">
depends="test-compile,deploy,cobertura-instrument,test-openssl-exists" if="${execute.test.bio}">
<runtests protocol="org.apache.coyote.http11.Http11Protocol"
extension=".BIO" />
</target>
<target name="test-nio" description="Runs the JUnit test cases for NIO. Does not stop on errors."
depends="test-compile,deploy,cobertura-instrument" if="${execute.test.nio}">
depends="test-compile,deploy,cobertura-instrument,test-openssl-exists" if="${execute.test.nio}">
<runtests protocol="org.apache.coyote.http11.Http11NioProtocol"
extension=".NIO" />
</target>
<target name="test-nio2" description="Runs the JUnit test cases for NIO2. Does not stop on errors."
depends="test-compile,deploy,cobertura-instrument" if="${execute.test.nio2}">
depends="test-compile,deploy,cobertura-instrument,test-openssl-exists" if="${execute.test.nio2}">
<runtests protocol="org.apache.coyote.http11.Http11Nio2Protocol"
extension=".NIO2" />
</target>
<target name="test-apr" description="Runs the JUnit test cases for APR. Does not stop on errors."
depends="test-compile,deploy,test-apr-exists,cobertura-instrument"
depends="test-compile,deploy,test-apr-exists,cobertura-instrument,test-openssl-exists"
if="${apr.exists}">
<runtests protocol="org.apache.coyote.http11.Http11AprProtocol"
extension=".APR" />
......@@ -1356,6 +1368,22 @@
<available file="${test.apr.loc}" property="apr.exists" />
</target>
<target name="test-openssl-exists" description="Checks for the OpenSSL binary">
<property environment="env" />
<condition property="test.openssl.exists">
<or>
<and>
<length string="${test.openssl.path}" trim="true" length="0" when="gt"/>
<available file="${test.openssl.path}" property="test.openssl.exists"/>
</and>
<and>
<length string="${test.openssl.path}" trim="true" length="0" when="eq"/>
<available file="openssl" filepath="${env.PATH}" property="test.openssl.exists"/>
</and>
</or>
</condition>
</target>
<macrodef name="runtests"
description="Runs the unit tests using the specified connector.
Does not stop on errors, but sets 'test.result.error' and 'test.result.failure' properties.">
......@@ -1384,6 +1412,7 @@
<sysproperty key="tomcat.test.protocol" value="@{protocol}" />
<sysproperty key="tomcat.test.accesslog" value="${test.accesslog}" />
<sysproperty key="tomcat.test.reports" value="${test.reports}" />
<sysproperty key="tomcat.test.openssl.path" value="${test.openssl.path}" />
<!-- File for Cobertura to write coverage results to -->
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.datafile}" />
......@@ -1406,6 +1435,8 @@
<exclude name="**/Tester*.java" />
<!-- Exclude the tests known to fail -->
<exclude name="org/apache/catalina/tribes/test/**" />
<!-- Exclude the OpenSSL tests unless OpenSSL is available -->
<exclude name="org/apache/tomcat/util/net/jsse/openssl/**" unless="${test.openssl.exists}"/>
</fileset>
</batchtest>
</junit>
......@@ -1812,7 +1843,7 @@
tofile="${tomcat.dist}/bin/i64/tomcat${version.major}.exe" />
<!-- tc native -->
<copy todir="${tomcat.dist}/bin">
<fileset dir="${tomcat-native.home}/bin">
<fileset dir="${tomcat-native.home}/${tomcat-native.win.path}/bin">
<include name="*.dll"/>
<include name="**/*.dll"/>
</fileset>
......@@ -2088,8 +2119,26 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
</antcall>
</target>
<target name="sign-windows-binaries" depends="installer" if="${do.codesigning}" >
<taskdef name="signcode"
classname="org.apache.tomcat.buildutil.SignCode"
classpath="${tomcat.classes}" />
<signcode userName="${codesigning.user}" password="${codesigning.pwd}"
partnerCode="${codesigning.partnercode}"
applicationName="Apache Tomcat ${version.major.minor}"
applicationversion="${version}"
signingService="Microsoft Signing">
<fileset dir="${tomcat.release}">
<filename name="v${version}/bin/${final.name}.exe"/>
</fileset>
</signcode>
</target>
<target name="release"
depends="clean,release-init,dist-deployer,installer,package-zip,package-winzip,package-tgz,package-deployer-zip,package-deployer-tgz,javadoc,package-docs-tgz,package-src-zip,package-src-tgz,package-src-jar"
depends="clean,release-init,dist-deployer,sign-windows-binaries,package-zip,package-winzip,package-tgz,package-deployer-zip,package-deployer-tgz,javadoc,package-docs-tgz,package-src-zip,package-src-tgz,package-src-jar"
description="Create a Tomcat packaged distribution">
<copy file="KEYS"
......@@ -2711,7 +2760,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
<antcall target="downloadzip-2">
<param name="sourcefile.1" value="${tomcat-native.win.1}"/>
<param name="sourcefile.2" value="${tomcat-native.win.2}"/>
<param name="destfile" value="${tomcat-native.home}/LICENSE"/>
<param name="destfile" value="${tomcat-native.home}/${tomcat-native.win.path}/LICENSE"/>
<param name="destdir" value="${tomcat-native.home}"/>
</antcall>
......@@ -2732,14 +2781,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
<!-- =============== Utility Targets to support downloads ================ -->
<target name="proxyflags">
<!-- check proxy parameters. -->
<condition property="useproxy">
<equals arg1="${proxy.use}" arg2="on" />
</condition>
</target>
<target name="setproxy" depends="proxyflags" if="useproxy">
<target name="setproxy" if="${proxy.use}">
<taskdef name="setproxy"
classname="org.apache.tools.ant.taskdefs.optional.net.SetProxy" />
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
......@@ -2752,7 +2794,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
<available file="${destfile}" property="exist"/>
</target>
<target name="downloadgz" unless="exist" depends="setproxy,testexist">
<target name="downloadgz" unless="exist" depends="testexist,setproxy">
<!-- Download and extract the package -->
<get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${base.path}/file.tar.gz" />
<gunzip src="${base.path}/file.tar.gz" dest="${base.path}/file.tar"/>
......@@ -2779,7 +2821,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
<delete file="${base.path}/file.tar.gz"/>
</target>
<target name="downloadzip" unless="exist" depends="setproxy,testexist">
<target name="downloadzip" unless="exist" depends="testexist,setproxy">
<!-- Download and extract the package -->
<get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${base.path}/file.zip" />
<mkdir dir="${destdir}" />
......@@ -2803,7 +2845,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
<delete file="${base.path}/file.zip"/>
</target>
<target name="downloadfile" unless="exist" depends="setproxy,testexist">
<target name="downloadfile" unless="exist" depends="testexist,setproxy">
<!-- Download extract the file -->
<mkdir dir="${destdir}" />
<get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${destfile}" />
......
......@@ -134,7 +134,17 @@ public class ELProcessor {
if (types.length == typeNames.length) {
boolean match = true;
for (int i = 0; i < types.length; i++) {
if (!types[i].getName().equals(typeNames[i])) {
if (i == types.length -1 && method.isVarArgs()) {
String typeName = typeNames[i];
if (typeName.endsWith("...")) {
typeName = typeName.substring(0, typeName.length() - 3);
if (!typeName.equals(types[i].getName())) {
match = false;
}
} else {
match = false;
}
} else if (!types[i].getName().equals(typeNames[i])) {
match = false;
break;
}
......@@ -235,7 +245,58 @@ public class ELProcessor {
ImportHandler importHandler = context.getImportHandler();
for (int i = 0; i < parameterTypeNames.length; i++) {
String parameterTypeName = parameterTypeNames[i].trim();
if (!PRIMITIVES.contains(parameterTypeName) &&
int dimension = 0;
int bracketPos = parameterTypeName.indexOf('[');
if (bracketPos > -1) {
String parameterTypeNameOnly =
parameterTypeName.substring(0, bracketPos).trim();
while (bracketPos > -1) {
dimension++;
bracketPos = parameterTypeName.indexOf('[', bracketPos+ 1);
}
parameterTypeName = parameterTypeNameOnly;
}
boolean varArgs = false;
if (parameterTypeName.endsWith("...")) {
varArgs = true;
dimension = 1;
parameterTypeName = parameterTypeName.substring(
0, parameterTypeName.length() -3).trim();
}
boolean isPrimitive = PRIMITIVES.contains(parameterTypeName);
if (isPrimitive && dimension > 0) {
// When in an array, class name changes for primitive
switch(parameterTypeName)
{
case "boolean":
parameterTypeName = "Z";
break;
case "byte":
parameterTypeName = "B";
break;
case "char":
parameterTypeName = "C";
break;
case "double":
parameterTypeName = "D";
break;
case "float":
parameterTypeName = "F";
break;
case "int":
parameterTypeName = "I";
break;
case "long":
parameterTypeName = "J";
break;
case "short":
parameterTypeName = "S";
break;
default:
// Should never happen
break;
}
} else if (!isPrimitive &&
!parameterTypeName.contains(".")) {
Class<?> clazz = importHandler.resolveClass(
parameterTypeName);
......@@ -246,8 +307,27 @@ public class ELProcessor {
parameterTypeNames[i], methodName,
className));
}
parameterTypeNames[i] = clazz.getName();
parameterTypeName = clazz.getName();
}
if (dimension > 0) {
// Convert to array form of class name
StringBuilder sb = new StringBuilder();
for (int j = 0; j < dimension; j++) {
sb.append('[');
}
if (!isPrimitive) {
sb.append('L');
}
sb.append(parameterTypeName);
if (!isPrimitive) {
sb.append(';');
}
parameterTypeName = sb.toString();
}
if (varArgs) {
parameterTypeName += "...";
}
parameterTypeNames[i] = parameterTypeName;
}
}
}
......
......@@ -310,12 +310,13 @@ class Util {
return w;
}
candidates.put(w, new MatchResult(exactMatch, assignableMatch, coercibleMatch));
candidates.put(w, new MatchResult(
exactMatch, assignableMatch, coercibleMatch, w.isBridge()));
}
// Look for the method that has the highest number of parameters where
// the type matches exactly
MatchResult bestMatch = new MatchResult(0, 0, 0);
MatchResult bestMatch = new MatchResult(0, 0, 0, false);
Wrapper match = null;
boolean multiple = false;
for (Map.Entry<Wrapper, MatchResult> entry : candidates.entrySet()) {
......@@ -662,6 +663,7 @@ class Util {
public abstract Object unWrap();
public abstract Class<?>[] getParameterTypes();
public abstract boolean isVarArgs();
public abstract boolean isBridge();
}
......@@ -686,6 +688,11 @@ class Util {
public boolean isVarArgs() {
return m.isVarArgs();
}
@Override
public boolean isBridge() {
return m.isBridge();
}
}
private static class ConstructorWrapper extends Wrapper {
......@@ -709,6 +716,11 @@ class Util {
public boolean isVarArgs() {
return c.isVarArgs();
}
@Override
public boolean isBridge() {
return false;
}
}
/*
......@@ -720,11 +732,13 @@ class Util {
private final int exact;
private final int assignable;
private final int coercible;
private final boolean bridge;
public MatchResult(int exact, int assignable, int coercible) {
public MatchResult(int exact, int assignable, int coercible, boolean bridge) {
this.exact = exact;
this.assignable = assignable;
this.coercible = coercible;
this.bridge = bridge;
}
public int getExact() {
......@@ -739,6 +753,10 @@ class Util {
return coercible;
}
public boolean isBridge() {
return bridge;
}
@Override
public int compareTo(MatchResult o) {
int cmp = Integer.compare(this.getExact(), o.getExact());
......@@ -746,6 +764,13 @@ class Util {
cmp = Integer.compare(this.getAssignable(), o.getAssignable());
if (cmp == 0) {
cmp = Integer.compare(this.getCoercible(), o.getCoercible());
if (cmp == 0) {
// The nature of bridge methods is such that it actually
// doesn't matter which one we pick as long as we pick
// one. That said, pick the 'right' one (the non-bridge
// one) anyway.
cmp = Boolean.compare(o.isBridge(), this.isBridge());
}
}
}
return cmp;
......
......@@ -352,7 +352,7 @@ public class Cookie implements Cloneable, Serializable {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e.getMessage());
throw new RuntimeException(e);
}
}
......
......@@ -116,12 +116,30 @@ public interface Manager {
public void setMaxInactiveInterval(int interval);
/**
* return the session id generator
*/
public SessionIdGenerator getSessionIdGenerator();
/**
* Sets the session id generator
*
* @param sessionIdGenerator The session id generator
*/
public void setSessionIdGenerator(SessionIdGenerator sessionIdGenerator);
/**
* Gets the session id length (in bytes) of Sessions created by
* this Manager.
*
* @deprecated Use {@link SessionIdGenerator#getSessionIdLength()}.
* This method will be removed in Tomcat 9 onwards.
*
* @return The session id length
*/
@Deprecated
public int getSessionIdLength();
......@@ -129,8 +147,12 @@ public interface Manager {
* Sets the session id length (in bytes) for Sessions created by this
* Manager.
*
* @deprecated Use {@link SessionIdGenerator#setSessionIdLength(int)}.
* This method will be removed in Tomcat 9 onwards.
*
* @param idLength The session id length
*/
@Deprecated
public void setSessionIdLength(int idLength);
......
/*
* 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.
*/
package org.apache.catalina;
public interface SessionIdGenerator {
/**
* Return the node identifier associated with this node which will be
* included in the generated session ID.
*/
public String getJvmRoute();
/**
* Specify the node identifier associated with this node which will be
* included in the generated session ID.
*
* @param jvmRoute The node identifier
*/
public void setJvmRoute(String jvmRoute);
/**
* Return the number of bytes for a session ID
*/
public int getSessionIdLength();
/**
* Specify the number of bytes for a session ID
*
* @param sessionIdLength Number of bytes
*/
public void setSessionIdLength(int sessionIdLength);
/**
* Generate and return a new session identifier.
*/
public String generateSessionId();
/**
* Generate and return a new session identifier.
*
* @param route node identifier to include in generated id
*/
public String generateSessionId(String route);