Commit 0da256a7 authored by Emmanuel Bourg's avatar Emmanuel Bourg

Imported Upstream version 8.0.32

parent a57552e1
......@@ -352,7 +352,24 @@ For example:
test.entry.methods=testMultiply01,testMultiply02
(7.3) Other configuration options
(7.3) Running a set of tests
It is possible to run a set of JUnit test classes by adding the "test.name"
property to the build.properties file. The property specifies an Ant
includes pattern for the fileset of test class files to run.
The default value is "**/Test*.java", so all test classes are being
executed (with few exceptions - see build.xml for several exclude patterns).
You can include multiple patterns by concatenating them with a comma (",")
as the separator.
For example:
test.name=**/TestSsl.java,**/TestWebSocketFrameClientSSL.java
(7.4) Other configuration options
1. It is possible to configure the directory where JUnit reports are
written to. It is configured by "test.reports" property. The default
......
Apache Tomcat
Copyright 1999-2015 The Apache Software Foundation
Copyright 1999-2016 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
......
......@@ -25,7 +25,7 @@
# ----- Version Control Flags -----
version.major=8
version.minor=0
version.build=30
version.build=32
version.patch=0
version.suffix=
......@@ -159,7 +159,7 @@ jdt.loc.1=http://archive.eclipse.org/eclipse/downloads/drops4/${jdt.release}/ecj
jdt.loc.2=http://download.eclipse.org/eclipse/downloads/drops4/${jdt.release}/ecj-${jdt.version}.jar
# ----- Tomcat native library -----
tomcat-native.version=1.1.33
tomcat-native.version=1.2.4
tomcat-native.home=${base.path}/tomcat-native-${tomcat-native.version}
tomcat-native.tar.gz=${tomcat-native.home}/tomcat-native.tar.gz
tomcat-native.loc.1=${base-tomcat.loc.1}/tomcat-connectors/native/${tomcat-native.version}/source/tomcat-native-${tomcat-native.version}-src.tar.gz
......@@ -168,12 +168,13 @@ tomcat-native.win.1=${base-tomcat.loc.1}/tomcat-connectors/native/${tomcat-nativ
tomcat-native.win.2=${base-tomcat.loc.2}/tomcat-connectors/native/${tomcat-native.version}/binaries/tomcat-native-${tomcat-native.version}-win32-bin.zip
# ----- NSIS, version 2.0 or later -----
nsis.home=${base.path}/nsis-2.46
nsis.version=2.50
nsis.home=${base.path}/nsis-${nsis.version}
nsis.exe=${nsis.home}/makensis.exe
nsis.installoptions.dll=${nsis.home}/Plugins/InstallOptions.dll
nsis.nsexec.dll=${nsis.home}/Plugins/nsExec.dll
nsis.nsisdl.dll=${nsis.home}/Plugins/NSISdl.dll
nsis.loc=${base-sf.loc}/nsis/nsis-2.46.zip
nsis.loc=${base-sf.loc}/nsis/nsis-${nsis.version}.zip
# ----- Commons Daemon, version 1.0-Alpha or later -----
commons-daemon.version=1.0.15
......@@ -221,7 +222,7 @@ objenesis.loc=https://objenesis.googlecode.com/files/objenesis-${objenesis.versi
objenesis.jar=${objenesis.home}/objenesis-${objenesis.version}.jar
# ----- Checkstyle, version 6.0 or later -----
checkstyle.version=6.13
checkstyle.version=6.14.1
checkstyle.home=${base.path}/checkstyle-${checkstyle.version}
checkstyle.loc=${base-sf.loc}/checkstyle/checkstyle/${checkstyle.version}/checkstyle-${checkstyle.version}-all.jar
checkstyle.jar=${checkstyle.home}/checkstyle-${checkstyle.version}-all.jar
......
......@@ -1461,9 +1461,8 @@
if="test.entry.methods"
/>
<batchtest todir="${test.reports}" unless="test.entry">
<fileset dir="test" >
<!-- Include all by default -->
<include name="${test.name}" />
<!-- Include all by default -->
<fileset dir="test" includes="${test.name}">
<!-- Exclude helper classes -->
<exclude name="**/Tester*.java" />
<!-- Exclude the tests known to fail -->
......@@ -1913,9 +1912,6 @@
<!-- 64 bit amd -->
<copy file="${commons-daemon.home}/windows/amd64/prunsrv.exe"
tofile="${tomcat.dist}/bin/x64/tomcat${version.major}.exe" />
<!-- 64 bit ia -->
<copy file="${commons-daemon.home}/windows/ia64/prunsrv.exe"
tofile="${tomcat.dist}/bin/i64/tomcat${version.major}.exe" />
<!-- tc native -->
<copy todir="${tomcat.dist}/bin">
<fileset dir="${tomcat-native.home}/bin">
......@@ -1925,9 +1921,6 @@
</copy>
<!-- platform README files -->
<echo append="false" file="${tomcat.dist}/bin/i64/README">
Apache Tomcat ${version} native binaries for Win64 IA64 platform.
</echo>
<echo append="false" file="${tomcat.dist}/bin/x64/README">
Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
</echo>
......@@ -2368,7 +2361,6 @@ skip.installer property in build.properties" />
<include name="BENCHMARKS.txt"/>
<exclude name="bin/service.bat"/>
<exclude name="bin/x64/"/>
<exclude name="bin/i64/"/>
<exclude name="bin/*.exe"/>
<exclude name="bin/*.dll"/>
</zipfileset>
......@@ -2401,7 +2393,6 @@ skip.installer property in build.properties" />
<include name="RUNNING.txt"/>
<include name="BENCHMARKS.txt"/>
<exclude name="bin/x64/"/>
<exclude name="bin/i64/"/>
</zipfileset>
</zip>
......@@ -2424,7 +2415,6 @@ skip.installer property in build.properties" />
<include name="RUNNING.txt"/>
<include name="BENCHMARKS.txt"/>
<exclude name="bin/x64/"/>
<exclude name="bin/i64/"/>
<exclude name="bin/*.dll"/>
<exclude name="bin/tomcat${version.major}.exe"/>
</zipfileset>
......@@ -2434,36 +2424,6 @@ skip.installer property in build.properties" />
</zipfileset>
</zip>
<hashAndSign file="${tomcat.release}/v${version}/bin/${final.name}-windows-x64.zip" />
<!-- Windows i64 package -->
<zip zipfile="${tomcat.release}/v${version}/bin/${final.name}-windows-i64.zip">
<zipfileset dir="${tomcat.dist}" prefix="${final.name}">
<include name="bin/**"/>
<include name="conf/**"/>
<include name="logs/**"/>
<include name="lib/**"/>
<include name="webapps/**"/>
<include name="work/**"/>
<include name="temp/**"/>
<include name="LICENSE"/>
<include name="NOTICE"/>
<include name="README.txt"/>
<include name="RELEASE-NOTES"/>
<include name="RUNNING.txt"/>
<include name="BENCHMARKS.txt"/>
<exclude name="bin/x64/"/>
<exclude name="bin/i64/"/>
<exclude name="bin/*.dll"/>
<exclude name="bin/tomcat${version.major}.exe"/>
</zipfileset>
<zipfileset dir="${tomcat.dist}/bin/i64" prefix="${final.name}/bin">
<include name="*.dll"/>
<include name="*.exe"/>
</zipfileset>
</zip>
<hashAndSign file="${tomcat.release}/v${version}/bin/${final.name}-windows-i64.zip" />
</target>
<!-- Packages the deployer distribution in zip format -->
......@@ -2547,7 +2507,6 @@ skip.installer property in build.properties" />
<exclude name="conf/**" />
<exclude name="src/**" />
<exclude name="bin/x64/"/>
<exclude name="bin/i64/"/>
<exclude name="bin/*.exe"/>
<exclude name="bin/*.dll"/>
</tarfileset>
......@@ -3048,7 +3007,7 @@ skip.installer property in build.properties" />
<copy file="${tomcat.home}/res/ide-support/eclipse/org.eclipse.jdt.core.prefs.properties" tofile="${tomcat.home}/.settings/org.eclipse.jdt.core.prefs"/>
<echo>Eclipse project files created.
Read the Building page on the Apache Tomcat documentation site for details on how to configure your Eclipse workplace.</echo>
Read the Building page on the Apache Tomcat documentation site for details on how to configure your Eclipse workspace.</echo>
</target>
<!-- ============================ NetBeans =============================== -->
......
......@@ -934,6 +934,7 @@ public interface ServletContext {
*
* @return The primary name of the virtual host on which this context is
* deployed
* @since Servlet 3.1
*/
public String getVirtualServerName();
}
......@@ -800,7 +800,10 @@ public interface Context extends Container, ContextBind {
* Wrapper appended to this Context.
*
* @param listener Java class name of an InstanceListener class
*
* @deprecated Will be removed in 9.0.x onwards
*/
@Deprecated
public void addInstanceListener(String listener);
......@@ -987,7 +990,10 @@ public interface Context extends Container, ContextBind {
/**
* Return the set of InstanceListener classes that will be added to
* newly created Wrappers automatically.
*
* @deprecated Will be removed in 9.0.x onwards
*/
@Deprecated
public String[] findInstanceListeners();
......@@ -1214,7 +1220,10 @@ public interface Context extends Container, ContextBind {
* will be added to newly created Wrappers.
*
* @param listener Class name of an InstanceListener class to be removed
*
* @deprecated Will be removed in 9.0.x onwards
*/
@Deprecated
public void removeInstanceListener(String listener);
......
......@@ -33,7 +33,10 @@ import javax.servlet.ServletResponse;
* as opposed to the Wrapper component that manages it.
*
* @author Craig R. McClanahan
*
* @deprecated Will be removed in 9.0.x onwards
*/
@Deprecated
public final class InstanceEvent extends EventObject {
private static final long serialVersionUID = 1L;
......
......@@ -25,7 +25,10 @@ package org.apache.catalina;
* is managing that instance.
*
* @author Craig R. McClanahan
*
* @deprecated Will be removed in 9.0.x onwards
*/
@Deprecated
public interface InstanceListener {
......
......@@ -35,25 +35,17 @@ package org.apache.catalina;
* | | |auto | | |
* | | \|/ start() \|/ \|/ auto auto stop() |
* | | INITIALIZED --»-- STARTING_PREP --»- STARTING --»- STARTED --»--- |
* | | | | | |
* | | | | | |
* | | | | | |
* | |destroy()| | | |
* | --»-----«-- auto auto | | |
* | | ---------«----- MUST_STOP ---------------------«-- | |
* | | | | |
* | \|/ ---------------------------«-------------------------------- ^
* | | | |
* | | \|/ auto auto start() |
* | | STOPPING_PREP ------»----- STOPPING ------»----- STOPPED ----»------
* | | ^ | | ^
* | | stop() | | | |
* | | -------------------------- | | |
* | | | auto | | |
* | | | MUST_DESTROY------«------- | |
* | | | | | |
* | | | |auto | |
* | | | destroy() \|/ destroy() | |
* | | | | |
* | |destroy()| | |
* | --»-----«-- ------------------------«-------------------------------- ^
* | | | |
* | | \|/ auto auto start() |
* | | STOPPING_PREP ----»---- STOPPING ------»----- STOPPED -----»-----
* | \|/ ^ | ^
* | | stop() | | |
* | | -------------------------- | |
* | | | | |
* | | | destroy() destroy() | |
* | | FAILED ----»------ DESTROYING ---«----------------- |
* | | ^ | |
* | | destroy() | |auto |
......@@ -79,14 +71,6 @@ package org.apache.catalina;
* does not start all its sub-components. When the component is stopped, it will
* try to stop all sub-components - even those it didn't start.
*
* MUST_STOP is used to indicate that the {@link #stop()} should be called on
* the component as soon as {@link #start()} exits. It is typically used when a
* component has failed to start.
*
* MUST_DESTROY is used to indicate that the {@link #destroy()} should be called on
* the component as soon as {@link #stop()} exits. It is typically used when a
* component is not designed to be restarted.
*
* Attempting any other transition will throw {@link LifecycleException}.
*
* </pre>
......@@ -94,9 +78,6 @@ package org.apache.catalina;
* methods that trigger the changed. No {@link LifecycleEvent}s are fired if the
* attempted transition is not valid.
*
* TODO: Not all components may transition from STOPPED to STARTING_PREP. These
* components should use MUST_DESTROY to signal this.
*
* @author Craig R. McClanahan
*/
public interface Lifecycle {
......@@ -325,4 +306,14 @@ public interface Lifecycle {
* @return The name of the current component state.
*/
public String getStateName();
/**
* Marker interface used to indicate that the instance should only be used
* once. Calling {@link #stop()} on an instance that supports this interface
* will automatically call {@link #destroy()} after {@link #stop()}
* completes.
*/
public interface SingleUse {
}
}
......@@ -34,7 +34,23 @@ public enum LifecycleState {
DESTROYING(false, Lifecycle.BEFORE_DESTROY_EVENT),
DESTROYED(false, Lifecycle.AFTER_DESTROY_EVENT),
FAILED(false, null),
/**
* @deprecated Unused. Will be removed in Tomcat 9.0.x. The state transition
* checking in {@link org.apache.catalina.util.LifecycleBase}
* makes it impossible to use this state. The intended behaviour
* can be obtained by setting the state to
* {@link LifecycleState#FAILED} in
* <code>LifecycleBase.startInternal()</code>
*/
@Deprecated
MUST_STOP(true, null),
/**
* @deprecated Unused. Will be removed in Tomcat 9.0.x. The state transition
* checking in {@link org.apache.catalina.util.LifecycleBase}
* makes it impossible to use this state. The intended behaviour
* can be obtained by implementing {@link Lifecycle.SingleUse}.
*/
@Deprecated
MUST_DESTROY(false, null);
private final boolean available;
......
......@@ -25,7 +25,7 @@ import java.io.IOException;
/**
* A <b>Manager</b> manages the pool of Sessions that are associated with a
* particular Container. Different Manager implementations may support
* particular Context. Different Manager implementations may support
* value-added features such as the persistent storage of session data,
* as well as migrating sessions for distributable web applications.
* <p>
......@@ -76,7 +76,11 @@ public interface Manager {
/**
* Set the Container with which this Manager is associated.
* Set the Context with which this Manager is associated. The Context must
* be set to a non-null value before the Manager is first used. Multiple
* calls to this method before first use are permitted. Once the Manager has
* been used, this method may not be used to change the Context (including
* setting a {@code null} value) that the Manager is associated with.
*
* @param context The newly associated Context
*/
......@@ -86,7 +90,11 @@ public interface Manager {
/**
* Return the distributable flag for the sessions supported by
* this Manager.
*
* @deprecated Ignored. {@link Context#getDistributable()} always takes
* precedence. Will be removed in Tomcat 9.0.x.
*/
@Deprecated
public boolean getDistributable();
......@@ -96,14 +104,22 @@ public interface Manager {
* sessions associated with this manager must implement Serializable.
*
* @param distributable The new distributable flag
*
* @deprecated Ignored. {@link Context#getDistributable()} always takes
* precedence. Will be removed in Tomcat 9.0.x.
*/
@Deprecated
public void setDistributable(boolean distributable);
/**
* Return the default maximum inactive interval (in seconds)
* for Sessions created by this Manager.
*
* @deprecated Ignored. {@link Context#getSessionTimeout()} always takes
* precedence. Will be removed in Tomcat 9.0.x.
*/
@Deprecated
public int getMaxInactiveInterval();
......@@ -112,7 +128,11 @@ public interface Manager {
* for Sessions created by this Manager.
*
* @param interval The new default value
*
* @deprecated Ignored. {@link Context#getSessionTimeout()} always takes
* precedence. Will be removed in Tomcat 9.0.x.
*/
@Deprecated
public void setMaxInactiveInterval(int interval);
......@@ -407,4 +427,18 @@ public interface Manager {
*/
public void backgroundProcess();
/**
* Would the Manager distribute the given session attribute? Manager
* implementations may provide additional configuration options to control
* which attributes are distributable.
*
* @param name The attribute name
* @param value The attribute value
*
* @return {@code true} if the Manager would distribute the given attribute
* otherwise {@code false}
*/
public boolean willAttributeDistribute(String name, Object value);
}
......@@ -350,4 +350,23 @@ public interface Session {
boolean notifySessionListeners, boolean notifyContainerListeners);
/**
* Does the session implementation support the distributing of the given
* attribute? If the Manager is marked as distributable, then this method
* must be used to check attributes before adding them to a session and
* an {@link IllegalArgumentException} thrown if the proposed attribute is
* not distributable.
* <p>
* Note that the {@link Manager} implementation may further restrict which
* attributes are distributed but a {@link Manager} level restriction should
* not trigger an {@link IllegalArgumentException} in
* {@link HttpSession#setAttribute(String, Object)}
*
* @param name The attribute name
* @param value The attribute value
*
* @return {@code true} if distribution is supported, otherwise {@code
* false}
*/
public boolean isAttributeDistributable(String name, Object value);
}
......@@ -174,7 +174,10 @@ public interface Wrapper extends Container {
* Add a new listener interested in InstanceEvents.
*
* @param listener The new listener
*
* @deprecated Will be removed in 9.0.x onwards
*/
@Deprecated
public void addInstanceListener(InstanceListener listener);
......@@ -293,7 +296,10 @@ public interface Wrapper extends Container {
* Remove a listener no longer interested in InstanceEvents.
*
* @param listener The listener to remove
*
* @deprecated Will be removed in 9.0.x onwards
*/
@Deprecated
public void removeInstanceListener(InstanceListener listener);
......
......@@ -231,19 +231,23 @@ public abstract class AbstractCatalinaTask extends BaseRedirectorHelperTask {
// Send the request data (if any)
if (istream != null) {
BufferedOutputStream ostream =
new BufferedOutputStream(hconn.getOutputStream(), 1024);
byte buffer[] = new byte[1024];
while (true) {
int n = istream.read(buffer);
if (n < 0) {
break;
try (BufferedOutputStream ostream =
new BufferedOutputStream(hconn.getOutputStream(), 1024);) {
byte buffer[] = new byte[1024];
while (true) {
int n = istream.read(buffer);
if (n < 0) {
break;
}
ostream.write(buffer, 0, n);
}
ostream.flush();
} finally {
try {
istream.close();
} catch (Exception e) {
}
ostream.write(buffer, 0, n);
}
ostream.flush();
ostream.close();
istream.close();
}
// Process the response message
......
......@@ -134,25 +134,33 @@ public class JMXAccessorQueryTask extends JMXAccessorTask {
ObjectName oname = it.next();
pname = resultproperty + "." + Integer.toString(oindex) + ".";
oindex++;
setProperty(pname + "Name", oname.toString());
if (isAttributebinding()) {
bindAttributes(jmxServerConnection, resultproperty, pname, oname);
}
setProperty(pname + "Name", oname.toString());
if (isAttributebinding()) {
bindAttributes(jmxServerConnection, pname, oname);
}
}
}
return isError;
}
/**
* @param jmxServerConnection
* @param resultproperty
* @param pname
* @param oname
*
* @deprecated Unused. Will be removed in Tomcat 9.0.x
*/
protected void bindAttributes(MBeanServerConnection jmxServerConnection, String resultproperty, String pname, ObjectName oname) {
if (jmxServerConnection != null && resultproperty != null
&& pname != null && oname != null ) {
@Deprecated
protected void bindAttributes(MBeanServerConnection jmxServerConnection,
String resultproperty, String pname, ObjectName oname) {
bindAttributes(jmxServerConnection, pname, oname);
}
protected void bindAttributes(MBeanServerConnection jmxServerConnection,
String pname, ObjectName oname) {
if (jmxServerConnection != null && pname != null && oname != null ) {
try {
MBeanInfo minfo = jmxServerConnection.getMBeanInfo(oname);
MBeanAttributeInfo attrs[] = minfo.getAttributes();
......
......@@ -190,11 +190,9 @@ public class JMXAccessorSetTask extends JMXAccessorTask {
String mattrType = null;
MBeanInfo minfo = jmxServerConnection.getMBeanInfo(oname);
MBeanAttributeInfo attrs[] = minfo.getAttributes();
if (attrs != null) {
for (int i = 0; mattrType == null && i < attrs.length; i++) {
if (attribute.equals(attrs[i].getName()))
mattrType = attrs[i].getType();
}
for (int i = 0; mattrType == null && i < attrs.length; i++) {
if (attribute.equals(attrs[i].getName()))
mattrType = attrs[i].getType();
}
return mattrType;
}
......
......@@ -48,9 +48,6 @@ public class SingleSignOnListener implements SessionListener, Serializable {
return;
}
Context context = manager.getContext();
if (context == null) {
return;
}
Authenticator authenticator = context.getAuthenticator();
if (!(authenticator instanceof AuthenticatorBase)) {
return;
......
......@@ -890,7 +890,7 @@ public class Connector extends LifecycleMBeanBase {
sb.append(",port=");
int port = getPort();
if (port > 0) {
sb.append(getPort());
sb.append(port);
} else {
sb.append("auto-");
sb.append(getProperty("nameIndex"));
......@@ -1047,7 +1047,7 @@ public class Connector extends LifecycleMBeanBase {
sb.append('-');
int port = getPort();
if (port > 0) {
sb.append(getPort());
sb.append(port);
} else {
sb.append("auto-");
sb.append(getProperty("nameIndex"));
......
......@@ -418,15 +418,6 @@ public class CoyoteAdapter implements Adapter {
if (!request.isAsync() && !comet) {
request.finishRequest();
response.finishResponse();
if (request.getMappingData().context != null) {
request.getMappingData().context.logAccess(
request, response,
System.currentTimeMillis() - req.getStartTime(),
false);
} else {
// Should normally not happen
log(req, res, System.currentTimeMillis() - req.getStartTime());
}
}
// Check to see if the processor is in an error state. If it is,
......@@ -446,12 +437,21 @@ public class CoyoteAdapter implements Adapter {
} finally {
if (!success) {
res.setStatus(500);
}
// Access logging
if (!success || !request.isAsync() && !comet) {
long time = 0;
if (req.getStartTime() != -1) {
time = System.currentTimeMillis() - req.getStartTime();
}
log(req, res, time);