Browse Source

New upstream version 9.0.21

tags/upstream/9.0.21^0
Emmanuel Bourg 2 years ago
parent
commit
b799ff58dc
100 changed files with 2076 additions and 775 deletions
  1. +2
    -0
      .gitignore
  2. +4
    -7
      BUILDING.txt
  3. +1
    -1
      bin/catalina.sh
  4. +6
    -6
      build.properties.default
  5. +6
    -39
      build.xml
  6. +5
    -1
      java/javax/servlet/resources/javaee_8.xsd
  7. +17
    -13
      java/javax/servlet/resources/javaee_web_services_1_4.xsd
  8. +31
    -27
      java/javax/servlet/resources/javaee_web_services_client_1_4.xsd
  9. +5
    -1
      java/javax/servlet/resources/web-app_4_0.xsd
  10. +5
    -1
      java/javax/servlet/resources/web-common_4_0.xsd
  11. +5
    -1
      java/javax/servlet/resources/web-fragment_4_0.xsd
  12. +8
    -0
      java/org/apache/catalina/Context.java
  13. +1
    -0
      java/org/apache/catalina/authenticator/LocalStrings_cs.properties
  14. +4
    -2
      java/org/apache/catalina/connector/CoyoteAdapter.java
  15. +1
    -0
      java/org/apache/catalina/connector/LocalStrings.properties
  16. +1
    -0
      java/org/apache/catalina/connector/LocalStrings_cs.properties
  17. +3
    -0
      java/org/apache/catalina/connector/LocalStrings_de.properties
  18. +35
    -15
      java/org/apache/catalina/connector/Request.java
  19. +3
    -6
      java/org/apache/catalina/connector/Response.java
  20. +27
    -9
      java/org/apache/catalina/core/ApplicationHttpRequest.java
  21. +11
    -4
      java/org/apache/catalina/core/ContainerBase.java
  22. +123
    -0
      java/org/apache/catalina/core/FrameworkListener.java
  23. +2
    -0
      java/org/apache/catalina/core/LocalStrings.properties
  24. +3
    -0
      java/org/apache/catalina/core/LocalStrings_de.properties
  25. +13
    -8
      java/org/apache/catalina/core/StandardContext.java
  26. +41
    -40
      java/org/apache/catalina/core/StandardWrapperValve.java
  27. +9
    -83
      java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java
  28. +1
    -0
      java/org/apache/catalina/deploy/LocalStrings_de.properties
  29. +2
    -0
      java/org/apache/catalina/filters/LocalStrings_cs.properties
  30. +16
    -0
      java/org/apache/catalina/ha/authenticator/LocalStrings_de.properties
  31. +1
    -0
      java/org/apache/catalina/ha/deploy/LocalStrings_cs.properties
  32. +1
    -0
      java/org/apache/catalina/ha/deploy/LocalStrings_de.properties
  33. +9
    -0
      java/org/apache/catalina/ha/session/ClusterManagerBase.java
  34. +0
    -1
      java/org/apache/catalina/ha/session/ClusterSessionListener.java
  35. +23
    -23
      java/org/apache/catalina/ha/session/DeltaManager.java
  36. +145
    -57
      java/org/apache/catalina/ha/session/DeltaSession.java
  37. +1
    -0
      java/org/apache/catalina/ha/session/LocalStrings_de.properties
  38. +2
    -1
      java/org/apache/catalina/loader/ParallelWebappClassLoader.java
  39. +12
    -8
      java/org/apache/catalina/loader/WebappClassLoaderBase.java
  40. +3
    -0
      java/org/apache/catalina/manager/LocalStrings_cs.properties
  41. +4
    -2
      java/org/apache/catalina/manager/LocalStrings_de.properties
  42. +1
    -0
      java/org/apache/catalina/manager/host/LocalStrings_de.properties
  43. +1
    -1
      java/org/apache/catalina/realm/JAASCallbackHandler.java
  44. +8
    -0
      java/org/apache/catalina/security/SecurityClassLoad.java
  45. +453
    -24
      java/org/apache/catalina/servlets/DefaultServlet.java
  46. +1
    -0
      java/org/apache/catalina/session/LocalStrings_cs.properties
  47. +1
    -0
      java/org/apache/catalina/session/LocalStrings_de.properties
  48. +5
    -5
      java/org/apache/catalina/session/StandardSession.java
  49. +3
    -0
      java/org/apache/catalina/startup/FailedContext.java
  50. +7
    -1
      java/org/apache/catalina/startup/Tomcat.java
  51. +1
    -1
      java/org/apache/catalina/storeconfig/ConnectorStoreAppender.java
  52. +1
    -1
      java/org/apache/catalina/storeconfig/StoreAppender.java
  53. +2
    -3
      java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
  54. +1
    -0
      java/org/apache/catalina/tribes/tipis/LocalStrings_de.properties
  55. +10
    -5
      java/org/apache/catalina/util/CharsetMapper.java
  56. +20
    -0
      java/org/apache/catalina/util/IOTools.java
  57. +1
    -0
      java/org/apache/catalina/valves/LocalStrings_cs.properties
  58. +2
    -1
      java/org/apache/catalina/valves/LocalStrings_de.properties
  59. +6
    -3
      java/org/apache/catalina/webresources/StandardRoot.java
  60. +32
    -3
      java/org/apache/coyote/AbstractProtocol.java
  61. +1
    -0
      java/org/apache/coyote/LocalStrings.properties
  62. +3
    -0
      java/org/apache/coyote/LocalStrings_de.properties
  63. +1
    -0
      java/org/apache/coyote/LocalStrings_fr.properties
  64. +8
    -1
      java/org/apache/coyote/http11/Http11InputBuffer.java
  65. +6
    -2
      java/org/apache/coyote/http11/Http11NioProtocol.java
  66. +13
    -2
      java/org/apache/coyote/http11/Http11OutputBuffer.java
  67. +4
    -0
      java/org/apache/coyote/http11/upgrade/InternalHttpUpgradeHandler.java
  68. +1
    -1
      java/org/apache/coyote/http2/ConnectionSettingsBase.java
  69. +37
    -33
      java/org/apache/coyote/http2/Http2AsyncParser.java
  70. +3
    -1
      java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
  71. +1
    -1
      java/org/apache/coyote/http2/Http2Protocol.java
  72. +118
    -75
      java/org/apache/coyote/http2/Http2UpgradeHandler.java
  73. +11
    -3
      java/org/apache/coyote/http2/LocalStrings.properties
  74. +5
    -0
      java/org/apache/coyote/http2/LocalStrings_de.properties
  75. +1
    -1
      java/org/apache/coyote/http2/LocalStrings_es.properties
  76. +5
    -3
      java/org/apache/coyote/http2/LocalStrings_fr.properties
  77. +1
    -3
      java/org/apache/coyote/http2/LocalStrings_ja.properties
  78. +1
    -3
      java/org/apache/coyote/http2/LocalStrings_ko.properties
  79. +2
    -0
      java/org/apache/coyote/http2/LocalStrings_zh_CN.properties
  80. +29
    -21
      java/org/apache/coyote/http2/Stream.java
  81. +192
    -0
      java/org/apache/coyote/http2/WindowAllocationManager.java
  82. +12
    -44
      java/org/apache/jasper/compiler/JspUtil.java
  83. +3
    -2
      java/org/apache/jasper/compiler/Localizer.java
  84. +3
    -0
      java/org/apache/jasper/resources/LocalStrings_de.properties
  85. +4
    -1
      java/org/apache/naming/StringManager.java
  86. +35
    -13
      java/org/apache/tomcat/buildutil/CheckEol.java
  87. +50
    -0
      java/org/apache/tomcat/util/compat/GraalCompat.java
  88. +13
    -1
      java/org/apache/tomcat/util/compat/JreCompat.java
  89. +3
    -1
      java/org/apache/tomcat/util/digester/SetPropertiesRule.java
  90. +10
    -0
      java/org/apache/tomcat/util/http/CookieProcessorBase.java
  91. +8
    -1
      java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
  92. +1
    -0
      java/org/apache/tomcat/util/http/LocalStrings.properties
  93. +1
    -0
      java/org/apache/tomcat/util/http/LocalStrings_de.properties
  94. +1
    -0
      java/org/apache/tomcat/util/http/LocalStrings_fr.properties
  95. +7
    -0
      java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
  96. +59
    -0
      java/org/apache/tomcat/util/http/SameSiteCookies.java
  97. +6
    -1
      java/org/apache/tomcat/util/modeler/Registry.java
  98. +62
    -63
      java/org/apache/tomcat/util/net/AbstractEndpoint.java
  99. +205
    -94
      java/org/apache/tomcat/util/net/AprEndpoint.java
  100. +2
    -0
      java/org/apache/tomcat/util/net/LocalStrings_cs.properties

+ 2
- 0
.gitignore View File

@@ -30,6 +30,8 @@ mvn.properties
.settings
.idea
*.iml
*.ipr
*.iws
*.asc
*.jj
*.tmp


+ 4
- 7
BUILDING.txt View File

@@ -523,7 +523,7 @@ target. The command is:
NOTE: FindBugs is licensed under LGPL. Using Findbugs during Tomcat build is
optional and is off by default.

See http://findbugs.sourceforge.net/ for more information.
See https://spotbugs.github.io/ for more information.

To enable FindBugs, add the following property to build.properties file:

@@ -545,15 +545,12 @@ The report file by default is written to
You usually would not need to run this check. You can skip this section.

Apache Tomcat project has convention that all of its textual source files,
stored in Subversion repository, are marked with Subversion property
"svn:eol-style" with value of "native". This convention makes the editing
of source code on different platforms easier.
stored in the Git repository, use Unix style LF line endings.

This test is used by developers to check that the source code adheres to
this convention. It verifies that the ends of lines in textual files are
appropriate for the operating system where it is run. The idea is to run
this check regularly on two different platforms and notify developers when
an inconsistency is detected.
appropriate. The idea is to run this check regularly and notify developers
when an inconsistency is detected.

The command to run this test is:



+ 1
- 1
bin/catalina.sh View File

@@ -228,7 +228,7 @@ fi

# Bugzilla 37848: When no TTY is available, don't output to console
have_tty=0
if [ "`tty`" != "not a tty" ]; then
if [ -t 1 ]; then
have_tty=1
fi



+ 6
- 6
build.properties.default View File

@@ -25,7 +25,7 @@
# ----- Version Control Flags -----
version.major=9
version.minor=0
version.build=20
version.build=21
version.patch=0
version.suffix=

@@ -264,13 +264,13 @@ cobertura.jar=${cobertura.home}/cobertura-${cobertura.version}.jar
cobertura.loc=${base-sf.loc}/cobertura/cobertura-2.1.1-bin.tar.gz

# ----- Findbugs -----
findbugs.version=3.0.1
findbugs.version=3.1.12
findbugs.checksum.enabled=true
findbugs.checksum.algorithm=MD5|SHA-1
findbugs.checksum.value=dec8828de8657910fcb258ce5383c168|59a24064ca6869e483ce9a04d3c50d14a227d5e6
findbugs.home=${base.path}/findbugs-${findbugs.version}
findbugs.jar=${findbugs.home}/lib/findbugs-ant.jar
findbugs.loc=${base-sf.loc}/project/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.tar.gz
findbugs.checksum.value=8c54502a8e1b78ea6b173a186ce6f379|95114d9aaeeba7bd4ea5a3d6a2167cd6c87bb943
findbugs.home=${base.path}/spotbugs-${findbugs.version}
findbugs.jar=${findbugs.home}/lib/spotbugs-ant.jar
findbugs.loc=${base-maven.loc}/com/github/spotbugs/spotbugs/${findbugs.version}/spotbugs-${findbugs.version}.tgz

# ----- SAAJ API, used by Code Signing for releases -----
# ----- No longer part of JRE from Java 11 onwards -----


+ 6
- 39
build.xml View File

@@ -625,7 +625,6 @@
source="${compile.source}"
target="${compile.target}"
release="${compile.release}"
excludes="**/.svn/**"
encoding="ISO-8859-1"
includeAntRuntime="true" >
<!-- Uncomment this to show unchecked warnings:
@@ -638,7 +637,7 @@
classname="org.apache.tomcat.buildutil.CheckEol"
classpath="${tomcat.classes}" />

<checkeol>
<checkeol mode="LF">
<fileset dir="." >
<patternset refid="text.files" />
<include name="**/*.bat"/>
@@ -681,7 +680,6 @@
source="${compile.source}"
target="${compile.target}"
release="${compile.release}"
excludes="**/.svn/**"
encoding="ISO-8859-1"
includeAntRuntime="true" >
<!-- Uncomment this to show unchecked warnings:
@@ -1203,7 +1201,6 @@
target="${compile.target}"
release="${compile.release}"
classpath="${tomcat.classes}"
excludes="**/CVS/**,**/.svn/**"
encoding="ISO-8859-1"
includeantruntime="false">
</javac>
@@ -1216,7 +1213,6 @@
target="${compile.target}"
release="${compile.release}"
classpath="${tomcat.classes}"
excludes="**/CVS/**,**/.svn/**"
encoding="ISO-8859-1"
includeantruntime="false">
</javac>
@@ -1478,42 +1474,13 @@
<property name="junit.formatter.extension" value=".txt" />

<target name="test" description="Runs the JUnit test cases"
depends="test-nio,test-nio2,test-apr,cobertura-report" >
<fileset id="test.result.skippedtests" dir="${test.reports}" includes="*.txt">
<not>
<contains text="Skipped: 0" />
</not>
</fileset>
<fileset id="test.result.failedtests" dir="${test.reports}" includes="*.txt">
<not>
<contains text="Failures: 0, Errors: 0" />
</not>
</fileset>
<concat>
<header>Testsuites with skipped tests:${line.separator}</header>
<string>${toString:test.result.skippedtests}</string>
<filterchain>
<tokenfilter delimOutput="${line.separator}">
<stringtokenizer delims=";"/>
</tokenfilter>
</filterchain>
</concat>
<concat>
<header>Testsuites with failed tests:${line.separator}</header>
<string>${toString:test.result.failedtests}</string>
<filterchain>
<tokenfilter delimOutput="${line.separator}">
<stringtokenizer delims=";"/>
</tokenfilter>
</filterchain>
</concat>

<fail if="test.result.error" message='Some tests completed with an Error. See ${tomcat.build}/logs for details, search for "ERROR".' />
<fail if="test.result.failure" message='Some tests completed with a Failure. See ${tomcat.build}/logs for details, search for "FAILED".' />
</target>
depends="test-nio,test-nio2,test-apr,cobertura-report,test-status" />

<target name="test-only" description="Runs the JUnit test cases without additional processing"
depends="test-only-nio,test-only-nio2,test-only-apr" >
depends="test-only-nio,test-only-nio2,test-only-apr,test-status" />

<target name="test-status"
description="Analyses logs directory and reports on skipped tests, test failures and test errors">
<fileset id="test.result.skippedtests" dir="${test.reports}" includes="*.txt">
<not>
<contains text="Skipped: 0" />


+ 5
- 1
java/javax/servlet/resources/javaee_8.xsd View File

@@ -46,9 +46,13 @@
only if the new code is made subject to such option by the copyright
holder.

</xsd:documentation>
</xsd:annotation>

<xsd:annotation>
<xsd:documentation>
The Apache Software Foundation elects to include this software under the
CDDL license.

</xsd:documentation>
</xsd:annotation>



+ 17
- 13
java/javax/servlet/resources/javaee_web_services_1_4.xsd View File

@@ -47,9 +47,13 @@
only if the new code is made subject to such option by the copyright
holder.

</xsd:documentation>
</xsd:annotation>

<xsd:annotation>
<xsd:documentation>
The Apache Software Foundation elects to include this software under the
CDDL license.

</xsd:documentation>
</xsd:annotation>

@@ -348,7 +352,7 @@
<xsd:annotation>
<xsd:documentation>

To be used with JAX-RPC based runtime only.
To be used with JAX-RPC based runtime only.

</xsd:documentation>
</xsd:annotation>
@@ -360,7 +364,7 @@
<xsd:annotation>
<xsd:documentation>

To be used with JAX-WS based runtime only.
To be used with JAX-WS based runtime only.

</xsd:documentation>
</xsd:annotation>
@@ -489,7 +493,7 @@
<xsd:documentation>

The jaxrpc-mapping-file element contains the name of a file that
describes the JAX-RPC mapping between the Java interaces used by
describes the JAX-RPC mapping between the Java interfaces used by
the application and the WSDL description in the wsdl-file. The
file name is a relative path within the module.

@@ -534,17 +538,17 @@
<xsd:annotation>
<xsd:documentation>
<![CDATA[[
The port-component-name element specifies a port
component's name. This name is assigned by the module
producer to name the service implementation bean in the
module's deployment descriptor. The name must be unique
among the port component names defined in the same module.
The port-component-name element specifies a port
component's name. This name is assigned by the module
producer to name the service implementation bean in the
module's deployment descriptor. The name must be unique
among the port component names defined in the same module.

Used in: port-component
Used in: port-component

Example:
<port-component-name>EmployeeService
</port-component-name>
Example:
<port-component-name>EmployeeService
</port-component-name>





+ 31
- 27
java/javax/servlet/resources/javaee_web_services_client_1_4.xsd View File

@@ -47,9 +47,13 @@
only if the new code is made subject to such option by the copyright
holder.

</xsd:documentation>
</xsd:annotation>

<xsd:annotation>
<xsd:documentation>
The Apache Software Foundation elects to include this software under the
CDDL license.

</xsd:documentation>
</xsd:annotation>

@@ -149,7 +153,7 @@
<xsd:documentation>

The jaxrpc-mapping-file element contains the name of a file that
describes the JAX-RPC mapping between the Java interaces used by
describes the JAX-RPC mapping between the Java interfaces used by
the application and the WSDL description in the wsdl-file. The
file name is a relative path within the module file.

@@ -196,13 +200,13 @@
<xsd:annotation>
<xsd:documentation>

Declares the handler for a port-component. Handlers can
access the init-param name/value pairs using the
HandlerInfo interface. If port-name is not specified, the
handler is assumed to be associated with all ports of the
service.
Declares the handler for a port-component. Handlers can
access the init-param name/value pairs using the
HandlerInfo interface. If port-name is not specified, the
handler is assumed to be associated with all ports of the
service.

To be used with JAX-RPC based runtime only.
To be used with JAX-RPC based runtime only.

</xsd:documentation>
</xsd:annotation>
@@ -214,7 +218,7 @@
<xsd:annotation>
<xsd:documentation>

To be used with JAX-WS based runtime only.
To be used with JAX-WS based runtime only.

</xsd:documentation>
</xsd:annotation>
@@ -484,31 +488,31 @@

Exact Name: service-name-pattern="ns1:EchoService"

In this case, handlers specified in this
handler-chain element will apply to all ports with
this exact service name. The namespace prefix must
have been declared in a namespace declaration
attribute in either the start-tag of the element
where the prefix is used or in an an ancestor
element (i.e. an element in whose content the
prefixed markup occurs)
In this case, handlers specified in this
handler-chain element will apply to all ports with
this exact service name. The namespace prefix must
have been declared in a namespace declaration
attribute in either the start-tag of the element
where the prefix is used or in an an ancestor
element (i.e. an element in whose content the
prefixed markup occurs)


Pattern : service-name-pattern="ns1:EchoService*"

In this case, handlers specified in this
handler-chain element will apply to all ports whose
Service names are like EchoService1, EchoServiceFoo
etc. The namespace prefix must have been declared in
a namespace declaration attribute in either the
start-tag of the element where the prefix is used or
in an an ancestor element (i.e. an element in whose
content the prefixed markup occurs)
In this case, handlers specified in this
handler-chain element will apply to all ports whose
Service names are like EchoService1, EchoServiceFoo
etc. The namespace prefix must have been declared in
a namespace declaration attribute in either the
start-tag of the element where the prefix is used or
in an an ancestor element (i.e. an element in whose
content the prefixed markup occurs)

Wild Card : service-name-pattern="*"

In this case, handlers specified in this handler-chain
element will apply to ports of all service names.
In this case, handlers specified in this handler-chain
element will apply to ports of all service names.

The same can be applied to port-name attribute in
handler-chain element.


+ 5
- 1
java/javax/servlet/resources/web-app_4_0.xsd View File

@@ -47,9 +47,13 @@
only if the new code is made subject to such option by the copyright
holder.

</xsd:documentation>
</xsd:annotation>

<xsd:annotation>
<xsd:documentation>
The Apache Software Foundation elects to include this software under the
CDDL license.

</xsd:documentation>
</xsd:annotation>



+ 5
- 1
java/javax/servlet/resources/web-common_4_0.xsd View File

@@ -47,9 +47,13 @@
only if the new code is made subject to such option by the copyright
holder.

</xsd:documentation>
</xsd:annotation>

<xsd:annotation>
<xsd:documentation>
The Apache Software Foundation elects to include this software under the
CDDL license.

</xsd:documentation>
</xsd:annotation>



+ 5
- 1
java/javax/servlet/resources/web-fragment_4_0.xsd View File

@@ -47,9 +47,13 @@
only if the new code is made subject to such option by the copyright
holder.

</xsd:documentation>
</xsd:annotation>

<xsd:annotation>
<xsd:documentation>
The Apache Software Foundation elects to include this software under the
CDDL license.

</xsd:documentation>
</xsd:annotation>



+ 8
- 0
java/org/apache/catalina/Context.java View File

@@ -930,6 +930,14 @@ public interface Context extends Container, ContextBind {
public void addWrapperListener(String listener);


/**
* Factory method to create and return a new InstanceManager
* instance. This can be used for framework integration or easier
* configuration with custom Context implementations.
* @return the instance manager
*/
public InstanceManager createInstanceManager();

/**
* Factory method to create and return a new Wrapper instance, of
* the Java implementation class appropriate for this Context


+ 1
- 0
java/org/apache/catalina/authenticator/LocalStrings_cs.properties View File

@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

authenticator.formlogin=Neplatná přímá reference na formulář přihlašovací stránky
authenticator.jaspicCleanSubjectFail=Chyba čištění JASPIC předmětu
authenticator.jaspicServerAuthContextFail=Získání instance JASPIC ServerAuthContext selhalo
authenticator.sessionExpired=Časový rámec pro přihlášení byl překročen. Pokud chcete pokrařovat, tak musíte kliknout dvakrát zpět a znovu kliknout na požadovaný link, nebo zavřít a znovu otevřít Váš prohlížeč


+ 4
- 2
java/org/apache/catalina/connector/CoyoteAdapter.java View File

@@ -816,7 +816,7 @@ public class CoyoteAdapter implements Adapter {
if (wrapper != null) {
String[] methods = wrapper.getServletMethods();
if (methods != null) {
for (int i=0; i<methods.length; i++) {
for (int i=0; i < methods.length; i++) {
if ("TRACE".equals(methods[i])) {
continue;
}
@@ -828,7 +828,9 @@ public class CoyoteAdapter implements Adapter {
}
}
}
res.addHeader("Allow", header);
if (header != null) {
res.addHeader("Allow", header);
}
response.sendError(405, "TRACE method is not allowed");
// Safe to skip the remainder of this method.
return true;


+ 1
- 0
java/org/apache/catalina/connector/LocalStrings.properties View File

@@ -80,6 +80,7 @@ inputBuffer.streamClosed=Stream closed
outputBuffer.writeNull=The String argument to write(String,int,int) may not be null

request.asyncNotSupported=A filter or servlet of the current chain does not support asynchronous operations.
request.fragmentInDispatchPath=The fragment in dispatch path [{0}] has been removed
request.illegalWrap=The request wrapper must wrap the request obtained from getRequest()
request.notAsync=It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)



+ 1
- 0
java/org/apache/catalina/connector/LocalStrings_cs.properties View File

@@ -26,5 +26,6 @@ coyoteInputStream.nbNotready=V neblokujícím módu nelze číst ServletInputStr
coyoteRequest.filterAsyncSupportUnknown=Nelze určit, zda některý filtr nepodporuje asynchronní zpracování
coyoteRequest.gssLifetimeFail=Selhalo získání zbývající doby trvání pro uživatele [{0}]
coyoteRequest.noMultipartConfig=Nelze zpracovat částí, neboť multi-part konfigurace nebyla dodána
coyoteRequest.sessionEndAccessFail=Výjimka vyvolala ukončení přístupu k session během recykllování dotazu

responseFacade.nullResponse=Objekt odpovědi byl recyklován a již není asociován s touto fasádou

+ 3
- 0
java/org/apache/catalina/connector/LocalStrings_de.properties View File

@@ -13,12 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

coyoteAdapter.checkRecycled.response=Eine nicht recycelte Antwort wurde erkannt und recylet
coyoteAdapter.debug=Die Variable [{0}] hat den Wert [{1}]
coyoteAdapter.parsePathParam=Das Parsen der Pfadparameter ist schlug mit der Kodierung [{0}] fehl. Die Parameter im Pfad werden ignoriert

coyoteConnector.invalidEncoding=Das Encoding [{0}] wird von der JRE nicht erkannt. Der Konnektor wird weiterhin [{1}] nutzen
coyoteConnector.invalidPort=Der Konnektor kann nicht starten, da der als Port angegebene Wert [{0}] nicht gültig ist.
coyoteConnector.protocolHandlerStartFailed=Der Start des Protokoll-Handlers ist fehlgeschlagen

coyoteRequest.filterAsyncSupportUnknown=Es konnte nicht ermittelt werden ob einer der Filter asyncrone Bearbeitung nicht unterstützt
coyoteRequest.gssLifetimeFail=Die verbleibende Lebenzeit für den Principal [{0}] konnte nicht ermittelt werden.

responseFacade.nullResponse=Das Response Objekt ist wiederverwendet worden und nicht mehr mit der Facade verknüpft.

+ 35
- 15
java/org/apache/catalina/connector/Request.java View File

@@ -1212,13 +1212,31 @@ public class Request implements HttpServletRequest {
(sm.getString("coyoteRequest.getReader.ise"));
}

// InputBuffer has no easily accessible reference chain to the Context
// to check for a default request character encoding at the Context.
// Therefore, if a Context default should be used, it is set explicitly
// here. Need to do this before setting usingReader.
if (coyoteRequest.getCharacterEncoding() == null) {
// Nothing currently set explicitly.
// Check the content
Context context = getContext();
if (context != null) {
String enc = context.getRequestCharacterEncoding();
if (enc != null) {
// Explicitly set the context default so it is visible to
// InputBuffer when creating the Reader.
setCharacterEncoding(enc);
}
}
}

usingReader = true;

inputBuffer.checkConverter();
if (reader == null) {
reader = new CoyoteReader(inputBuffer);
}
return reader;

}


@@ -1353,10 +1371,18 @@ public class Request implements HttpServletRequest {
return null;
}

// If the path is already context-relative, just pass it through
if (path == null) {
return null;
} else if (path.startsWith("/")) {
}

int fragmentPos = path.indexOf('#');
if (fragmentPos > -1) {
log.warn(sm.getString("request.fragmentInDispatchPath", path));
path = path.substring(0, fragmentPos);
}

// If the path is already context-relative, just pass it through
if (path.startsWith("/")) {
return context.getServletContext().getRequestDispatcher(path);
}

@@ -2974,11 +3000,9 @@ public class Request implements HttpServletRequest {
if (!create) {
return null;
}
if (response != null
&& context.getServletContext()
.getEffectiveSessionTrackingModes()
.contains(SessionTrackingMode.COOKIE)
&& response.getResponse().isCommitted()) {
boolean trackModesIncludesCookie =
context.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.COOKIE);
if (trackModesIncludesCookie && response.getResponse().isCommitted()) {
throw new IllegalStateException(
sm.getString("coyoteRequest.sessionCreateCommitted"));
}
@@ -3027,13 +3051,9 @@ public class Request implements HttpServletRequest {
session = manager.createSession(sessionId);

// Creating a new session cookie based on that session
if (session != null
&& context.getServletContext()
.getEffectiveSessionTrackingModes()
.contains(SessionTrackingMode.COOKIE)) {
Cookie cookie =
ApplicationSessionCookieConfig.createSessionCookie(
context, session.getIdInternal(), isSecure());
if (session != null && trackModesIncludesCookie) {
Cookie cookie = ApplicationSessionCookieConfig.createSessionCookie(
context, session.getIdInternal(), isSecure());

response.addSessionCookieInternal(cookie);
}


+ 3
- 6
java/org/apache/catalina/connector/Response.java View File

@@ -34,7 +34,6 @@ import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;
import java.util.function.Supplier;

import javax.servlet.ServletOutputStream;
@@ -867,10 +866,9 @@ public class Response implements HttpServletResponse {

@Override
public Collection<String> getHeaderNames() {

MimeHeaders headers = getCoyoteResponse().getMimeHeaders();
int n = headers.size();
List<String> result = new ArrayList<>(n);
ArrayList<String> result = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
result.add(headers.getName(i).toString());
}
@@ -881,12 +879,11 @@ public class Response implements HttpServletResponse {

@Override
public Collection<String> getHeaders(String name) {

Enumeration<String> enumeration =
getCoyoteResponse().getMimeHeaders().values(name);
Vector<String> result = new Vector<>();
ArrayList<String> result = new ArrayList<>();
while (enumeration.hasMoreElements()) {
result.addElement(enumeration.nextElement());
result.add(enumeration.nextElement());
}
return result;
}


+ 27
- 9
java/org/apache/catalina/core/ApplicationHttpRequest.java View File

@@ -48,9 +48,11 @@ import org.apache.catalina.Session;
import org.apache.catalina.connector.RequestFacade;
import org.apache.catalina.util.ParameterMap;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.URLEncoder;
import org.apache.tomcat.util.buf.B2CConverter;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.Parameters;
import org.apache.tomcat.util.res.StringManager;


/**
@@ -70,9 +72,7 @@ import org.apache.tomcat.util.http.Parameters;
*/
class ApplicationHttpRequest extends HttpServletRequestWrapper {


// ------------------------------------------------------- Static Variables

private static final StringManager sm = StringManager.getManager(ApplicationHttpRequest.class);

/**
* The set of attribute names that are special for request dispatchers.
@@ -321,11 +321,20 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
if (context == null)
return null;

// If the path is already context-relative, just pass it through
if (path == null)
if (path == null) {
return null;
else if (path.startsWith("/"))
}

int fragmentPos = path.indexOf('#');
if (fragmentPos > -1) {
context.getLogger().warn(sm.getString("applicationHttpRequest.fragmentInDispatchPath", path));
path = path.substring(0, fragmentPos);
}

// If the path is already context-relative, just pass it through
if (path.startsWith("/")) {
return context.getServletContext().getRequestDispatcher(path);
}

// Convert a request-relative path to a context-relative one
String servletPath =
@@ -345,10 +354,19 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {

int pos = requestPath.lastIndexOf('/');
String relative = null;
if (pos >= 0) {
relative = requestPath.substring(0, pos + 1) + path;
if (context.getDispatchersUseEncodedPaths()) {
if (pos >= 0) {
relative = URLEncoder.DEFAULT.encode(
requestPath.substring(0, pos + 1), StandardCharsets.UTF_8) + path;
} else {
relative = URLEncoder.DEFAULT.encode(requestPath, StandardCharsets.UTF_8) + path;
}
} else {
relative = requestPath + path;
if (pos >= 0) {
relative = requestPath.substring(0, pos + 1) + path;
} else {
relative = requestPath + path;
}
}

return context.getServletContext().getRequestDispatcher(relative);


+ 11
- 4
java/org/apache/catalina/core/ContainerBase.java View File

@@ -693,8 +693,10 @@ public abstract class ContainerBase extends LifecycleMBeanBase

private void addChildInternal(Container child) {

if( log.isDebugEnabled() )
if (log.isDebugEnabled()) {
log.debug("Add child " + child + " " + this);
}

synchronized(children) {
if (children.get(child.getName()) != null)
throw new IllegalArgumentException(
@@ -703,6 +705,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase
children.put(child.getName(), child);
}

fireContainerEvent(ADD_CHILD_EVENT, child);

// Start child
// Don't do this inside sync block - start can be a slow process and
// locking the children object can cause problems elsewhere
@@ -714,8 +718,6 @@ public abstract class ContainerBase extends LifecycleMBeanBase
}
} catch (LifecycleException e) {
throw new IllegalStateException(sm.getString("containerBase.child.start"), e);
} finally {
fireContainerEvent(ADD_CHILD_EVENT, child);
}
}

@@ -806,24 +808,29 @@ public abstract class ContainerBase extends LifecycleMBeanBase
log.error(sm.getString("containerBase.child.stop"), e);
}

boolean destroy = false;
try {
// child.destroy() may have already been called which would have
// triggered this call. If that is the case, no need to destroy the
// child again.
if (!LifecycleState.DESTROYING.equals(child.getState())) {
child.destroy();
destroy = true;
}
} catch (LifecycleException e) {
log.error(sm.getString("containerBase.child.destroy"), e);
}

if (!destroy) {
fireContainerEvent(REMOVE_CHILD_EVENT, child);
}

synchronized(children) {
if (children.get(child.getName()) == null)
return;
children.remove(child.getName());
}

fireContainerEvent(REMOVE_CHILD_EVENT, child);
}




+ 123
- 0
java/org/apache/catalina/core/FrameworkListener.java View File

@@ -0,0 +1,123 @@
/*
* 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.core;

import java.util.concurrent.ConcurrentHashMap;

import org.apache.catalina.Container;
import org.apache.catalina.ContainerEvent;
import org.apache.catalina.ContainerListener;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
import org.apache.catalina.Service;

/**
* This listener must be declared in server.xml as a Server listener, possibly optional.
* It will register a lifecycle listener on all contexts. This is an alternative to
* adding a Listener in context.xml with more flexibility.
*/
public abstract class FrameworkListener implements LifecycleListener, ContainerListener {

protected final ConcurrentHashMap<Context, LifecycleListener> contextListeners =
new ConcurrentHashMap<>();

/**
* Create a lifecycle listener which will then be added to the specified context.
* @param context the associated Context
* @return the lifecycle listener
*/
protected abstract LifecycleListener createLifecycleListener(Context context);

@Override
public void lifecycleEvent(LifecycleEvent event) {
Lifecycle lifecycle = event.getLifecycle();
if (Lifecycle.BEFORE_START_EVENT.equals(event.getType()) &&
lifecycle instanceof Server) {
Server server = (Server) lifecycle;
registerListenersForServer(server);
}
}

@Override
public void containerEvent(ContainerEvent event) {
String type = event.getType();
if (Container.ADD_CHILD_EVENT.equals(type)) {
processContainerAddChild((Container) event.getData());
} else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
processContainerRemoveChild((Container) event.getData());
}
}

protected void registerListenersForServer(Server server) {
for (Service service : server.findServices()) {
Engine engine = service.getContainer();
if (engine != null) {
engine.addContainerListener(this);
registerListenersForEngine(engine);
}
}
}

protected void registerListenersForEngine(Engine engine) {
for (Container hostContainer : engine.findChildren()) {
Host host = (Host) hostContainer;
host.addContainerListener(this);
registerListenersForHost(host);
}
}

protected void registerListenersForHost(Host host) {
for (Container contextContainer : host.findChildren()) {
Context context = (Context) contextContainer;
registerContextListener(context);
}
}

protected void registerContextListener(Context context) {
LifecycleListener listener = createLifecycleListener(context);
contextListeners.put(context, listener);
context.addLifecycleListener(listener);
}

protected void processContainerAddChild(Container child) {
if (child instanceof Context) {
registerContextListener((Context) child);
} else if (child instanceof Engine) {
registerListenersForEngine((Engine) child);
} else if (child instanceof Host) {
registerListenersForHost((Host) child);
}
}

protected void processContainerRemoveChild(Container child) {
if (child instanceof Context) {
LifecycleListener listener = contextListeners.remove(child);
if (listener != null) {
child.removeLifecycleListener(listener);
}
} else if (child instanceof Host || child instanceof Engine) {
child.removeContainerListener(this);
}
}

}

+ 2
- 0
java/org/apache/catalina/core/LocalStrings.properties View File

@@ -58,6 +58,8 @@ applicationFilterConfig.release=Failed to destroy the filter named [{0}] of type
applicationFilterRegistration.nullInitParam=Unable to set initialisation parameter for filter due to null name and/or value. Name [{0}], Value [{1}]
applicationFilterRegistration.nullInitParams=Unable to set initialisation parameters for filter due to null name and/or value. Name [{0}], Value [{1}]

applicationHttpRequest.fragmentInDispatchPath=The fragment in dispatch path [{0}] has been removed

applicationPushBuilder.methodInvalid=The HTTP method for a push request must be both cacheable and safe but [{0}] is not
applicationPushBuilder.methodNotToken=HTTP methods must be tokens but [{0}] contains a non-token character



+ 3
- 0
java/org/apache/catalina/core/LocalStrings_de.properties View File

@@ -28,6 +28,8 @@ containerBase.backgroundProcess.cluster=Ausnahme beim Abarbeiten des Cluster [{0
containerBase.backgroundProcess.error=Während der Hintergrund Thread abgearbeitet wurde trat eine Exception auf
containerBase.backgroundProcess.unexpectedThreadDeath=Unerwarteter Tod des Hintergrund-Threads [{0}]

defaultInstanceManager.invalidInjection=Ungültige ressource injection Annotation

filterChain.filter=Während der Filter Bearbeitung trat eine Exception auf

jreLeakListener.ldapPoolManagerFail=Konnte die Erzeugung der Klasse com.sun.jndi.ldap.LdapPoolManager während des Starts von Tomcat nicht auslösen. Dies sollte zur Vermeidung von Memory-Leaks dienen. Der Fehlschlag ist ein erwartetes Verhalten bei nicht-Sun JVMs.
@@ -55,3 +57,4 @@ standardHost.nullName=Hostname wird benötigt

standardWrapper.isUnavailable=Das Servlet [{0}] ist zur Zeit nicht verfügbar
standardWrapper.notFound=Servlet [{0}] ist nicht verfügbar
standardWrapper.unloading=Das Servlet [{0}] kann nicht allokiert werden, weil es entladen wurde

+ 13
- 8
java/org/apache/catalina/core/StandardContext.java View File

@@ -5109,14 +5109,7 @@ public class StandardContext extends ContainerBase

if (ok ) {
if (getInstanceManager() == null) {
javax.naming.Context context = null;
if (isUseNaming() && getNamingContextListener() != null) {
context = getNamingContextListener().getEnvContext();
}
Map<String, Map<String, String>> injectionMap = buildInjectionMap(
getIgnoreAnnotations() ? new NamingResourcesImpl(): getNamingResources());
setInstanceManager(new DefaultInstanceManager(context,
injectionMap, this, this.getClass().getClassLoader()));
setInstanceManager(createInstanceManager());
}
getServletContext().setAttribute(
InstanceManager.class.getName(), getInstanceManager());
@@ -5248,6 +5241,18 @@ public class StandardContext extends ContainerBase
}
}

@Override
public InstanceManager createInstanceManager() {
javax.naming.Context context = null;
if (isUseNaming() && getNamingContextListener() != null) {
context = getNamingContextListener().getEnvContext();
}
Map<String, Map<String, String>> injectionMap = buildInjectionMap(
getIgnoreAnnotations() ? new NamingResourcesImpl(): getNamingResources());
return new DefaultInstanceManager(context, injectionMap,
this, this.getClass().getClassLoader());
}

private Map<String, Map<String, String>> buildInjectionMap(NamingResourcesImpl namingResources) {
Map<String, Map<String, String>> injectionMap = new HashMap<>();
for (Injectable resource: namingResources.findLocalEjbs()) {


+ 41
- 40
java/org/apache/catalina/core/StandardWrapperValve.java View File

@@ -29,6 +29,7 @@ import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServletResponse;

import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.LifecycleException;
@@ -174,6 +175,7 @@ final class StandardWrapperValve

// Call the filter chain for this request
// NOTE: This also calls the servlet's service() method
Container container = this.container;
try {
if ((servlet != null) && (filterChain != null)) {
// Swallow output if needed
@@ -253,51 +255,50 @@ final class StandardWrapperValve
context.getName()), e);
throwable = e;
exception(request, response, e);
}

// Release the filter chain (if any) for this request
if (filterChain != null) {
filterChain.release();
}

// Deallocate the allocated servlet instance
try {
if (servlet != null) {
wrapper.deallocate(servlet);
} finally {
// Release the filter chain (if any) for this request
if (filterChain != null) {
filterChain.release();
}
} catch (Throwable e) {
ExceptionUtils.handleThrowable(e);
container.getLogger().error(sm.getString("standardWrapper.deallocateException",
wrapper.getName()), e);
if (throwable == null) {
throwable = e;
exception(request, response, e);
}
}

// If this servlet has been marked permanently unavailable,
// unload it and release this instance
try {
if ((servlet != null) &&
(wrapper.getAvailable() == Long.MAX_VALUE)) {
wrapper.unload();
}
} catch (Throwable e) {
ExceptionUtils.handleThrowable(e);
container.getLogger().error(sm.getString("standardWrapper.unloadException",
wrapper.getName()), e);
if (throwable == null) {
throwable = e;
exception(request, response, e);
// Deallocate the allocated servlet instance
try {
if (servlet != null) {
wrapper.deallocate(servlet);
}
} catch (Throwable e) {
ExceptionUtils.handleThrowable(e);
container.getLogger().error(sm.getString("standardWrapper.deallocateException",
wrapper.getName()), e);
if (throwable == null) {
throwable = e;
exception(request, response, e);
}
}
}
long t2=System.currentTimeMillis();

long time=t2-t1;
processingTime += time;
if( time > maxTime) maxTime=time;
if( time < minTime) minTime=time;
// If this servlet has been marked permanently unavailable,
// unload it and release this instance
try {
if ((servlet != null) &&
(wrapper.getAvailable() == Long.MAX_VALUE)) {
wrapper.unload();
}
} catch (Throwable e) {
ExceptionUtils.handleThrowable(e);
container.getLogger().error(sm.getString("standardWrapper.unloadException",
wrapper.getName()), e);
if (throwable == null) {
throwable = e;
exception(request, response, e);
}
}
long t2=System.currentTimeMillis();

long time=t2-t1;
processingTime += time;
if( time > maxTime) maxTime=time;
if( time < minTime) minTime=time;
}
}




+ 9
- 83
java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java View File

@@ -19,12 +19,9 @@ package org.apache.catalina.core;

import java.util.concurrent.Executor;

import org.apache.catalina.Container;
import org.apache.catalina.ContainerEvent;
import org.apache.catalina.ContainerListener;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
@@ -52,8 +49,7 @@ import org.apache.tomcat.util.threads.ThreadPoolExecutor;
* This listener must be declared in server.xml to be active.
*
*/
public class ThreadLocalLeakPreventionListener implements LifecycleListener,
ContainerListener {
public class ThreadLocalLeakPreventionListener extends FrameworkListener {

private static final Log log =
LogFactory.getLog(ThreadLocalLeakPreventionListener.class);
@@ -73,17 +69,9 @@ public class ThreadLocalLeakPreventionListener implements LifecycleListener,
@Override
public void lifecycleEvent(LifecycleEvent event) {
try {
Lifecycle lifecycle = event.getLifecycle();
if (Lifecycle.AFTER_START_EVENT.equals(event.getType()) &&
lifecycle instanceof Server) {
// when the server starts, we register ourself as listener for
// all context
// as well as container event listener so that we know when new
// Context are deployed
Server server = (Server) lifecycle;
registerListenersForServer(server);
}
super.lifecycleEvent(event);

Lifecycle lifecycle = event.getLifecycle();
if (Lifecycle.BEFORE_STOP_EVENT.equals(event.getType()) &&
lifecycle instanceof Server) {
// Server is shutting down, so thread pools will be shut down so
@@ -107,14 +95,7 @@ public class ThreadLocalLeakPreventionListener implements LifecycleListener,
@Override
public void containerEvent(ContainerEvent event) {
try {
String type = event.getType();
if (Container.ADD_CHILD_EVENT.equals(type)) {
processContainerAddChild(event.getContainer(),
(Container) event.getData());
} else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
processContainerRemoveChild(event.getContainer(),
(Container) event.getData());
}
super.containerEvent(event);
} catch (Exception e) {
String msg =
sm.getString(
@@ -125,66 +106,6 @@ public class ThreadLocalLeakPreventionListener implements LifecycleListener,

}

private void registerListenersForServer(Server server) {
for (Service service : server.findServices()) {
Engine engine = service.getContainer();
if (engine != null) {
engine.addContainerListener(this);
registerListenersForEngine(engine);
}
}

}

private void registerListenersForEngine(Engine engine) {
for (Container hostContainer : engine.findChildren()) {
Host host = (Host) hostContainer;
host.addContainerListener(this);
registerListenersForHost(host);
}
}

private void registerListenersForHost(Host host) {
for (Container contextContainer : host.findChildren()) {
Context context = (Context) contextContainer;
registerContextListener(context);
}
}

private void registerContextListener(Context context) {
context.addLifecycleListener(this);
}

protected void processContainerAddChild(Container parent, Container child) {
if (log.isDebugEnabled())
log.debug("Process addChild[parent=" + parent + ",child=" + child +
"]");

if (child instanceof Context) {
registerContextListener((Context) child);
} else if (child instanceof Engine) {
registerListenersForEngine((Engine) child);
} else if (child instanceof Host) {
registerListenersForHost((Host) child);
}

}

protected void processContainerRemoveChild(Container parent,
Container child) {

if (log.isDebugEnabled())
log.debug("Process removeChild[parent=" + parent + ",child=" +
child + "]");

if (child instanceof Context) {
Context context = (Context) child;
context.removeLifecycleListener(this);
} else if (child instanceof Host || child instanceof Engine) {
child.removeContainerListener(this);
}
}

/**
* Updates each ThreadPoolExecutor with the current time, which is the time
* when a context is being stopped.
@@ -227,4 +148,9 @@ public class ThreadLocalLeakPreventionListener implements LifecycleListener,
}
}
}

@Override
protected LifecycleListener createLifecycleListener(Context context) {
return this;
}
}

+ 1
- 0
java/org/apache/catalina/deploy/LocalStrings_de.properties View File

@@ -14,3 +14,4 @@
# limitations under the License.

namingResources.cleanupCloseSecurity=Kann Methode [{0}] für Ressource [{1}] in Container [{2}] nicht laden. Daher wird diese Ressource nicht aufgeräumt.
namingResources.ejbLookupLink=Die EJB Referenz [{0}] spezifiziert beides, einen ejb-link und einen lookup-name

+ 2
- 0
java/org/apache/catalina/filters/LocalStrings_cs.properties View File

@@ -17,6 +17,8 @@ corsFilter.invalidPreflightMaxAge=Nelze načíst preflightMaxAge

csrfPrevention.invalidRandomClass=Nelze vytvořit zdroj Random pomocí třídy [{0}]

expiresFilter.noExpirationConfigured=\n\
Dotaz [{0}] se statusem odpovědi [{1}] content-type [{2}], bez vypršení nakonfigurován
expiresFilter.noExpirationConfiguredForContentType=Nebyla nalezena konfigurace vypršení pro content-type [{0}]
expiresFilter.startingPointInvalid=Neplatný počáteční bod (access|now|modification|a<seconds>|m<seconds>) [{0}] v předpisu [{1}]
expiresFilter.unsupportedStartingPoint=Nepodporovaný začátek [{0}]


+ 16
- 0
java/org/apache/catalina/ha/authenticator/LocalStrings_de.properties View File

@@ -0,0 +1,16 @@
# 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.

clusterSingleSignOn.clusterLoad.fail=ClusterSingleSignOn Fehler bei clusterLoad

+ 1
- 0
java/org/apache/catalina/ha/deploy/LocalStrings_cs.properties View File

@@ -19,6 +19,7 @@ farmWarDeployer.modInstallFail=Nelze nainstalovat WAR soubor
farmWarDeployer.msgIoe=Nelze přečíst zprávu z farmy pro nasazení WAR.
farmWarDeployer.removeFailRemote=Lokální odstranění z [{0}] selhalo, jiný manager má aplikaci v provozu!
farmWarDeployer.servicingUndeploy=Aplikace [{0}] je provozována anemůže být odebrána ze záložního nódu clusteru
farmWarDeployer.undeployEnd=Odstranění [{0}] ukončeno.

warWatcher.cantListWatchDir=Nelze vypsat soubory v WatchDir [{0}]: překontrolujte, zda jde o adresář a má nastaveny práva pro čtení.
warWatcher.checkingWar=Kontrola WAR souboru [{0}]

+ 1
- 0
java/org/apache/catalina/ha/deploy/LocalStrings_de.properties View File

@@ -21,4 +21,5 @@ farmWarDeployer.undeployEnd=Undeployment von [{0}] beendet.

fileMessageFactory.duplicateMessage=Doppelte Nachricht empfangen. Ist der Timeout für den Sender zu niedrig? Context: [{0}] Dateiname: [{1}] Daten: [{2}] Datenlänge [{3}]

warWatcher.cantListWatchDir=Dateien in WatchDir [{0}] können nicht gelistet werdenm: Prüfen Sie dass Lesezugriff auf das Verzeichnis besteht
warWatcher.checkingWar=WAR-Datei [{0}] wird geprüft.

+ 9
- 0
java/org/apache/catalina/ha/session/ClusterManagerBase.java View File

@@ -32,6 +32,7 @@ import org.apache.catalina.session.ManagerBase;
import org.apache.catalina.tribes.io.ReplicationStream;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.collections.SynchronizedStack;

public abstract class ClusterManagerBase extends ManagerBase implements ClusterManager {

@@ -57,6 +58,14 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
*/
private boolean recordAllActions = false;

private SynchronizedStack<DeltaRequest> deltaRequestPool = new SynchronizedStack<>();


protected SynchronizedStack<DeltaRequest> getDeltaRequestPool() {
return deltaRequestPool;
}


@Override
public CatalinaCluster getCluster() {
return cluster;


+ 0
- 1
java/org/apache/catalina/ha/session/ClusterSessionListener.java View File

@@ -88,7 +88,6 @@ public class ClusterSessionListener extends ClusterListener {
cluster.send(replymsg, msg.getAddress());
}
}

}
}
}


+ 23
- 23
java/org/apache/catalina/ha/session/DeltaManager.java View File

@@ -468,13 +468,17 @@ public class DeltaManager extends ClusterManagerBase{
*/
@Override
public Session createEmptySession() {
return getNewDeltaSession() ;
return new DeltaSession(this);
}

/**
* Get new session class to be used in the doLoad() method.
*
* @return a new session
*
* @deprecated Unused. This will be removed in Tomcat 10.
*/
@Deprecated
protected DeltaSession getNewDeltaSession() {
return new DeltaSession(this);
}
@@ -558,7 +562,12 @@ public class DeltaManager extends ClusterManagerBase{
* @return The request
* @throws ClassNotFoundException Serialization error
* @throws IOException IO error with serialization
*
* @deprecated Unused. This will be removed in Tomcat 10.
* Calling this method may result in a deadlock. See:
* https://bz.apache.org/bugzilla/show_bug.cgi?id=62841
*/
@Deprecated
protected DeltaRequest deserializeDeltaRequest(DeltaSession session, byte[] data)
throws ClassNotFoundException, IOException {
session.lock();
@@ -580,7 +589,12 @@ public class DeltaManager extends ClusterManagerBase{
* @param deltaRequest The request to serialize
* @return serialized delta request
* @throws IOException IO error with serialization
*
* @deprecated Unused. This will be removed in Tomcat 10.
* Calling this method may result in a deadlock. See:
* https://bz.apache.org/bugzilla/show_bug.cgi?id=62841
*/
@Deprecated
protected byte[] serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest)
throws IOException {
session.lock();
@@ -843,7 +857,7 @@ public class DeltaManager extends ClusterManagerBase{
new Date(beforeSendTime), Long.valueOf(reqNow - beforeSendTime)));
} else {
if (log.isInfoEnabled())
log.info(sm.getString("deltaManager.sessionReceived",getName(),
log.info(sm.getString("deltaManager.sessionReceived", getName(),
new Date(beforeSendTime), Long.valueOf(reqNow - beforeSendTime)));
}
}
@@ -949,7 +963,6 @@ public class DeltaManager extends ClusterManagerBase{
* whether this method has been called during session expiration
* @return a SessionMessage to be sent,
*/
@SuppressWarnings("null") // session can't be null when it is used
public ClusterMessage requestCompleted(String sessionId, boolean expires) {
DeltaSession session = null;
SessionMessage msg = null;
@@ -960,24 +973,18 @@ public class DeltaManager extends ClusterManagerBase{
// removed the session from the Manager.
return null;
}
DeltaRequest deltaRequest = session.getDeltaRequest();
session.lock();
if (deltaRequest.getSize() > 0) {
if (session.isDirty()) {
counterSend_EVT_SESSION_DELTA++;
byte[] data = serializeDeltaRequest(session,deltaRequest);
msg = new SessionMessageImpl(getName(),
SessionMessage.EVT_SESSION_DELTA,
data,
session.getDiff(),
sessionId,
sessionId + "-" + System.currentTimeMillis());
session.resetDeltaRequest();
}
} catch (IOException x) {
log.error(sm.getString("deltaManager.createMessage.unableCreateDeltaRequest",
sessionId), x);
return null;
} finally {
if (session!=null) session.unlock();
}
if(msg == null) {
if(!expires && !session.isPrimarySession()) {
@@ -1011,7 +1018,7 @@ public class DeltaManager extends ClusterManagerBase{
sessionId + "-" + System.currentTimeMillis());
if (log.isDebugEnabled()) {
log.debug(sm.getString("deltaManager.createMessage.access",
getName(),sessionId));
getName(), sessionId));
}
}
}
@@ -1098,7 +1105,7 @@ public class DeltaManager extends ClusterManagerBase{
int expireDirect = 0 ;
int expireIndirect = 0 ;

if(log.isDebugEnabled()) {
if (log.isDebugEnabled()) {
log.debug("Start expire all sessions " + getName() + " at " + timeNow +
" sessioncount " + sessions.length);
}
@@ -1116,13 +1123,12 @@ public class DeltaManager extends ClusterManagerBase{
}//end if
}//for
long timeEnd = System.currentTimeMillis();
if(log.isDebugEnabled()) {
if (log.isDebugEnabled()) {
log.debug("End expire sessions " + getName() +
" expire processingTime " + (timeEnd - timeNow) +
" expired direct sessions: " + expireDirect +
" expired direct sessions: " + expireIndirect);
}

}

@Override
@@ -1233,14 +1239,8 @@ public class DeltaManager extends ClusterManagerBase{
log.debug(sm.getString("deltaManager.receiveMessage.delta",
getName(), msg.getSessionID()));
}
session.lock();
try {
DeltaRequest dreq = deserializeDeltaRequest(session, delta);
dreq.execute(session, isNotifyListenersOnReplication());
session.setPrimarySession(false);
} finally {
session.unlock();
}

session.deserializeAndExecuteDeltaRequest(delta);
}
}



+ 145
- 57
java/org/apache/catalina/ha/session/DeltaSession.java View File

@@ -42,9 +42,11 @@ import org.apache.catalina.ha.ClusterMessage;
import org.apache.catalina.ha.ClusterSession;
import org.apache.catalina.session.ManagerBase;
import org.apache.catalina.session.StandardSession;
import org.apache.catalina.tribes.io.ReplicationStream;
import org.apache.catalina.tribes.tipis.ReplicatedMapEntry;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.collections.SynchronizedStack;
import org.apache.tomcat.util.res.StringManager;

/**
@@ -102,7 +104,9 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
*/
public DeltaSession(Manager manager) {
super(manager);
this.resetDeltaRequest();
boolean recordAllActions = manager instanceof ClusterManagerBase &&
((ClusterManagerBase)manager).isRecordAllActions();
deltaRequest = new DeltaRequest(getIdInternal(), recordAllActions);
}

// ----------------------------------------------------- ReplicatedMapEntry
@@ -134,12 +138,31 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
*/
@Override
public byte[] getDiff() throws IOException {
lock();
try {
return getDeltaRequest().serialize();
} finally{
unlock();
SynchronizedStack<DeltaRequest> deltaRequestPool = null;
DeltaRequest newDeltaRequest = null;

if (manager instanceof ClusterManagerBase) {
deltaRequestPool = ((ClusterManagerBase) manager).getDeltaRequestPool();
newDeltaRequest = deltaRequestPool.pop();
if (newDeltaRequest == null) {
newDeltaRequest = new DeltaRequest(null, ((ClusterManagerBase) manager).isRecordAllActions());
}
} else {
newDeltaRequest = new DeltaRequest();
}

DeltaRequest oldDeltaRequest = replaceDeltaRequest(newDeltaRequest);

byte[] result = oldDeltaRequest.serialize();

if (deltaRequestPool != null) {
// Only need to reset the old request if it is going to be pooled.
// Otherwise let GC do its thing.
oldDeltaRequest.reset();
deltaRequestPool.push(oldDeltaRequest);
}

return result;
}

public ClassLoader[] getClassLoaders() {
@@ -161,7 +184,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
*/
@Override
public void applyDiff(byte[] diff, int offset, int length) throws IOException, ClassNotFoundException {
lock();
lockInternal();
try (ObjectInputStream stream = ((ClusterManager) getManager()).getReplicationStream(diff, offset, length)) {
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
try {
@@ -174,12 +197,14 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
Thread.currentThread().setContextClassLoader(contextLoader);
}
} finally {
unlock();
unlockInternal();
}
}

/**
* Resets the current diff state and resets the dirty flag
* {@inheritDoc}
* <p>
* This implementation is a NO-OP. The diff is reset in {@link #getDiff()}.
*/
@Override
public void resetDiff() {
@@ -187,18 +212,38 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
}

/**
* Lock during serialization
* {@inheritDoc}
* <p>
* This implementation is a NO-OP. Any required locking takes place in the
* methods that make modifications.
*/
@Override
public void lock() {
diffLock.lock();
// NO-OP
}

/**
* Unlock after serialization
* {@inheritDoc}
* <p>
* This implementation is a NO-OP. Any required unlocking takes place in the
* methods that make modifications.
*/
@Override
public void unlock() {
// NO-OP
}

/**
* Lock during serialization.
*/
private void lockInternal() {
diffLock.lock();
}

/**
* Unlock after serialization.
*/
private void unlockInternal() {
diffLock.unlock();
}

@@ -292,12 +337,12 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus

public void setMaxInactiveInterval(int interval, boolean addDeltaRequest) {
super.maxInactiveInterval = interval;
if (addDeltaRequest && (deltaRequest != null)) {
lock();
if (addDeltaRequest) {
lockInternal();
try {
deltaRequest.setMaxInactiveInterval(interval);
} finally{
unlock();
} finally {
unlockInternal();
}
}
}
@@ -315,12 +360,12 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus

public void setNew(boolean isNew, boolean addDeltaRequest) {
super.setNew(isNew);
if (addDeltaRequest && (deltaRequest != null)){
lock();
if (addDeltaRequest){
lockInternal();
try {
deltaRequest.setNew(isNew);
} finally{
unlock();
} finally {
unlockInternal();
}
}
}
@@ -340,13 +385,13 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
}

public void setPrincipal(Principal principal, boolean addDeltaRequest) {
lock();
lockInternal();
try {
super.setPrincipal(principal);
if (addDeltaRequest && (deltaRequest != null))
if (addDeltaRequest)
deltaRequest.setPrincipal(principal);
} finally {
unlock();
unlockInternal();
}
}

@@ -362,13 +407,14 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
}

public void setAuthType(String authType, boolean addDeltaRequest) {
lock();
lockInternal();
try {
super.setAuthType(authType);
if (addDeltaRequest && (deltaRequest != null))
if (addDeltaRequest) {
deltaRequest.setAuthType(authType);
}
} finally {
unlock();
unlockInternal();
}
}

@@ -481,12 +527,12 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
*/
@Override
public void recycle() {
lock();
lockInternal();
try {
super.recycle();
deltaRequest.clear();
} finally{
unlock();
} finally {
unlockInternal();
}
}

@@ -509,14 +555,14 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
}

public void addSessionListener(SessionListener listener, boolean addDeltaRequest) {
lock();
lockInternal();
try {
super.addSessionListener(listener);
if (addDeltaRequest && deltaRequest != null && listener instanceof ReplicatedSessionListener) {
if (addDeltaRequest && listener instanceof ReplicatedSessionListener) {
deltaRequest.addSessionListener(listener);
}
} finally {
unlock();
unlockInternal();
}
}

@@ -526,14 +572,14 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
}

public void removeSessionListener(SessionListener listener, boolean addDeltaRequest) {
lock();
lockInternal();
try {
super.removeSessionListener(listener);
if (addDeltaRequest && deltaRequest != null && listener instanceof ReplicatedSessionListener) {
if (addDeltaRequest && listener instanceof ReplicatedSessionListener) {
deltaRequest.removeSessionListener(listener);
}
} finally {
unlock();
unlockInternal();
}
}

@@ -542,11 +588,11 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus

@Override
public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException {
lock();
lockInternal();
try {
readObjectData(in);
} finally{
unlock();
} finally {
unlockInternal();
}
}

@@ -592,27 +638,69 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
}

public void resetDeltaRequest() {
lock();
lockInternal();
try {
if (deltaRequest == null) {
boolean recordAllActions = manager instanceof ClusterManagerBase &&
((ClusterManagerBase)manager).isRecordAllActions();
deltaRequest = new DeltaRequest(getIdInternal(), recordAllActions);
} else {
deltaRequest.reset();
deltaRequest.setSessionId(getIdInternal());
}
deltaRequest.reset();
deltaRequest.setSessionId(getIdInternal());
} finally{
unlock();
unlockInternal();
}
}

public DeltaRequest getDeltaRequest() {
if (deltaRequest == null) resetDeltaRequest();
return deltaRequest;
}

/**
* Replace the existing deltaRequest with the provided replacement.
*
* @param deltaRequest The new deltaRequest. Expected to be either a newly
* created object or an instance that has been reset.
*
* @return The old deltaRequest
*/
DeltaRequest replaceDeltaRequest(DeltaRequest deltaRequest) {
lockInternal();
try {
DeltaRequest oldDeltaRequest = this.deltaRequest;
this.deltaRequest = deltaRequest;
this.deltaRequest.setSessionId(getIdInternal());
return oldDeltaRequest;
} finally {
unlockInternal();
}
}


protected void deserializeAndExecuteDeltaRequest(byte[] delta) throws IOException, ClassNotFoundException {
if (manager instanceof ClusterManagerBase) {
SynchronizedStack<DeltaRequest> deltaRequestPool =
((ClusterManagerBase) manager).getDeltaRequestPool();

DeltaRequest newDeltaRequest = deltaRequestPool.pop();
if (newDeltaRequest == null) {
newDeltaRequest = new DeltaRequest(null, ((ClusterManagerBase) manager).isRecordAllActions());
}

ReplicationStream ois = ((ClusterManagerBase) manager).getReplicationStream(delta);
newDeltaRequest.readExternal(ois);
ois.close();

DeltaRequest oldDeltaRequest = null;
lockInternal();
try {
oldDeltaRequest = replaceDeltaRequest(newDeltaRequest);
newDeltaRequest.execute(this, ((ClusterManagerBase) manager).isNotifyListenersOnReplication());
setPrimarySession(false);
} finally {
unlockInternal();
if (oldDeltaRequest != null) {
oldDeltaRequest.reset();
deltaRequestPool.push(oldDeltaRequest);
}
}
}
}
// ------------------------------------------------- HttpSession Properties

// ----------------------------------------------HttpSession Public Methods
@@ -681,14 +769,14 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
return;
}

lock();
lockInternal();
try {
super.setAttribute(name,value, notify);
if (addDeltaRequest && deltaRequest != null && !exclude(name, value)) {
if (addDeltaRequest && !exclude(name, value)) {
deltaRequest.setAttribute(name, value);
}
} finally {
unlock();
unlockInternal();
}
}

@@ -780,11 +868,11 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus

@Override
public void writeExternal(ObjectOutput out ) throws java.io.IOException {
lock();
lockInternal();
try {
doWriteObject(out);
} finally {
unlock();
unlockInternal();
}
}