[tomcat] branch 8.5.x updated: Align with master. i18n for AccessLog related messages

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 5e1b68c  Align with master. i18n for AccessLog related messages
5e1b68c is described below

commit 5e1b68cac9d6ad953d97846b9af84eb6e372ab82
Author: Mark Thomas 
AuthorDate: Tue Jul 30 22:51:02 2019 +0100

Align with master. i18n for AccessLog related messages
---
 .../catalina/valves/ExtendedAccessLogValve.java| 30 ++
 .../apache/catalina/valves/LocalStrings.properties |  7 +
 .../catalina/valves/LocalStrings_es.properties |  4 ++-
 .../catalina/valves/LocalStrings_fr.properties | 22 
 .../catalina/valves/LocalStrings_ja.properties | 20 +++
 5 files changed, 65 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 
b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 43f5fa7..fab3dd6 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -544,7 +544,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
 tokenizer.getWhiteSpaces();
 
 if (tokenizer.isEnded()) {
-log.info("pattern was just empty or whitespace");
+log.info(sm.getString("extendedAccessLogValve.emptyPattern"));
 return null;
 }
 
@@ -572,7 +572,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
 }
 return list.toArray(new AccessLogElement[0]);
 } catch (IOException e) {
-log.error("parse error", e);
+log.error(sm.getString("extendedAccessLogValve.patternParseError", 
pattern), e);
 return null;
 }
 }
@@ -630,7 +630,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
 } else if ("x".equals(token)) {
 return getXParameterElement(tokenizer);
 }
-log.error("unable to decode with rest of chars starting: " + token);
+log.error(sm.getString("extendedAccessLogValve.decodeError", token));
 return null;
 }
 
@@ -680,13 +680,12 @@ public class ExtendedAccessLogValve extends 
AccessLogValve {
 } else if (tokenizer.hasParameter()) {
 String parameter = tokenizer.getParameter();
 if (parameter == null) {
-log.error("No closing ) found for in decode");
+log.error(sm.getString("extendedAccessLogValve.noClosing"));
 return null;
 }
 return new RequestHeaderElement(parameter);
 }
-log.error("The next characters couldn't be decoded: "
-+ tokenizer.getRemains());
+log.error(sm.getString("extendedAccessLogValve.decodeError", 
tokenizer.getRemains()));
 return null;
 }
 
@@ -702,13 +701,12 @@ public class ExtendedAccessLogValve extends 
AccessLogValve {
 } else if (tokenizer.hasParameter()) {
 String parameter = tokenizer.getParameter();
 if (parameter == null) {
-log.error("No closing ) found for in decode");
+log.error(sm.getString("extendedAccessLogValve.noClosing"));
 return null;
 }
 return new ResponseHeaderElement(parameter);
 }
-log.error("The next characters couldn't be decoded: "
-+ tokenizer.getRemains());
+log.error(sm.getString("extendedAccessLogValve.decodeError", 
tokenizer.getRemains()));
 return null;
 }
 
@@ -722,14 +720,14 @@ public class ExtendedAccessLogValve extends 
AccessLogValve {
 tokenizer.getParameter();
 return new StringElement("-");
 }
-log.error("The next characters couldn't be decoded: " + token);
+log.error(sm.getString("extendedAccessLogValve.decodeError", token));
 return null;
 }
 
 protected AccessLogElement getXParameterElement(PatternTokenizer tokenizer)
 throws IOException {
 if (!tokenizer.hasSubToken()) {
-log.error("x param in wrong format. Needs to be 'x-#(...)' read 
the docs!");
+log.error(sm.getString("extendedAccessLogValve.badXParam"));
 return null;
 }
 String token = tokenizer.getToken();
@@ -738,12 +736,12 @@ public class ExtendedAccessLogValve extends 
AccessLogValve {
 }
 
 if (!tokenizer.hasParameter()) {
-log.error("x param in wrong format. Needs to be 'x-#(...)' read 
the docs!");
+log.error(sm.getString("extendedAccessLogValve.badXParam"));
 return null;
 }
 String parameter = tokenizer.getParameter();
 if (parameter == null) {
-log.error("No closing ) found for 

[tomcat] branch 8.5.x updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=51497

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 3b17b66  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=51497
3b17b66 is described below

commit 3b17b66656c6dcae8844bd2ff18f130e0283db2b
Author: Mark Thomas 
AuthorDate: Tue Jul 30 22:37:56 2019 +0100

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=51497

Add an option to use canonical IPv6 representation in the access logs.
---
 .../catalina/security/SecurityClassLoad.java   |  6 --
 .../catalina/valves/AbstractAccessLogValve.java| 80 --
 .../catalina/valves/ExtendedAccessLogValve.java|  2 +-
 webapps/docs/changelog.xml |  5 ++
 webapps/docs/config/valve.xml  | 10 +++
 5 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/java/org/apache/catalina/security/SecurityClassLoad.java 
b/java/org/apache/catalina/security/SecurityClassLoad.java
index 1bb6ecd..b6e2be7 100644
--- a/java/org/apache/catalina/security/SecurityClassLoad.java
+++ b/java/org/apache/catalina/security/SecurityClassLoad.java
@@ -43,7 +43,6 @@ public final class SecurityClassLoad {
 loadServletsPackage(loader);
 loadSessionPackage(loader);
 loadUtilPackage(loader);
-loadValvesPackage(loader);
 loadJavaxPackage(loader);
 loadConnectorPackage(loader);
 loadTomcatPackage(loader);
@@ -109,11 +108,6 @@ public final class SecurityClassLoad {
 }
 
 
-private static final void loadValvesPackage(ClassLoader loader) throws 
Exception {
-final String basePackage = "org.apache.catalina.valves.";
-loadAnonymousInnerClasses(loader, basePackage + 
"AbstractAccessLogValve");
-}
-
 private static final void loadCoyotePackage(ClassLoader loader) throws 
Exception {
 final String basePackage = "org.apache.coyote.";
 loader.loadClass(basePackage + "http11.Constants");
diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java 
b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index 950dbad..9f700e3 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.TimeZone;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -51,6 +52,7 @@ import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.collections.SynchronizedStack;
+import org.apache.tomcat.util.net.IPv6Utils;
 
 
 /**
@@ -173,6 +175,11 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
  */
 protected boolean enabled = true;
 
+ /**
+ * Use IPv6 canonical representation format as defined by RFC 5952.
+ */
+private boolean ipv6Canonical = false;
+
 /**
  * The pattern used to format our access log lines.
  */
@@ -344,7 +351,7 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 private final Locale cacheDefaultLocale;
 private final DateFormatCache parent;
 protected final Cache cLFCache;
-private final HashMap formatCache = new HashMap<>();
+private final Map formatCache = new HashMap<>();
 
 protected DateFormatCache(int size, Locale loc, DateFormatCache 
parent) {
 cacheSize = size;
@@ -489,6 +496,16 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 }
 
 
+public boolean getIpv6Canonical() {
+return ipv6Canonical;
+}
+
+
+public void setIpv6Canonical(boolean ipv6Canonical) {
+this.ipv6Canonical = ipv6Canonical;
+}
+
+
 /**
  * {@inheritDoc}
  * Default is false.
@@ -498,6 +515,7 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 this.requestAttributesEnabled = requestAttributesEnabled;
 }
 
+
 /**
  * {@inheritDoc}
  */
@@ -803,9 +821,9 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
  */
 protected static class LocalAddrElement implements AccessLogElement {
 
-private static final String LOCAL_ADDR_VALUE;
+private final String localAddrValue;
 
-static {
+public LocalAddrElement(boolean ipv6Canonical) {
 String init;
 try {
 init = InetAddress.getLocalHost().getHostAddress();
@@ -813,13 +831,18 @@ public abstract class AbstractAccessLogValve extends 
ValveBase implements Access
 ExceptionUtils.handleThrowable(e);
 init = "127.0.0.1";
  

[Bug 51497] Use canonical IPv6 text representation in logs

2019-07-30 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #13 from Mark Thomas  ---
Added to 8.5.x for 8.5.44 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot failure in on tomcat-7-trunk

2019-07-30 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-7-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-7-trunk/builds/1404

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-7-commit' 
triggered this build
Build Source Stamp: [branch 7.0.x] 31e0a994ba6b69980f6beecd14324f94d8e35f7a
Blamelist: Mark Thomas 

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Back-port IPv6Utils

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 18bd651  Back-port IPv6Utils
18bd651 is described below

commit 18bd651018d35b36af9caa5845a4a41133f89b9c
Author: Mark Thomas 
AuthorDate: Tue Jul 30 22:13:50 2019 +0100

Back-port IPv6Utils
---
 java/org/apache/tomcat/util/net/IPv6Utils.java | 252 +
 test/org/apache/tomcat/util/net/IPv6UtilsTest.java | 141 
 2 files changed, 393 insertions(+)

diff --git a/java/org/apache/tomcat/util/net/IPv6Utils.java 
b/java/org/apache/tomcat/util/net/IPv6Utils.java
new file mode 100644
index 000..94b8c49
--- /dev/null
+++ b/java/org/apache/tomcat/util/net/IPv6Utils.java
@@ -0,0 +1,252 @@
+/*
+ *  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.tomcat.util.net;
+
+/**
+ * IPv6 utilities.
+ * For the moment, it only contains function to canonicalize IPv6 address
+ * into RFC 5952 form.
+ */
+public class IPv6Utils {
+
+private static final int MAX_NUMBER_OF_GROUPS = 8;
+private static final int MAX_GROUP_LENGTH = 4;
+
+/**
+ * Convert IPv6 address into RFC 5952 form.
+ * E.g. 2001:db8:0:1:0:0:0:1 -> 2001:db8:0:1::1
+ *
+ * Method is null safe, and if IPv4 address or host name is passed to 
the
+ * method it is returned without any processing.
+ *
+ * Method also supports IPv4 in IPv6 (e.g. 0:0:0:0:0::192.0.2.1 
->
+ * :::192.0.2.1), and zone ID (e.g. fe80:0:0:0:f0f0:c0c0:1919:1234%4
+ * -> fe80::f0f0:c0c0:1919:1234%4).
+ *
+ * The behaviour of this method is undefined if an invalid IPv6 address
+ * is passed in as input.
+ *
+ * @param ipv6Address String representing valid IPv6 address.
+ * @return String representing IPv6 in canonical form.
+ * @throws IllegalArgumentException if IPv6 format is unacceptable.
+ */
+public static String canonize(String ipv6Address) throws 
IllegalArgumentException {
+
+if (ipv6Address == null) {
+return null;
+}
+
+// Definitely not an IPv6, return untouched input.
+if (!mayBeIPv6Address(ipv6Address)) {
+return ipv6Address;
+}
+
+// Length without zone ID (%zone) or IPv4 address
+int ipv6AddressLength = ipv6Address.length();
+if (ipv6Address.contains(".")) {
+// IPv4 in IPv6
+// e.g. 0:0:0:0:0::127.0.0.1
+int lastColonPos = ipv6Address.lastIndexOf(":");
+int lastColonsPos = ipv6Address.lastIndexOf("::");
+if (lastColonsPos >= 0 && lastColonPos == lastColonsPos + 1) {
+/*
+ *  IPv6 part ends with two consecutive colons,
+ *  last colon is part of IPv6 format.
+ *  e.g. ::127.0.0.1
+ */
+ipv6AddressLength = lastColonPos + 1;
+} else {
+/*
+ *  IPv6 part ends with only one colon,
+ *  last colon is not part of IPv6 format.
+ *  e.g. :::127.0.0.1
+ */
+ipv6AddressLength = lastColonPos;
+}
+} else if (ipv6Address.contains("%")) {
+// Zone ID
+// e.g. fe80:0:0:0:f0f0:c0c0:1919:1234%4
+ipv6AddressLength = ipv6Address.lastIndexOf("%");
+}
+
+StringBuilder result = new StringBuilder();
+char [][] groups = new char[MAX_NUMBER_OF_GROUPS][MAX_GROUP_LENGTH];
+int groupCounter = 0;
+int charInGroupCounter = 0;
+
+// Index of the current zeroGroup, -1 means not found.
+int zeroGroupIndex = -1;
+int zeroGroupLength = 0;
+
+// maximum length zero group, if there is more then one, then first one
+int maxZeroGroupIndex = -1;
+int maxZeroGroupLength = 0;
+
+boolean isZero = true;
+boolean groupStart = true;
+
+/*
+ *  Two consecutive colons, initial expansion.
+ *  e.g. 2001:db8:0:0:1::1 -> 2001:db8:0:0:1:0:0:1
+ 

[tomcat] branch 7.0.x updated: Align with 8.5.x. Remove temp debug code. Improve failure logging.

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 07b8812  Align with 8.5.x. Remove temp debug code. Improve failure 
logging.
07b8812 is described below

commit 07b8812f52c76d56a5ca4e523bdeabbe7912c09e
Author: Mark Thomas 
AuthorDate: Tue Jul 30 22:24:38 2019 +0100

Align with 8.5.x. Remove temp debug code. Improve failure logging.
---
 test/org/apache/catalina/valves/TesterAccessLogValve.java | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/catalina/valves/TesterAccessLogValve.java 
b/test/org/apache/catalina/valves/TesterAccessLogValve.java
index 050ab10..838de8f 100644
--- a/test/org/apache/catalina/valves/TesterAccessLogValve.java
+++ b/test/org/apache/catalina/valves/TesterAccessLogValve.java
@@ -44,7 +44,6 @@ public class TesterAccessLogValve extends ValveBase 
implements AccessLog {
 
 @Override
 public void log(Request request, Response response, long time) {
-(new Exception("Do log")).printStackTrace();
 entries.add(new Entry(request.getRequestURI(), response.getStatus(),
 time));
 }
@@ -76,7 +75,12 @@ public class TesterAccessLogValve extends ValveBase 
implements AccessLog {
 Thread.sleep(100);
 }
 
-Assert.assertEquals(count, entries.size());
+StringBuilder entriesLog = new StringBuilder();
+for (Entry entry : entries) {
+entriesLog.append(entry.toString());
+entriesLog.append(System.getProperty("line.separator"));
+}
+Assert.assertEquals(entriesLog.toString(), count, entries.size());
 for (Entry entry : entries) {
 Assert.assertEquals(status, entry.getStatus());
 Assert.assertTrue(entry.toString() + " duration is not >= " + 
(minTime - ERROR_MARGIN),


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot failure in on tomcat-85-trunk

2019-07-30 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-85-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-85-trunk/builds/1864

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-85-commit' 
triggered this build
Build Source Stamp: [branch 8.5.x] f94e936471bb6b0dcb2d4a1ceb1fa69a14c74385
Blamelist: Mark Thomas 

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot failure in on tomcat-trunk

2019-07-30 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/4520

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch master] 67c3af97230135af8f6f7566c77a79a69722a713
Blamelist: Mark Thomas 

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 57665] support x-forwarded-host

2019-07-30 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #24 from Mark Thomas  ---
Fixed in:
- master for 9.0.23 onwards
- 8.5.x for 8.5.44 onwards
- 7.0.x for 7.0.97 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/02: Align with 8.5.x

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 019a21d1d6302a0d02bf514af78a039d3649459b
Author: Mark Thomas 
AuthorDate: Tue Jul 30 16:24:22 2019 +0100

Align with 8.5.x
---
 test/org/apache/catalina/filters/TestRemoteIpFilter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/filters/TestRemoteIpFilter.java 
b/test/org/apache/catalina/filters/TestRemoteIpFilter.java
index f6c14eb..3db2d24 100644
--- a/test/org/apache/catalina/filters/TestRemoteIpFilter.java
+++ b/test/org/apache/catalina/filters/TestRemoteIpFilter.java
@@ -648,7 +648,7 @@ public class TestRemoteIpFilter extends TomcatBaseTest {
 
actualRequest.getAttribute(Globals.REQUEST_FORWARDED_ATTRIBUTE));
 }
 
-/**
+/*
  * Test {@link RemoteIpFilter} in Tomcat standalone server
  */
 @Test


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/02: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 31e0a994ba6b69980f6beecd14324f94d8e35f7a
Author: Mark Thomas 
AuthorDate: Tue Jul 30 21:42:37 2019 +0100

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

Implement X-Forwarded-Host support for RemoteIpFilter and RemoteIpValve
---
 java/org/apache/catalina/AccessLog.java|  15 ++-
 .../catalina/filters/LocalStrings.properties   |   2 +
 .../apache/catalina/filters/RemoteIpFilter.java| 113 ++--
 .../org/apache/catalina/valves/AccessLogValve.java |  18 +++-
 .../apache/catalina/valves/LocalStrings.properties |   2 +
 java/org/apache/catalina/valves/RemoteIpValve.java |  95 ++---
 .../catalina/filters/TestRemoteIpFilter.java   |  80 ++
 .../apache/catalina/valves/TestRemoteIpValve.java  | 118 +
 webapps/docs/changelog.xml |   5 +
 webapps/docs/config/filter.xml |  13 +++
 webapps/docs/config/valve.xml  |  13 +++
 11 files changed, 446 insertions(+), 28 deletions(-)

diff --git a/java/org/apache/catalina/AccessLog.java 
b/java/org/apache/catalina/AccessLog.java
index 017a27b..7e6f28d 100644
--- a/java/org/apache/catalina/AccessLog.java
+++ b/java/org/apache/catalina/AccessLog.java
@@ -38,28 +38,35 @@ public interface AccessLog {
  * the AccessLog.
  */
 public static final String REMOTE_ADDR_ATTRIBUTE =
-"org.apache.catalina.AccessLog.RemoteAddr";
+"org.apache.catalina.AccessLog.RemoteAddr";
 
 /**
  * Name of request attribute used to override remote host name recorded by
  * the AccessLog.
  */
 public static final String REMOTE_HOST_ATTRIBUTE =
-"org.apache.catalina.AccessLog.RemoteHost";
+"org.apache.catalina.AccessLog.RemoteHost";
 
 /**
  * Name of request attribute used to override the protocol recorded by the
  * AccessLog.
  */
 public static final String PROTOCOL_ATTRIBUTE =
-"org.apache.catalina.AccessLog.Protocol";
+"org.apache.catalina.AccessLog.Protocol";
+
+/**
+ * Name of request attribute used to override the server name recorded by
+ * the AccessLog.
+ */
+public static final String SERVER_NAME_ATTRIBUTE =
+"org.apache.catalina.AccessLog.ServerName";
 
 /**
  * Name of request attribute used to override the server port recorded by
  * the AccessLog.
  */
 public static final String SERVER_PORT_ATTRIBUTE =
-"org.apache.catalina.AccessLog.ServerPort";
+"org.apache.catalina.AccessLog.ServerPort";
 
 
 /**
diff --git a/java/org/apache/catalina/filters/LocalStrings.properties 
b/java/org/apache/catalina/filters/LocalStrings.properties
index 41a4bef..3f2b136 100644
--- a/java/org/apache/catalina/filters/LocalStrings.properties
+++ b/java/org/apache/catalina/filters/LocalStrings.properties
@@ -55,6 +55,8 @@ httpHeaderSecurityFilter.committed=Unable to add HTTP headers 
since response is
 remoteCidrFilter.invalid=Invalid configuration provided for [{0}]. See 
previous messages for details.
 remoteCidrFilter.noRemoteIp=Client does not have an IP address. Request denied.
 
+remoteIpFilter.invalidHostHeader=Invalid value [{0}] found for Host in HTTP 
header [{1}]
+remoteIpFilter.invalidHostWithPort=Host value [{0}] in HTTP header [{1}] 
included a port number which will be ignored
 remoteIpFilter.invalidNumber=Illegal number for parameter [{0}]: [{1}]
 
 requestFilter.deny=Denied request for [{0}] based on property [{1}]
diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java 
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index 5e95840..56759f9 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -41,6 +41,7 @@ import org.apache.catalina.Globals;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
+import org.apache.tomcat.util.http.parser.Host;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -441,6 +442,8 @@ public class RemoteIpFilter implements Filter {
 
 protected Map> headers;
 
+protected String localName;
+
 protected int localPort;
 
 protected String remoteAddr;
@@ -451,15 +454,19 @@ public class RemoteIpFilter implements Filter {
 
 protected boolean secure;
 
+protected String serverName;
+
 protected int serverPort;
 
 public XForwardedRequest(HttpServletRequest request) {
 super(request);
+this.localName = request.getLocalName();
 this.localPort = request.getLocalPort();
 this.remoteAddr = request.getRemoteAddr();
 this.remoteHost = request.getRemoteHost();
 

[tomcat] branch 7.0.x updated (df2cd77 -> 31e0a99)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from df2cd77  Align with 8.5.x
 new 019a21d  Align with 8.5.x
 new 31e0a99  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/AccessLog.java|  15 ++-
 .../catalina/filters/LocalStrings.properties   |   2 +
 .../apache/catalina/filters/RemoteIpFilter.java| 113 ++--
 .../org/apache/catalina/valves/AccessLogValve.java |  18 +++-
 .../apache/catalina/valves/LocalStrings.properties |   2 +
 java/org/apache/catalina/valves/RemoteIpValve.java |  95 ++---
 .../catalina/filters/TestRemoteIpFilter.java   |  82 +-
 .../apache/catalina/valves/TestRemoteIpValve.java  | 118 +
 webapps/docs/changelog.xml |   5 +
 webapps/docs/config/filter.xml |  13 +++
 webapps/docs/config/valve.xml  |  13 +++
 11 files changed, 447 insertions(+), 29 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new f94e936  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665
f94e936 is described below

commit f94e936471bb6b0dcb2d4a1ceb1fa69a14c74385
Author: Mark Thomas 
AuthorDate: Tue Jul 30 21:42:37 2019 +0100

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

Implement X-Forwarded-Host support for RemoteIpFilter and RemoteIpValve
---
 java/org/apache/catalina/AccessLog.java|  15 ++-
 .../catalina/filters/LocalStrings.properties   |   2 +
 .../apache/catalina/filters/RemoteIpFilter.java| 113 ++--
 .../catalina/valves/AbstractAccessLogValve.java|  18 +++-
 .../apache/catalina/valves/LocalStrings.properties |   2 +
 java/org/apache/catalina/valves/RemoteIpValve.java |  95 ++---
 .../catalina/filters/TestRemoteIpFilter.java   |  80 ++
 .../apache/catalina/valves/TestRemoteIpValve.java  | 118 +
 webapps/docs/changelog.xml |   5 +
 webapps/docs/config/filter.xml |  13 +++
 webapps/docs/config/valve.xml  |  13 +++
 11 files changed, 446 insertions(+), 28 deletions(-)

diff --git a/java/org/apache/catalina/AccessLog.java 
b/java/org/apache/catalina/AccessLog.java
index 017a27b..7e6f28d 100644
--- a/java/org/apache/catalina/AccessLog.java
+++ b/java/org/apache/catalina/AccessLog.java
@@ -38,28 +38,35 @@ public interface AccessLog {
  * the AccessLog.
  */
 public static final String REMOTE_ADDR_ATTRIBUTE =
-"org.apache.catalina.AccessLog.RemoteAddr";
+"org.apache.catalina.AccessLog.RemoteAddr";
 
 /**
  * Name of request attribute used to override remote host name recorded by
  * the AccessLog.
  */
 public static final String REMOTE_HOST_ATTRIBUTE =
-"org.apache.catalina.AccessLog.RemoteHost";
+"org.apache.catalina.AccessLog.RemoteHost";
 
 /**
  * Name of request attribute used to override the protocol recorded by the
  * AccessLog.
  */
 public static final String PROTOCOL_ATTRIBUTE =
-"org.apache.catalina.AccessLog.Protocol";
+"org.apache.catalina.AccessLog.Protocol";
+
+/**
+ * Name of request attribute used to override the server name recorded by
+ * the AccessLog.
+ */
+public static final String SERVER_NAME_ATTRIBUTE =
+"org.apache.catalina.AccessLog.ServerName";
 
 /**
  * Name of request attribute used to override the server port recorded by
  * the AccessLog.
  */
 public static final String SERVER_PORT_ATTRIBUTE =
-"org.apache.catalina.AccessLog.ServerPort";
+"org.apache.catalina.AccessLog.ServerPort";
 
 
 /**
diff --git a/java/org/apache/catalina/filters/LocalStrings.properties 
b/java/org/apache/catalina/filters/LocalStrings.properties
index 41a4bef..3f2b136 100644
--- a/java/org/apache/catalina/filters/LocalStrings.properties
+++ b/java/org/apache/catalina/filters/LocalStrings.properties
@@ -55,6 +55,8 @@ httpHeaderSecurityFilter.committed=Unable to add HTTP headers 
since response is
 remoteCidrFilter.invalid=Invalid configuration provided for [{0}]. See 
previous messages for details.
 remoteCidrFilter.noRemoteIp=Client does not have an IP address. Request denied.
 
+remoteIpFilter.invalidHostHeader=Invalid value [{0}] found for Host in HTTP 
header [{1}]
+remoteIpFilter.invalidHostWithPort=Host value [{0}] in HTTP header [{1}] 
included a port number which will be ignored
 remoteIpFilter.invalidNumber=Illegal number for parameter [{0}]: [{1}]
 
 requestFilter.deny=Denied request for [{0}] based on property [{1}]
diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java 
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index c6d01bc..d22233f 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -44,6 +44,7 @@ import org.apache.catalina.servlet4preview.http.PushBuilder;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
+import org.apache.tomcat.util.http.parser.Host;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -445,6 +446,8 @@ public class RemoteIpFilter implements Filter {
 
 protected final Map> headers;
 
+protected String localName;
+
 protected int localPort;
 
 protected String remoteAddr;
@@ -455,15 +458,19 @@ public class RemoteIpFilter implements Filter {
 
 protected boolean secure;
 
+protected String serverName;
+
 protected int serverPort;
 
 public XForwardedRequest(HttpServletRequest request) {
 super(request);
+this

[tomcat] branch master updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 67c3af9  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665
67c3af9 is described below

commit 67c3af97230135af8f6f7566c77a79a69722a713
Author: Mark Thomas 
AuthorDate: Tue Jul 30 21:42:37 2019 +0100

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57665

Implement X-Forwarded-Host support for RemoteIpFilter and RemoteIpValve
---
 java/org/apache/catalina/AccessLog.java|  15 ++-
 .../catalina/filters/LocalStrings.properties   |   2 +
 .../apache/catalina/filters/RemoteIpFilter.java| 113 ++--
 .../catalina/valves/AbstractAccessLogValve.java|  19 +++-
 .../apache/catalina/valves/LocalStrings.properties |   2 +
 java/org/apache/catalina/valves/RemoteIpValve.java |  95 ++---
 .../catalina/filters/TestRemoteIpFilter.java   |  80 ++
 .../apache/catalina/valves/TestRemoteIpValve.java  | 118 +
 webapps/docs/changelog.xml |   5 +
 webapps/docs/config/filter.xml |  13 +++
 webapps/docs/config/valve.xml  |  13 +++
 11 files changed, 446 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/catalina/AccessLog.java 
b/java/org/apache/catalina/AccessLog.java
index 017a27b..7e6f28d 100644
--- a/java/org/apache/catalina/AccessLog.java
+++ b/java/org/apache/catalina/AccessLog.java
@@ -38,28 +38,35 @@ public interface AccessLog {
  * the AccessLog.
  */
 public static final String REMOTE_ADDR_ATTRIBUTE =
-"org.apache.catalina.AccessLog.RemoteAddr";
+"org.apache.catalina.AccessLog.RemoteAddr";
 
 /**
  * Name of request attribute used to override remote host name recorded by
  * the AccessLog.
  */
 public static final String REMOTE_HOST_ATTRIBUTE =
-"org.apache.catalina.AccessLog.RemoteHost";
+"org.apache.catalina.AccessLog.RemoteHost";
 
 /**
  * Name of request attribute used to override the protocol recorded by the
  * AccessLog.
  */
 public static final String PROTOCOL_ATTRIBUTE =
-"org.apache.catalina.AccessLog.Protocol";
+"org.apache.catalina.AccessLog.Protocol";
+
+/**
+ * Name of request attribute used to override the server name recorded by
+ * the AccessLog.
+ */
+public static final String SERVER_NAME_ATTRIBUTE =
+"org.apache.catalina.AccessLog.ServerName";
 
 /**
  * Name of request attribute used to override the server port recorded by
  * the AccessLog.
  */
 public static final String SERVER_PORT_ATTRIBUTE =
-"org.apache.catalina.AccessLog.ServerPort";
+"org.apache.catalina.AccessLog.ServerPort";
 
 
 /**
diff --git a/java/org/apache/catalina/filters/LocalStrings.properties 
b/java/org/apache/catalina/filters/LocalStrings.properties
index 41a4bef..3f2b136 100644
--- a/java/org/apache/catalina/filters/LocalStrings.properties
+++ b/java/org/apache/catalina/filters/LocalStrings.properties
@@ -55,6 +55,8 @@ httpHeaderSecurityFilter.committed=Unable to add HTTP headers 
since response is
 remoteCidrFilter.invalid=Invalid configuration provided for [{0}]. See 
previous messages for details.
 remoteCidrFilter.noRemoteIp=Client does not have an IP address. Request denied.
 
+remoteIpFilter.invalidHostHeader=Invalid value [{0}] found for Host in HTTP 
header [{1}]
+remoteIpFilter.invalidHostWithPort=Host value [{0}] in HTTP header [{1}] 
included a port number which will be ignored
 remoteIpFilter.invalidNumber=Illegal number for parameter [{0}]: [{1}]
 
 requestFilter.deny=Denied request for [{0}] based on property [{1}]
diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java 
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index 1afe033..4664a85 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -45,6 +45,7 @@ import org.apache.catalina.util.RequestUtil;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
+import org.apache.tomcat.util.http.parser.Host;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -448,6 +449,8 @@ public class RemoteIpFilter extends GenericFilter {
 
 protected final Map> headers;
 
+protected String localName;
+
 protected int localPort;
 
 protected String remoteAddr;
@@ -458,15 +461,19 @@ public class RemoteIpFilter extends GenericFilter {
 
 protected boolean secure;
 
+protected String serverName;
+
 protected int serverPort;
 
 public XForwardedRequest(HttpServletRequest request) {
 super(request);
+this.local

[Bug 63602] The temporary upload location is not valid

2019-07-30 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63602

--- Comment #5 from Christopher Schultz  ---
(In reply to Mark Thomas from comment #4)
> It was argued that failure to ensure the directory existed was a
> configuration error - hence why createUploadTargets defaults to false and a
> WARN level log message is written if Tomcat does create that location.

Aah, yes. I forgot that the option existed.

> Closing this as INVALID since it is a configuration issue, not a bug.

+1

This is already available via configuration.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Tomcat S2I

2019-07-30 Thread jean-frederic clere
On 30/07/2019 16:18, Maxime Beck wrote:
> Hello everyone,
> 
> Has there been any release of a Source-to-Image Tomcat builder container
> by any chance? If not, is there any plan to implement one in the near
> future?

The idea is to have an operator for tomcat in operatorhub.io that uses S2I.

> 
> Kind regards,
> Maxime


-- 
Cheers

Jean-Frederic

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/04: Align with master. Use FastDateFormat to parse date headers

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a7a8ea8ef61c61761cffc0322d9a3c567a847e16
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:19:11 2019 +0100

Align with master. Use FastDateFormat to parse date headers
---
 .../apache/catalina/filters/RemoteIpFilter.java| 33 +++---
 1 file changed, 4 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java 
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index a0dee98..f513ccd 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -17,18 +17,13 @@
 package org.apache.catalina.filters;
 
 import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.regex.Pattern;
 
@@ -49,6 +44,7 @@ import org.apache.catalina.connector.RequestFacade;
 import org.apache.catalina.servlet4preview.http.PushBuilder;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -448,18 +444,6 @@ public class RemoteIpFilter implements Filter {
 
 public static class XForwardedRequest extends HttpServletRequestWrapper {
 
-static final ThreadLocal threadLocalDateFormats = 
new ThreadLocal() {
-@Override
-protected SimpleDateFormat[] initialValue() {
-return new SimpleDateFormat[] {
-new SimpleDateFormat("EEE, dd MMM  HH:mm:ss zzz", 
Locale.US),
-new SimpleDateFormat("EE, dd-MMM-yy HH:mm:ss zzz", 
Locale.US),
-new SimpleDateFormat("EEE  d HH:mm:ss ", Locale.US)
-};
-
-}
-};
-
 protected final Map> headers;
 
 protected int localPort;
@@ -496,20 +480,11 @@ public class RemoteIpFilter implements Filter {
 if (value == null) {
 return -1;
 }
-DateFormat[] dateFormats = threadLocalDateFormats.get();
-Date date = null;
-for (int i = 0; ((i < dateFormats.length) && (date == null)); i++) 
{
-DateFormat dateFormat = dateFormats[i];
-try {
-date = dateFormat.parse(value);
-} catch (ParseException ex) {
-// Ignore
-}
-}
-if (date == null) {
+long date = FastHttpDateFormat.parseDate(value);
+if (date == -1) {
 throw new IllegalArgumentException(value);
 }
-return date.getTime();
+return date;
 }
 
 @Override


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 04/04: Align with 8.5.x

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit df2cd774a6477e3f34378f4cfe1a46a2578440e8
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:24:21 2019 +0100

Align with 8.5.x
---
 java/org/apache/catalina/filters/RemoteIpFilter.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java 
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index 14340c9..5e95840 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -17,7 +17,6 @@
 package org.apache.catalina.filters;
 
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -562,7 +561,7 @@ public class RemoteIpFilter implements Filter {
 }
 
 public void setHeader(String name, String value) {
-List values = Arrays.asList(value);
+List values = Collections.singletonList(value);
 Map.Entry> header = getHeaderEntry(name);
 if (header == null) {
 headers.put(name, values);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/04: Align with master. Use FastDateFormat to parse date headers

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit c8e2e046494e91a2126c7ba7ef3b94b8362b7a0f
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:19:29 2019 +0100

Align with master. Use FastDateFormat to parse date headers
---
 .../apache/catalina/filters/RemoteIpFilter.java| 33 +++---
 1 file changed, 4 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java 
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index b399854..14340c9 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -17,18 +17,13 @@
 package org.apache.catalina.filters;
 
 import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.regex.Pattern;
 
@@ -46,6 +41,7 @@ import org.apache.catalina.AccessLog;
 import org.apache.catalina.Globals;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -444,18 +440,6 @@ public class RemoteIpFilter implements Filter {
 
 public static class XForwardedRequest extends HttpServletRequestWrapper {
 
-static final ThreadLocal threadLocalDateFormats = 
new ThreadLocal() {
-@Override
-protected SimpleDateFormat[] initialValue() {
-return new SimpleDateFormat[] {
-new SimpleDateFormat("EEE, dd MMM  HH:mm:ss zzz", 
Locale.US),
-new SimpleDateFormat("EE, dd-MMM-yy HH:mm:ss zzz", 
Locale.US),
-new SimpleDateFormat("EEE  d HH:mm:ss ", Locale.US)
-};
-
-}
-};
-
 protected Map> headers;
 
 protected int localPort;
@@ -492,20 +476,11 @@ public class RemoteIpFilter implements Filter {
 if (value == null) {
 return -1;
 }
-DateFormat[] dateFormats = threadLocalDateFormats.get();
-Date date = null;
-for (int i = 0; ((i < dateFormats.length) && (date == null)); i++) 
{
-DateFormat dateFormat = dateFormats[i];
-try {
-date = dateFormat.parse(value);
-} catch (ParseException ex) {
-// Ignore
-}
-}
-if (date == null) {
+long date = FastHttpDateFormat.parseDate(value);
+if (date == -1) {
 throw new IllegalArgumentException(value);
 }
-return date.getTime();
+return date;
 }
 
 @Override


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/04: Align with 8.5.x: i18n improvements

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a8db40e5af495da0d854bf670e1e25d7198edff9
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:14:20 2019 +0100

Align with 8.5.x: i18n improvements
---
 .../org/apache/catalina/filters/ExpiresFilter.java |  5 +-
 java/org/apache/catalina/filters/FilterBase.java   |  2 +-
 .../catalina/filters/LocalStrings.properties   | 50 +
 .../catalina/filters/LocalStrings_es.properties| 47 +---
 .../catalina/filters/LocalStrings_fr.properties| 51 -
 .../catalina/filters/LocalStrings_ja.properties| 65 ++
 ...gs_fr.properties => LocalStrings_ru.properties} |  6 +-
 .../apache/catalina/filters/RemoteIpFilter.java|  8 ++-
 .../apache/catalina/filters/WebdavFixFilter.java   | 15 ++---
 9 files changed, 188 insertions(+), 61 deletions(-)

diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java 
b/java/org/apache/catalina/filters/ExpiresFilter.java
index 983fabb..b4dce2e 100644
--- a/java/org/apache/catalina/filters/ExpiresFilter.java
+++ b/java/org/apache/catalina/filters/ExpiresFilter.java
@@ -1055,9 +1055,8 @@ public class ExpiresFilter extends FilterBase {
 try {
 ints[i] = Integer.parseInt(intAsString);
 } catch (NumberFormatException e) {
-throw new RuntimeException("Exception parsing number '" + i +
-"' (zero based) of comma delimited list '" +
-commaDelimitedInts + "'");
+throw new 
RuntimeException(sm.getString("expiresFilter.numberError",
+Integer.valueOf(i), commaDelimitedInts));
 }
 }
 return ints;
diff --git a/java/org/apache/catalina/filters/FilterBase.java 
b/java/org/apache/catalina/filters/FilterBase.java
index 5b438d6..9360c91 100644
--- a/java/org/apache/catalina/filters/FilterBase.java
+++ b/java/org/apache/catalina/filters/FilterBase.java
@@ -32,7 +32,7 @@ import org.apache.tomcat.util.res.StringManager;
  */
 public abstract class FilterBase implements Filter {
 
-protected static final StringManager sm = 
StringManager.getManager(Constants.Package);
+protected static final StringManager sm = 
StringManager.getManager(FilterBase.class);
 
 protected abstract Log getLogger();
 
diff --git a/java/org/apache/catalina/filters/LocalStrings.properties 
b/java/org/apache/catalina/filters/LocalStrings.properties
index 01d1a6a..41a4bef 100644
--- a/java/org/apache/catalina/filters/LocalStrings.properties
+++ b/java/org/apache/catalina/filters/LocalStrings.properties
@@ -25,28 +25,29 @@ corsFilter.wrongType2=Expects a HttpServletRequest object 
of type [{0}] or [{1}]
 
 csrfPrevention.invalidRandomClass=Unable to create Random source using class 
[{0}]
 
-expiresFilter.exceptionProcessingParameter=Exception processing configuration 
parameter "{0}":"{1}"
-expiresFilter.expirationHeaderAlreadyDefined=Request "{0}" with response 
status "{1}" content-type "{2}", expiration header already defined
-expiresFilter.filterInitialized=Filter initialized with configuration {0}
-expiresFilter.invalidDurationNumber=Invalid duration (number) "{0}" in 
directive "{1}"
-expiresFilter.invalidDurationUnit=Invalid duration unit 
(years|months|weeks|days|hours|minutes|seconds) "{0}" in directive "{1}"
-expiresFilter.noDurationFound=Duration not found in directive "{0}"
-expiresFilter.noDurationUnitAfterAmount=Duration unit not found after amount 
"{0}" in directive "{1}"
-expiresFilter.noExpirationConfigured=Request "{0}" with response status "{1}" 
content-type "{2}", no expiration configured
-expiresFilter.noExpirationConfiguredForContentType=No Expires configuration 
found for content-type "{0}"
-expiresFilter.responseAlreadyCommited=Request "{0}", can not apply 
ExpiresFilter on already committed response.
-expiresFilter.setExpirationDate=Request "{0}" with response status "{1}" 
content-type "{2}", set expiration date {3}
-expiresFilter.skippedStatusCode=Request "{0}" with response status "{1}" 
content-type "{1}", skip expiration header generation for given status
-expiresFilter.startingPointInvalid=Invalid starting point 
(access|now|modification|a|m) "{0}" in directive "{1}"
-expiresFilter.startingPointNotFound=Starting point 
(access|now|modification|a|m) not found in directive "{0}"
-expiresFilter.unknownParameterIgnored=Unknown parameter "{0}" with value "{1}" 
is ignored !
-expiresFilter.unsupportedStartingPoint=Unsupported startingPoint "{0}"
-expiresFilter.useDefaultConfiguration=Use default {0} for content-type "{1}" 
returns {2}
-expiresFilter.useMatchingConfiguration=Use {0} matching "{1}" for content-type 
"{2}" returns {3}
-
-filterbase.noSuchProperty=The property "{0}" is not defined for filters of 
type "{1}"
-
-http.403=Access to the specified resource ({0}) has been f

[tomcat] 01/04: Align with master. Spacing / comments.

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 1e91ed422ae70b17442e6e834c9d0c0118532552
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:03:31 2019 +0100

Align with master. Spacing / comments.
---
 java/org/apache/catalina/filters/ExpiresFilter.java | 5 -
 1 file changed, 5 deletions(-)

diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java 
b/java/org/apache/catalina/filters/ExpiresFilter.java
index 9049ea9..6f6915d 100644
--- a/java/org/apache/catalina/filters/ExpiresFilter.java
+++ b/java/org/apache/catalina/filters/ExpiresFilter.java
@@ -1021,7 +1021,6 @@ public class ExpiresFilter extends FilterBase {
  */
 @Override
 public boolean isReady() {
-// TODO Auto-generated method stub
 return false;
 }
 
@@ -1030,12 +1029,8 @@ public class ExpiresFilter extends FilterBase {
  */
 @Override
 public void setWriteListener(WriteListener listener) {
-// TODO Auto-generated method stub
-
 }
 
-
-
 }
 
 /**


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/04: Align with 8.5.x. Javadoc

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 86ee8fc7325c4d45deed688ff47f87111d33c34d
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:02:54 2019 +0100

Align with 8.5.x. Javadoc
---
 .../org/apache/catalina/filters/ExpiresFilter.java | 67 ++
 1 file changed, 44 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java 
b/java/org/apache/catalina/filters/ExpiresFilter.java
index dc2c39b..983fabb 100644
--- a/java/org/apache/catalina/filters/ExpiresFilter.java
+++ b/java/org/apache/catalina/filters/ExpiresFilter.java
@@ -217,27 +217,28 @@ import org.apache.juli.logging.LogFactory;
  * {@code
  * 
  *ExpiresDefault
- * [plus] { }*
+ * [plus] ( )*
  * 
  *
  * 
  *ExpiresByType type/encoding
- * [plus] { }*
+ * [plus] ( )*
  * 
  * }
  * 
  * 
  * where {@code } is one of:
+ * 
  * 
  * {@code access}
  * {@code now} (equivalent to '{@code access}')
  * {@code modification}
  * 
- * 
  * 
  * The {@code plus} keyword is optional. {@code } should be an
  * integer value (acceptable to {@code Integer.parseInt()}), and
  * {@code } is one of:
+ * 
  * 
  * {@code years}
  * {@code months}
@@ -247,6 +248,7 @@ import org.apache.juli.logging.LogFactory;
  * {@code minutes}
  * {@code seconds}
  * 
+ * 
  * For example, any of the following directives can be used to make documents
  * expire 1 month after being accessed, by default:
  * 
@@ -296,6 +298,7 @@ import org.apache.juli.logging.LogFactory;
  * Expiration headers generation eligibility
  * 
  * A response is eligible to be enriched by {@code ExpiresFilter} if :
+ * 
  * 
  * no expiration header is defined ({@code Expires} header or the
  * {@code max-age} directive of the {@code Cache-Control} header),
@@ -305,18 +308,18 @@ import org.apache.juli.logging.LogFactory;
  * defined the in {@code ExpiresByType} directives or the
  * {@code ExpiresDefault} directive is defined.
  * 
- * 
  * 
  * Note :
+ * 
  * 
  * If {@code Cache-Control} header contains other directives than
  * {@code max-age}, they are concatenated with the {@code max-age} directive
  * that is added by the {@code ExpiresFilter}.
  * 
- * 
  * Expiration configuration selection
  * 
  * The expiration configuration if elected according to the following 
algorithm:
+ * 
  * 
  * {@code ExpiresByType} matching the exact content-type returned by
  * {@code HttpServletResponse.getContentType()} possibly including the charset
@@ -330,7 +333,6 @@ import org.apache.juli.logging.LogFactory;
  * '),
  * {@code ExpiresDefault}
  * 
- * 
  * Implementation DetailsWhen to write the expiration headers 
?
  * 
  * The {@code ExpiresFilter} traps the 'on before write response
@@ -370,6 +372,7 @@ import org.apache.juli.logging.LogFactory;
  * 
  * 
  * Key methods to override for extension are :
+ * 
  * 
  * 
  * {@link #isEligibleToExpirationHeaderGeneration(HttpServletRequest, 
XHttpServletResponse)}
@@ -377,7 +380,6 @@ import org.apache.juli.logging.LogFactory;
  * 
  * {@link #getExpirationDate(XHttpServletResponse)}
  * 
- * 
  * Troubleshooting
  * 
  * To troubleshoot, enable logging on the
@@ -387,14 +389,14 @@ import org.apache.juli.logging.LogFactory;
  * Extract of logging.properties
  * 
  *
- * 
+ * 
  * org.apache.catalina.filters.ExpiresFilter.level = FINE
- * 
+ * 
  * 
  * Sample of initialization log message :
  * 
  *
- * 
+ * 
  * Mar 26, 2010 2:01:41 PM org.apache.catalina.filters.ExpiresFilter init
  * FINE: Filter initialized with configuration ExpiresFilter[
  *excludedResponseStatusCode=[304],
@@ -403,26 +405,25 @@ import org.apache.juli.logging.LogFactory;
  *   image=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 
MINUTE]],
  *   text/css=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 
MINUTE]],
  *   
application/javascript=ExpiresConfiguration[startingPoint=ACCESS_TIME, 
duration=[10 MINUTE]]}]
- * 
+ * 
  * 
  * Sample of per-request log message where {@code ExpiresFilter} adds an
  * expiration date
  * 
  *
- * 
+ * 
  * Mar 26, 2010 2:09:47 PM org.apache.catalina.filters.ExpiresFilter 
onBeforeWriteResponseBody
  * FINE: Request "/tomcat.gif" with response status "200" content-type 
"image/gif", set expiration date 3/26/10 2:19 PM
- * 
+ * 
  * 
  * Sample of per-request log message where {@code ExpiresFilter} does not add
  * an expiration date
  * 
  *
- * 
+ * 
  * Mar 26, 2010 2:10:27 PM org.apache.catalina.filters.ExpiresFilter 
onBeforeWriteResponseBody
  * FINE: Request "/docs/config/manager.html" with response status "200" 
content-type "text/html", no expiration configured
- * 
- *
+ * 
  */
 public class ExpiresFilter extends FilterBase {
 
@@ -1065,6 +1066,7 @@ public class ExpiresFilter extends FilterBase {
 /**
  * Convert a given comma delimited list of strings into an array of String
  *
+ 

[tomcat] 02/04: Align with master: i18n improvements

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit e2943ad6010cfdecc0fae7c0a31cf21cdff25f49
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:13:35 2019 +0100

Align with master: i18n improvements
---
 .../org/apache/catalina/filters/ExpiresFilter.java |  5 +-
 .../catalina/filters/LocalStrings.properties   |  6 ++
 .../catalina/filters/LocalStrings_es.properties| 11 +++-
 .../catalina/filters/LocalStrings_fr.properties| 49 
 .../catalina/filters/LocalStrings_ja.properties| 65 ++
 ...gs_fr.properties => LocalStrings_ru.properties} |  6 +-
 .../apache/catalina/filters/RemoteIpFilter.java|  8 ++-
 .../apache/catalina/filters/WebdavFixFilter.java   | 14 ++---
 8 files changed, 146 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java 
b/java/org/apache/catalina/filters/ExpiresFilter.java
index 6f6915d..c791dff 100644
--- a/java/org/apache/catalina/filters/ExpiresFilter.java
+++ b/java/org/apache/catalina/filters/ExpiresFilter.java
@@ -1071,9 +1071,8 @@ public class ExpiresFilter extends FilterBase {
 try {
 ints[i] = Integer.parseInt(intAsString);
 } catch (NumberFormatException e) {
-throw new RuntimeException("Exception parsing number '" + i +
-"' (zero based) of comma delimited list '" +
-commaDelimitedInts + "'");
+throw new 
RuntimeException(sm.getString("expiresFilter.numberError",
+Integer.valueOf(i), commaDelimitedInts));
 }
 }
 return ints;
diff --git a/java/org/apache/catalina/filters/LocalStrings.properties 
b/java/org/apache/catalina/filters/LocalStrings.properties
index 31f6e85..41a4bef 100644
--- a/java/org/apache/catalina/filters/LocalStrings.properties
+++ b/java/org/apache/catalina/filters/LocalStrings.properties
@@ -34,6 +34,7 @@ expiresFilter.noDurationFound=Duration not found in directive 
[{0}]
 expiresFilter.noDurationUnitAfterAmount=Duration unit not found after amount 
[{0}] in directive [{1}]
 expiresFilter.noExpirationConfigured=Request [{0}] with response status [{1}] 
content-type [{2}], no expiration configured
 expiresFilter.noExpirationConfiguredForContentType=No Expires configuration 
found for content-type [{0}]
+expiresFilter.numberError=Exception parsing number at position [{0}] (zero 
based) in comma delimited list [{1}]
 expiresFilter.responseAlreadyCommited=Request [{0}], cannot apply 
ExpiresFilter on already committed response.
 expiresFilter.setExpirationDate=Request [{0}] with response status [{1}] 
content-type [{2}], set expiration date [{3}]
 expiresFilter.skippedStatusCode=Request [{0}] with response status [{1}] 
content-type [{1}], skip expiration header generation for given status
@@ -54,6 +55,11 @@ httpHeaderSecurityFilter.committed=Unable to add HTTP 
headers since response is
 remoteCidrFilter.invalid=Invalid configuration provided for [{0}]. See 
previous messages for details.
 remoteCidrFilter.noRemoteIp=Client does not have an IP address. Request denied.
 
+remoteIpFilter.invalidNumber=Illegal number for parameter [{0}]: [{1}]
+
 requestFilter.deny=Denied request for [{0}] based on property [{1}]
 
 restCsrfPreventionFilter.invalidNonce=CSRF nonce validation failed
+
+webDavFilter.xpProblem=WebdavFixFilter: the XP-x64-SP2 client is known not to 
work with WebDAV Servlet
+webDavFilter.xpRootContext=WebdavFixFilter: the XP-x64-SP2 client will only 
work with the root context
diff --git a/java/org/apache/catalina/filters/LocalStrings_es.properties 
b/java/org/apache/catalina/filters/LocalStrings_es.properties
index b6611ad..cf6199c 100644
--- a/java/org/apache/catalina/filters/LocalStrings_es.properties
+++ b/java/org/apache/catalina/filters/LocalStrings_es.properties
@@ -15,7 +15,10 @@
 
 addDefaultCharset.unsupportedCharset=El conjunto especificado de caracteres 
[{0}] no se encuentra soportado
 
-csrfPrevention.invalidRandomClass=No pude crear fuente al azar usando la clase 
[{0}]
+corsFilter.invalidPreflightMaxAge=Incapáz de procesar preflightMaxAge
+corsFilter.nullRequestType=Objeto CORSRequestType es nulo\n
+
+csrfPrevention.invalidRandomClass=No se puede crear fuente aleatórea usando la 
clase [{0}]
 
 expiresFilter.exceptionProcessingParameter=Excepción al procesar parámetro de 
configuración [{0}]:[{1}]
 expiresFilter.expirationHeaderAlreadyDefined=Ya se ha definido cabecera de 
expiración para el requerimiento [{0}] con status de respuesta [{1}] y 
content-type [{2}]
@@ -28,10 +31,14 @@ expiresFilter.skippedStatusCode=Generación de cabecera de 
expiración saltada p
 expiresFilter.startingPointInvalid=Punto de arranque inválido 
(access|now|modification|a|m) [{0}] en la directiva [{1}]
 expiresFilter.startingPointNotFound=Punto de Arranque 
(access|now|modific

[tomcat] branch 7.0.x updated (1a772c4 -> df2cd77)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 1a772c4  Deprecate FastHttpDateFormat.formatDate(long, DateFormat)
 new 86ee8fc  Align with 8.5.x. Javadoc
 new a8db40e  Align with 8.5.x: i18n improvements
 new c8e2e04  Align with master. Use FastDateFormat to parse date headers
 new df2cd77  Align with 8.5.x

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/catalina/filters/ExpiresFilter.java | 72 ++
 java/org/apache/catalina/filters/FilterBase.java   |  2 +-
 .../catalina/filters/LocalStrings.properties   | 50 ---
 .../catalina/filters/LocalStrings_es.properties| 47 --
 .../catalina/filters/LocalStrings_fr.properties| 51 ++-
 .../catalina/filters/LocalStrings_ja.properties| 65 +++
 .../catalina/filters/LocalStrings_ru.properties}   |  7 ++-
 .../apache/catalina/filters/RemoteIpFilter.java| 44 +++--
 .../apache/catalina/filters/WebdavFixFilter.java   | 15 ++---
 9 files changed, 236 insertions(+), 117 deletions(-)
 create mode 100644 java/org/apache/catalina/filters/LocalStrings_ja.properties
 copy java/{javax/servlet/LocalStrings_ja.properties => 
org/apache/catalina/filters/LocalStrings_ru.properties} (71%)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated (bb5db77 -> fa0425a)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from bb5db77  Deprecate FastHttpDateFormat.parseDate(String,DateFormat[])
 new 1e91ed4  Align with master. Spacing / comments.
 new e2943ad  Align with master: i18n improvements
 new a7a8ea8  Align with master. Use FastDateFormat to parse date headers
 new fa0425a  Align with master

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/catalina/filters/ExpiresFilter.java | 10 +---
 .../catalina/filters/LocalStrings.properties   |  6 ++
 .../catalina/filters/LocalStrings_es.properties| 11 +++-
 .../catalina/filters/LocalStrings_fr.properties| 49 
 .../catalina/filters/LocalStrings_ja.properties| 65 ++
 .../filters}/LocalStrings_ru.properties|  6 +-
 .../apache/catalina/filters/RemoteIpFilter.java| 44 ---
 .../apache/catalina/filters/WebdavFixFilter.java   | 14 ++---
 8 files changed, 149 insertions(+), 56 deletions(-)
 create mode 100644 java/org/apache/catalina/filters/LocalStrings_ja.properties
 copy java/org/apache/{tomcat/websocket => 
catalina/filters}/LocalStrings_ru.properties (71%)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 04/04: Align with master

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit fa0425a3c1ffc7254277339c728852d616a4ef64
Author: Mark Thomas 
AuthorDate: Tue Jul 30 15:24:12 2019 +0100

Align with master
---
 java/org/apache/catalina/filters/RemoteIpFilter.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java 
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index f513ccd..c6d01bc 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -17,7 +17,6 @@
 package org.apache.catalina.filters;
 
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -566,7 +565,7 @@ public class RemoteIpFilter implements Filter {
 }
 
 public void setHeader(String name, String value) {
-List values = Arrays.asList(value);
+List values = Collections.singletonList(value);
 Map.Entry> header = getHeaderEntry(name);
 if (header == null) {
 headers.put(name, values);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Clarify the logic of the health check.

2019-07-30 Thread jfclere
This is an automated email from the ASF dual-hosted git repository.

jfclere pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 425b037  Clarify the logic of the health check.
425b037 is described below

commit 425b037f0d78370211afdf56a05190ca512ce830
Author: Jean-Frederic Clere 
AuthorDate: Tue Jul 30 16:21:14 2019 +0200

Clarify the logic of the health check.
---
 webapps/docs/config/valve.xml | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 06dae09..3b889a3 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -2093,7 +2093,10 @@
   
 
 The Health Check Valve responds to
-cloud orchestrators health checks
+cloud orchestrators health checks. Note that it checks
+that a context is mapped (so that an application is deployed),
+for example if you don't have a ROOT context but demo-1.0
+you have to check for /demo-1.0/health
   
 
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Tomcat S2I

2019-07-30 Thread Maxime Beck
Hello everyone,

Has there been any release of a Source-to-Image Tomcat builder container by
any chance? If not, is there any plan to implement one in the near future?

Kind regards,
Maxime


Re: tcnative and JDK13/14

2019-07-30 Thread Rainer Jung
Current plan is to protect the library loading (which is only used on 
VMWare and only to later include additional info in HotSpot error 
reports if they happen) with the already existing switch 
-XX:ExtensiveErrorReports (default false). The good thing is, that then 
it will no longer happen by default, the bad is, that an error report 
switch would have a side effect that can lead to errors even without any 
error report happening.


Regards,

Rainer

Am 30.07.2019 um 09:48 schrieb Rainer Jung:

The HotSpot runtime team is investigating it. It was a surprise for them.

New ticket opened by David Holmes:

https://bugs.openjdk.java.net/browse/JDK-8228764

Mail thread starts at:

https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2019-July/035431.html 



Original implementation ticket:

https://bugs.openjdk.java.net/browse/JDK-8222720

Backport to OpenJDK 11 (for 11.0.5, not yet released):

https://bugs.openjdk.java.net/browse/JDK-8226873

Regards,

Rainer

Am 29.07.2019 um 23:45 schrieb Rainer Jung:

OpenJDK 13/14 introduced change fb5b3981eac:

8222720: Provide extended VMWare/vSphere virtualization related info 
in the hs_error file on linux/windows x86_64


On SLES 12 (maybe also other Linuxes) the impl loads 
/usr/lib64/libguestlib.so.0 already during JVM startup. That library 
depends on /usr/lib64/libvmtools.so.0, which in turn depends on a lot 
of other libraries:


   NEEDED   libdnet.so.1
   NEEDED   libglib-2.0.so.0
   NEEDED   libicui18n.so.52.1
   NEEDED   libicuuc.so.52.1
   NEEDED   libpthread.so.0
   NEEDED   libdl.so.2
   NEEDED   libssl.so.1.0.0
   NEEDED   libcrypto.so.1.0.0
   NEEDED   libc.so.6
   NEEDED   ld-linux-x86-64.so.2
   NEEDED   libgcc_s.so.1

When building tcnative against OpenSSL 1.0.x, the JVM has already 
loaded OpenSSL 1.0 system libs via the above dependency and will not 
load our tcnative dependency. This lead to a subtle failure in my case:


/usr/local/jdk13/bin/java: symbol lookup error: 
/path/to/lib/libtcnative-1.so.0.2.23: undefined symbol: 
SSL_COMP_free_compression_methods


Even worse could be using OpenSSL 1.1.x for tcnative. Then the JVM 
would load the 1.0.x version, tcnative would load the 1.1.x version 
but symbols that exist in both would be resolved by the runtime linker 
in the older version, because it was loaded first (default symbol 
search order). All of that can be worked around by non-default linking 
tricks, but I wanted to point out this new behavior.


I have written to hotspot-runtime-...@openjdk.java.net about these new 
dependencies and potential problems.


Regards,

Rainer


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 04/06: Deprecate FastDateFormat.RFC1123_DATE

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a846e4abf0b5b6307c34c52c1063dca4d3526354
Author: Mark Thomas 
AuthorDate: Mon Jul 29 21:05:19 2019 +0100

Deprecate FastDateFormat.RFC1123_DATE
---
 java/org/apache/catalina/connector/Request.java| 32 --
 java/org/apache/catalina/connector/Response.java   | 22 ---
 .../tomcat/util/http/FastHttpDateFormat.java   |  3 ++
 3 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/java/org/apache/catalina/connector/Request.java 
b/java/org/apache/catalina/connector/Request.java
index 11c64bb..53f3925 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -119,10 +119,10 @@ public class Request implements HttpServletRequest {
 // --- Constructors
 
 public Request() {
-formats[0].setTimeZone(GMT_ZONE);
-formats[1].setTimeZone(GMT_ZONE);
-formats[2].setTimeZone(GMT_ZONE);
-
+formats = new SimpleDateFormat[formatsTemplate.length];
+for(int i = 0; i < formats.length; i++) {
+formats[i] = (SimpleDateFormat) formatsTemplate[i].clone();
+}
 }
 
 
@@ -156,6 +156,10 @@ public class Request implements HttpServletRequest {
 
 // - Variables
 
+/**
+ * @deprecated Unused. This will be removed in Tomcat 10.
+ */
+@Deprecated
 protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
 
 
@@ -176,11 +180,17 @@ public class Request implements HttpServletRequest {
  *
  * Notice that because SimpleDateFormat is not thread-safe, we can't
  * declare formats[] as a static variable.
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10
  */
-protected SimpleDateFormat formats[] = {
-new SimpleDateFormat("EEE, dd MMM  HH:mm:ss zzz", Locale.US),
-new SimpleDateFormat("EE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
-new SimpleDateFormat("EEE  d HH:mm:ss ", Locale.US)
+@Deprecated
+protected final SimpleDateFormat formats[];
+
+@Deprecated
+private static final SimpleDateFormat formatsTemplate[] = {
+new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, Locale.US),
+new SimpleDateFormat("EE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
+new SimpleDateFormat("EEE  d HH:mm:ss ", Locale.US)
 };
 
 
@@ -2231,7 +2241,7 @@ public class Request implements HttpServletRequest {
 }
 
 // Attempt to convert the date header in a variety of formats
-long result = FastHttpDateFormat.parseDate(value, formats);
+long result = FastHttpDateFormat.parseDate(value);
 if (result != (-1L)) {
 return result;
 }
@@ -3663,5 +3673,9 @@ public class Request implements HttpServletRequest {
 // NO-OP
 }
 });
+
+for (SimpleDateFormat sdf : formatsTemplate) {
+sdf.setTimeZone(GMT_ZONE);
+}
 }
 }
diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 1d45bf7..2d5c558 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -31,7 +31,6 @@ import java.util.Collection;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
-import java.util.TimeZone;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.SessionTrackingMode;
@@ -43,7 +42,6 @@ import org.apache.catalina.Globals;
 import org.apache.catalina.Session;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.security.SecurityUtil;
-import org.apache.catalina.util.DateTool;
 import org.apache.catalina.util.RequestUtil;
 import org.apache.catalina.util.SessionConfig;
 import org.apache.juli.logging.Log;
@@ -98,7 +96,10 @@ public class Response implements HttpServletResponse {
 
 /**
  * The date format we will use for creating date headers.
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10
  */
+@Deprecated
 protected SimpleDateFormat format = null;
 
 
@@ -1058,14 +1059,7 @@ public class Response implements HttpServletResponse {
 return;
 }
 
-if (format == null) {
-format = new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER,
-  Locale.US);
-format.setTimeZone(TimeZone.getTimeZone("GMT"));
-}
-
-addHeader(name, FastHttpDateFormat.formatDate(value, format));
-
+addHeader(name, FastHttpDateFormat.formatDate(value));
 }
 
 
@@ -1416,13 +1410,7 @@ public class Response implements HttpServletResponse {
  

[tomcat] 06/06: Deprecate FastHttpDateFormat.formatDate(long, DateFormat)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 1a772c43e3d13791464af5a3bf8141ff08e1d219
Author: Mark Thomas 
AuthorDate: Mon Jul 29 21:32:28 2019 +0100

Deprecate FastHttpDateFormat.formatDate(long, DateFormat)
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 6 +++---
 java/org/apache/tomcat/util/http/FastHttpDateFormat.java | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 54ef218..ebe86f2 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2199,7 +2199,7 @@ public class WebdavServlet extends DefaultServlet {
 generatedXML.writeElement("D", "displayname", XMLWriter.CLOSING);
 if (isFile) {
 generatedXML.writeProperty("D", "getlastmodified",
-FastHttpDateFormat.formatDate(lastModified, null));
+FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeProperty("D", "getcontentlength", 
Long.toString(contentLength));
 if (contentType != null) {
 generatedXML.writeProperty("D", "getcontenttype", 
contentType);
@@ -2317,7 +2317,7 @@ public class WebdavServlet extends DefaultServlet {
 } else if (property.equals("getlastmodified")) {
 if (isFile) {
 generatedXML.writeProperty("D", "getlastmodified",
-FastHttpDateFormat.formatDate(lastModified, 
null));
+FastHttpDateFormat.formatDate(lastModified));
 } else {
 propertiesNotFound.addElement(property);
 }
@@ -2541,7 +2541,7 @@ public class WebdavServlet extends DefaultServlet {
 result.append("\nOwner:");
 result.append(owner);
 result.append("\nExpiration:");
-result.append(FastHttpDateFormat.formatDate(expiresAt, null));
+result.append(FastHttpDateFormat.formatDate(expiresAt));
 Enumeration tokensList = tokens.elements();
 while (tokensList.hasMoreElements()) {
 result.append("\nToken:");
diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java 
b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
index 66a767a..11e7f31 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -117,7 +117,10 @@ public final class FastHttpDateFormat {
  * @param threadLocalformat Ignored. The local ConcurrentDateFormat will
  *  always be used.
  * @return the HTTP date
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10
  */
+@Deprecated
 public static final String formatDate(long value, DateFormat 
threadLocalformat) {
 return formatDate(value);
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/06: Align with master. Spacing, Javadoc, remove unnecessary (...)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 24ebf35f082e0198a5c3b6bc83e1c1becc305588
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:53:41 2019 +0100

Align with master. Spacing, Javadoc, remove unnecessary (...)
---
 java/org/apache/catalina/connector/Request.java  |  14 +-
 java/org/apache/catalina/connector/Response.java | 157 +--
 2 files changed, 91 insertions(+), 80 deletions(-)

diff --git a/java/org/apache/catalina/connector/Request.java 
b/java/org/apache/catalina/connector/Request.java
index 71e381e..11c64bb 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -16,7 +16,6 @@
  */
 package org.apache.catalina.connector;
 
-
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -113,16 +112,13 @@ import org.ietf.jgss.GSSException;
  * @author Remy Maucherat
  * @author Craig R. McClanahan
  */
-public class Request
-implements HttpServletRequest {
+public class Request implements HttpServletRequest {
 
 private static final Log log = LogFactory.getLog(Request.class);
 
 // --- Constructors
 
-
 public Request() {
-
 formats[0].setTimeZone(GMT_ZONE);
 formats[1].setTimeZone(GMT_ZONE);
 formats[2].setTimeZone(GMT_ZONE);
@@ -160,7 +156,6 @@ implements HttpServletRequest {
 
 // - Variables
 
-
 protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
 
 
@@ -2775,10 +2770,7 @@ implements HttpServletRequest {
 }
 
 /**
- * @throws IOException If an I/O error occurs
- * @throws IllegalStateException If the response has been committed
- * @throws ServletException If the caller is responsible for handling the
- * error and the container has NOT set the HTTP response code etc.
+ * {@inheritDoc}
  */
 @Override
 public boolean authenticate(HttpServletResponse response)
@@ -2949,7 +2941,7 @@ implements HttpServletRequest {
 try {
 value = 
part.getString(Parameters.DEFAULT_ENCODING);
 } catch (UnsupportedEncodingException e) {
-// Should not be possible
+// Not possible
 }
 }
 if (maxPostSize >= 0) {
diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 539fe6b..1d45bf7 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -32,7 +32,6 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
 import java.util.TimeZone;
-import java.util.Vector;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.SessionTrackingMode;
@@ -155,18 +154,18 @@ public class Response implements HttpServletResponse {
 }
 
 /**
- * Get the Coyote response.
+ * @return the Coyote response.
  */
 public org.apache.coyote.Response getCoyoteResponse() {
-return (coyoteResponse);
+return this.coyoteResponse;
 }
 
 
 /**
- * Return the Context within which this Request is being processed.
+ * @return the Context within which this Request is being processed.
  */
 public Context getContext() {
-return (request.getContext());
+return request.getContext();
 }
 
 /**
@@ -245,7 +244,6 @@ public class Response implements HttpServletResponse {
 
 // - Public Methods
 
-
 /**
  * Release all object references, and initialize instance variables, in
  * preparation for reuse of this object.
@@ -289,9 +287,8 @@ public class Response implements HttpServletResponse {
 
 // --- Response Methods
 
-
 /**
- * Return the number of bytes the application has actually written to the
+ * @return the number of bytes the application has actually written to the
  * output stream. This excludes chunking, compression, etc. as well as
  * headers.
  */
@@ -301,8 +298,9 @@ public class Response implements HttpServletResponse {
 
 
 /**
- * Return the number of bytes the actually written to the socket. This
+ * @return the number of bytes the actually written to the socket. This
  * includes chunking, compression, etc. but excludes headers.
+ * @param flush if true will perform a buffer flush first
  */
 public long getBytesWritten(boolean flush) {
 if (flush) {
@@ -327,11 +325,13 @@ public class Response implements HttpServletResponse {
 
 /**

[tomcat] 02/06: Align with 8.5.x. Deprecate.

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit b61da624970e718d9609b11b2c0532de5d37734a
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:35:11 2019 +0100

Align with 8.5.x. Deprecate.

Use org.apache.tomcat.util.http.ConcurrentDateFormat instead
---
 java/org/apache/catalina/authenticator/AuthenticatorBase.java | 5 ++---
 java/org/apache/catalina/servlets/WebdavServlet.java  | 2 +-
 java/org/apache/catalina/util/ConcurrentDateFormat.java   | 4 
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index 0c6ff36..a80c4dd 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -19,7 +19,6 @@ package org.apache.catalina.authenticator;
 import java.io.IOException;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
-import java.util.Date;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.Cookie;
@@ -40,7 +39,6 @@ import org.apache.catalina.connector.Response;
 import org.apache.catalina.deploy.LoginConfig;
 import org.apache.catalina.deploy.SecurityConstraint;
 import org.apache.catalina.realm.GenericPrincipal;
-import org.apache.catalina.util.ConcurrentDateFormat;
 import org.apache.catalina.util.SessionIdGeneratorBase;
 import org.apache.catalina.util.StandardSessionIdGenerator;
 import org.apache.catalina.valves.ValveBase;
@@ -48,6 +46,7 @@ import org.apache.coyote.ActionCode;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -76,7 +75,7 @@ public abstract class AuthenticatorBase extends ValveBase
 /**
  * "Expires" header always set to Date(1), so generate once only
  */
-private static final String DATE_ONE = 
ConcurrentDateFormat.formatRfc1123(new Date(1));
+private static final String DATE_ONE = FastHttpDateFormat.formatDate(1);
 
 /**
  * The string manager for this package.
diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 1f477cb..2b677d3 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -49,13 +49,13 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.catalina.connector.RequestFacade;
-import org.apache.catalina.util.ConcurrentDateFormat;
 import org.apache.catalina.util.DOMWriter;
 import org.apache.catalina.util.URLEncoder;
 import org.apache.catalina.util.XMLWriter;
 import org.apache.naming.resources.CacheEntry;
 import org.apache.naming.resources.Resource;
 import org.apache.naming.resources.ResourceAttributes;
+import org.apache.tomcat.util.http.ConcurrentDateFormat;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.security.MD5Encoder;
diff --git a/java/org/apache/catalina/util/ConcurrentDateFormat.java 
b/java/org/apache/catalina/util/ConcurrentDateFormat.java
index 7980ded..175f23e 100644
--- a/java/org/apache/catalina/util/ConcurrentDateFormat.java
+++ b/java/org/apache/catalina/util/ConcurrentDateFormat.java
@@ -27,7 +27,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
  * A thread safe wrapper around {@link SimpleDateFormat} that does not make use
  * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects
  * to satisfy the concurrency requirements.
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10.
+ * Use {@link org.apache.tomcat.util.http.ConcurrentDateFormat}
  */
+@Deprecated
 public class ConcurrentDateFormat {
 
 private final String format;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 05/06: Refactor to remove duplicate code

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit e25eb1550f2d5df7b1fb8b0fc30a3e0923977fe1
Author: Mark Thomas 
AuthorDate: Mon Jul 29 21:30:19 2019 +0100

Refactor to remove duplicate code
---
 .../apache/catalina/servlets/WebdavServlet.java| 417 ++---
 1 file changed, 105 insertions(+), 312 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 2b677d3..54ef218 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2110,13 +2110,6 @@ public class WebdavServlet extends DefaultServlet {
 return;
 }
 
-generatedXML.writeElement("D", "response", XMLWriter.OPENING);
-String status = "HTTP/1.1 " + WebdavStatus.SC_OK + " " +
-WebdavStatus.getStatusText(WebdavStatus.SC_OK);
-
-// Generating href element
-generatedXML.writeElement("D", "href", XMLWriter.OPENING);
-
 String href = req.getContextPath() + req.getServletPath();
 if ((href.endsWith("/")) && (path.startsWith("/")))
 href += path.substring(1);
@@ -2125,246 +2118,12 @@ public class WebdavServlet extends DefaultServlet {
 if ((cacheEntry.context != null) && (!href.endsWith("/")))
 href += "/";
 
-generatedXML.writeText(rewriteUrl(href));
-
-generatedXML.writeElement("D", "href", XMLWriter.CLOSING);
-
-String resourceName = path;
-int lastSlash = path.lastIndexOf('/');
-if (lastSlash != -1)
-resourceName = resourceName.substring(lastSlash + 1);
-
-switch (type) {
-
-case FIND_ALL_PROP :
-
-generatedXML.writeElement("D", "propstat", XMLWriter.OPENING);
-generatedXML.writeElement("D", "prop", XMLWriter.OPENING);
-
-generatedXML.writeProperty("D", "creationdate",
-getISOCreationDate(cacheEntry.attributes.getCreation()));
-generatedXML.writeElement("D", "displayname", XMLWriter.OPENING);
-generatedXML.writeData(resourceName);
-generatedXML.writeElement("D", "displayname", XMLWriter.CLOSING);
-if (cacheEntry.resource != null) {
-generatedXML.writeProperty
-("D", "getlastmodified", FastHttpDateFormat.formatDate
-   (cacheEntry.attributes.getLastModified(), null));
-generatedXML.writeProperty
-("D", "getcontentlength",
- String.valueOf(cacheEntry.attributes.getContentLength()));
-String contentType = getServletContext().getMimeType
-(cacheEntry.name);
-if (contentType != null) {
-generatedXML.writeProperty("D", "getcontenttype",
-contentType);
-}
-generatedXML.writeProperty("D", "getetag",
-cacheEntry.attributes.getETag());
-generatedXML.writeElement("D", "resourcetype",
-XMLWriter.NO_CONTENT);
-} else {
-generatedXML.writeElement("D", "resourcetype",
-XMLWriter.OPENING);
-generatedXML.writeElement("D", "collection",
-XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "resourcetype",
-XMLWriter.CLOSING);
-}
-
-generatedXML.writeProperty("D", "source", "");
-
-String supportedLocks = ""
-+ ""
-+ ""
-+ "" + ""
-+ ""
-+ ""
-+ "";
-generatedXML.writeElement("D", "supportedlock", XMLWriter.OPENING);
-generatedXML.writeText(supportedLocks);
-generatedXML.writeElement("D", "supportedlock", XMLWriter.CLOSING);
-
-generateLockDiscovery(path, generatedXML);
-
-generatedXML.writeElement("D", "prop", XMLWriter.CLOSING);
-generatedXML.writeElement("D", "status", XMLWriter.OPENING);
-generatedXML.writeText(status);
-generatedXML.writeElement("D", "status", XMLWriter.CLOSING);
-generatedXML.writeElement("D", "propstat", XMLWriter.CLOSING);
-
-break;
-
-case FIND_PROPERTY_NAMES :
-
-generatedXML.writeElement("D", "propstat", XMLWriter.OPENING);
-generatedXML.writeElement("D", "prop", XMLWriter.OPENING);
-
-generatedXML.writeElement("D", "creationdate",
-  XMLWriter.NO_CONTENT);
-generatedXML.writeElement("D", "displayname", 
XMLWriter.NO_CONTENT);
-if (cacheEntry.resource != null) {
-gen

[tomcat] 01/07: Prep for additional backports. Align with master (excluding deprecation)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 56a1caeb752806f51784a19ef470d7f73e855971
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:17:39 2019 +0100

Prep for additional backports. Align with master (excluding deprecation)
---
 .../tomcat/util/http/ConcurrentDateFormat.java |  72 +
 .../tomcat/util/http/FastHttpDateFormat.java   | 118 ++---
 2 files changed, 126 insertions(+), 64 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java 
b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
new file mode 100644
index 000..9ce953f
--- /dev/null
+++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
@@ -0,0 +1,72 @@
+/*
+ * 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.tomcat.util.http;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Queue;
+import java.util.TimeZone;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * A thread safe wrapper around {@link SimpleDateFormat} that does not make use
+ * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects
+ * to satisfy the concurrency requirements.
+ */
+public class ConcurrentDateFormat {
+
+private final String format;
+private final Locale locale;
+private final TimeZone timezone;
+private final Queue queue = new 
ConcurrentLinkedQueue<>();
+
+public ConcurrentDateFormat(String format, Locale locale, TimeZone 
timezone) {
+this.format = format;
+this.locale = locale;
+this.timezone = timezone;
+SimpleDateFormat initial = createInstance();
+queue.add(initial);
+}
+
+public String format(Date date) {
+SimpleDateFormat sdf = queue.poll();
+if (sdf == null) {
+sdf = createInstance();
+}
+String result = sdf.format(date);
+queue.add(sdf);
+return result;
+}
+
+public Date parse(String source) throws ParseException {
+SimpleDateFormat sdf = queue.poll();
+if (sdf == null) {
+sdf = createInstance();
+}
+Date result = sdf.parse(source);
+queue.add(sdf);
+return result;
+}
+
+private SimpleDateFormat createInstance() {
+SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
+sdf.setTimeZone(timezone);
+return sdf;
+}
+}
diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java 
b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
index f30c04b..86376d2 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -18,7 +18,6 @@ package org.apache.tomcat.util.http;
 
 import java.text.DateFormat;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Locale;
 import java.util.Map;
@@ -43,23 +42,30 @@ public final class FastHttpDateFormat {
 /**
  * The only date format permitted when generating HTTP headers.
  */
-public static final String RFC1123_DATE =
-"EEE, dd MMM  HH:mm:ss zzz";
+public static final String RFC1123_DATE = "EEE, dd MMM  HH:mm:ss zzz";
 
-private static final SimpleDateFormat format =
-new SimpleDateFormat(RFC1123_DATE, Locale.US);
+// HTTP date formats
+private static final String DATE_RFC5322 = "EEE, dd MMM  HH:mm:ss z";
+private static final String DATE_OBSOLETE_RFC850 = "EE, dd-MMM-yy 
HH:mm:ss zzz";
+private static final String DATE_OBSOLETE_ASCTIME = "EEE  d HH:mm:ss 
";
 
+private static final ConcurrentDateFormat FORMAT_RFC5322;
+private static final ConcurrentDateFormat FORMAT_OBSOLETE_RFC850;
+private static final ConcurrentDateFormat FORMAT_OBSOLETE_ASCTIME;
 
-private static final TimeZone gmtZone = TimeZone.getTimeZone("GMT");
+private static final ConcurrentDateFormat[] httpParseFormats;
 
-
-/**
- * GMT timezone - all HTTP dates ar

[tomcat] 01/06: Prep for additional backports. Align with 8.5.x.

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit f852fb13e430be3862676b8b7cc691a59da4070e
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:18:01 2019 +0100

Prep for additional backports. Align with 8.5.x.
---
 .../tomcat/util/http/ConcurrentDateFormat.java |  72 +++
 .../tomcat/util/http/FastHttpDateFormat.java   | 143 +
 2 files changed, 136 insertions(+), 79 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java 
b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
new file mode 100644
index 000..613b1ba
--- /dev/null
+++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
@@ -0,0 +1,72 @@
+/*
+ * 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.tomcat.util.http;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Queue;
+import java.util.TimeZone;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * A thread safe wrapper around {@link SimpleDateFormat} that does not make use
+ * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects
+ * to satisfy the concurrency requirements.
+ */
+public class ConcurrentDateFormat {
+
+private final String format;
+private final Locale locale;
+private final TimeZone timezone;
+private final Queue queue = new 
ConcurrentLinkedQueue();
+
+public ConcurrentDateFormat(String format, Locale locale, TimeZone 
timezone) {
+this.format = format;
+this.locale = locale;
+this.timezone = timezone;
+SimpleDateFormat initial = createInstance();
+queue.add(initial);
+}
+
+public String format(Date date) {
+SimpleDateFormat sdf = queue.poll();
+if (sdf == null) {
+sdf = createInstance();
+}
+String result = sdf.format(date);
+queue.add(sdf);
+return result;
+}
+
+public Date parse(String source) throws ParseException {
+SimpleDateFormat sdf = queue.poll();
+if (sdf == null) {
+sdf = createInstance();
+}
+Date result = sdf.parse(source);
+queue.add(sdf);
+return result;
+}
+
+private SimpleDateFormat createInstance() {
+SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
+sdf.setTimeZone(timezone);
+return sdf;
+}
+}
diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java 
b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
index d4af86d..4f787a2 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -18,7 +18,6 @@ package org.apache.tomcat.util.http;
 
 import java.text.DateFormat;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Locale;
 import java.util.Map;
@@ -41,39 +40,33 @@ public final class FastHttpDateFormat {
 
 
 /**
- * HTTP date format.
+ * The only date format permitted when generating HTTP headers.
  */
-private static final SimpleDateFormat format =
-new SimpleDateFormat("EEE, dd MMM  HH:mm:ss zzz", Locale.US);
+public static final String RFC1123_DATE = "EEE, dd MMM  HH:mm:ss zzz";
 
+// HTTP date formats
+private static final String DATE_RFC5322 = "EEE, dd MMM  HH:mm:ss z";
+private static final String DATE_OBSOLETE_RFC850 = "EE, dd-MMM-yy 
HH:mm:ss zzz";
+private static final String DATE_OBSOLETE_ASCTIME = "EEE  d HH:mm:ss 
";
 
-/**
- * The set of SimpleDateFormat formats to use in getDateHeader().
- */
-private static final SimpleDateFormat formats[] = {
-new SimpleDateFormat("EEE, dd MMM  HH:mm:ss zzz", Locale.US),
-new SimpleDateFormat("EE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
-new SimpleDateFormat("EEE  d HH:mm:ss ", Locale.US)
-};
-
+private static final ConcurrentDateFormat FORMAT_RFC5322;
+private static final ConcurrentDat

[tomcat] branch 7.0.x updated (2fb5a89 -> 1a772c4)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 2fb5a89  Add release date for 7.0.96
 new f852fb1  Prep for additional backports. Align with 8.5.x.
 new b61da62  Align with 8.5.x. Deprecate.
 new 24ebf35  Align with master. Spacing, Javadoc, remove unnecessary (...)
 new a846e4a  Deprecate FastDateFormat.RFC1123_DATE
 new e25eb15  Refactor to remove duplicate code
 new 1a772c4  Deprecate FastHttpDateFormat.formatDate(long, DateFormat)

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../catalina/authenticator/AuthenticatorBase.java  |   5 +-
 java/org/apache/catalina/connector/Request.java|  46 ++-
 java/org/apache/catalina/connector/Response.java   | 179 -
 .../apache/catalina/servlets/WebdavServlet.java| 421 ++---
 .../apache/catalina/util/ConcurrentDateFormat.java |   4 +
 .../util/http}/ConcurrentDateFormat.java   |  18 +-
 .../tomcat/util/http/FastHttpDateFormat.java   | 149 
 7 files changed, 304 insertions(+), 518 deletions(-)
 copy java/org/apache/{naming/resources => 
tomcat/util/http}/ConcurrentDateFormat.java (81%)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/07: Align with master

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 2182c043510c3864d31fbbcfea0a2fc69ee6a957
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:32:28 2019 +0100

Align with master
---
 .../apache/catalina/webresources/FileResource.java |  2 +-
 .../catalina/webresources/JarWarResourceSet.java   |  2 +-
 .../catalina/webresources/LocalStrings.properties  |  3 +-
 .../webresources/LocalStrings_es.properties| 24 +
 .../webresources/LocalStrings_fr.properties| 59 ++
 .../webresources/LocalStrings_ja.properties| 59 ++
 6 files changed, 146 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/webresources/FileResource.java 
b/java/org/apache/catalina/webresources/FileResource.java
index 2365b50..babe190 100644
--- a/java/org/apache/catalina/webresources/FileResource.java
+++ b/java/org/apache/catalina/webresources/FileResource.java
@@ -47,7 +47,7 @@ public class FileResource extends AbstractResource {
 boolean isEBCDIC = false;
 try {
 String encoding = System.getProperty("file.encoding");
-if (encoding.indexOf("EBCDIC") != -1) {
+if (encoding.contains("EBCDIC")) {
 isEBCDIC = true;
 }
 } catch (SecurityException e) {
diff --git a/java/org/apache/catalina/webresources/JarWarResourceSet.java 
b/java/org/apache/catalina/webresources/JarWarResourceSet.java
index 52c4de6..adfb265 100644
--- a/java/org/apache/catalina/webresources/JarWarResourceSet.java
+++ b/java/org/apache/catalina/webresources/JarWarResourceSet.java
@@ -222,7 +222,7 @@ public class JarWarResourceSet extends 
AbstractArchiveResourceSet {
  */
 @Override
 protected JarEntry getArchiveEntry(String pathInArchive) {
-throw new IllegalStateException("Coding error");
+throw new 
IllegalStateException(sm.getString("jarWarResourceSet.codingError"));
 }
 
 
diff --git a/java/org/apache/catalina/webresources/LocalStrings.properties 
b/java/org/apache/catalina/webresources/LocalStrings.properties
index aa941cc..5b3f8b8 100644
--- a/java/org/apache/catalina/webresources/LocalStrings.properties
+++ b/java/org/apache/catalina/webresources/LocalStrings.properties
@@ -29,7 +29,6 @@ classpathUrlStreamHandler.notFound=Unable to load the 
resource [{0}] using the t
 
 dirResourceSet.manifestFail=Failed to read manifest from [{0}]
 dirResourceSet.notDirectory=The directory specified by base and internal path 
[{0}]{1}[{2}] does not exist.
-dirResourceSet.writeExists=The target of the write already exists
 dirResourceSet.writeNpe=The input stream may not be null
 
 extractingRoot.jarFailed=Failed to extract the JAR file [{0}]
@@ -46,6 +45,8 @@ jarResource.getUrlFail=Unable to determine a URL for the 
resource [{0}] located
 
 jarResourceRoot.invalidWebAppPath=This resource always refers to a directory 
so the supplied webAppPath must end with / but the provided webAppPath was [{0}]
 
+jarWarResourceSet.codingError=Coding error
+
 standardRoot.checkStateNotStarted=The resources may not be accessed if they 
are not currently started
 standardRoot.createInvalidFile=Unable to create WebResourceSet from [{0}]
 standardRoot.createNoFileResourceSet=The FileResourceSet feature has not yet 
been implemented
diff --git a/java/org/apache/catalina/webresources/LocalStrings_es.properties 
b/java/org/apache/catalina/webresources/LocalStrings_es.properties
new file mode 100644
index 000..0a2c28c
--- /dev/null
+++ b/java/org/apache/catalina/webresources/LocalStrings_es.properties
@@ -0,0 +1,24 @@
+# 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.
+
+cache.addFail=Imposible adicionar recursos a [{0}]  de la cache para la 
applicación web [{1}]  porque no hay suficiente espacio libre luego de eliminar 
los datos expirados de la caché - considere incrementar el tamaño máximo de la 
chaché
+
+dirResourceSet.notDirectory=El directorio especificado por la base y el camino 
interno [{0}]{1}[{2}] no existe.\n
+
+extractingRoot.targetFailed=Fallo al crear directorio [{0}] para los archivos 
JAR extraidos
+
+jarResource.getUrlFail=Impo

[tomcat] 04/07: Align with master. Spacing, Javadoc, remove unnecessary (...)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 6025ef74c90512ab242861cfdcd0ca5096417164
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:52:42 2019 +0100

Align with master. Spacing, Javadoc, remove unnecessary (...)
---
 java/org/apache/catalina/connector/Request.java  |  3 +--
 java/org/apache/catalina/connector/Response.java | 24 +---
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/catalina/connector/Request.java 
b/java/org/apache/catalina/connector/Request.java
index 0fdfc63..1e95e74 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -129,7 +129,6 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 
 // --- Constructors
 
-
 public Request() {
 formats = new SimpleDateFormat[formatsTemplate.length];
 for(int i = 0; i < formats.length; i++) {
@@ -168,7 +167,6 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 
 // - Variables
 
-
 protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
 
 
@@ -579,6 +577,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 return mappingData.context;
 }
 
+
 /**
  * @param context The newly associated Context
  * @deprecated Use setters on {@link #getMappingData() MappingData} object.
diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 7b976e0..b3c4f13 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -33,7 +33,6 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
 import java.util.TimeZone;
-import java.util.Vector;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.ServletResponse;
@@ -782,11 +781,10 @@ public class Response implements HttpServletResponse {
  * of the request. This method must be called prior to reading
  * request parameters or reading input using getReader().
  *
- * @param characterEncoding String containing the name of the character
- *  encoding.
+ * @param charset String containing the name of the character encoding.
  */
 @Override
-public void setCharacterEncoding(String characterEncoding) {
+public void setCharacterEncoding(String charset) {
 
 if (isCommitted()) {
 return;
@@ -804,9 +802,9 @@ public class Response implements HttpServletResponse {
 }
 
 try {
-getCoyoteResponse().setCharacterEncoding(characterEncoding);
+getCoyoteResponse().setCharacterEncoding(charset);
 } catch (IllegalArgumentException e) {
-log.warn(sm.getString("coyoteResponse.encoding.invalid", 
characterEncoding), e);
+log.warn(sm.getString("coyoteResponse.encoding.invalid", charset), 
e);
 return;
 }
 isCharacterEncodingSet = true;
@@ -870,7 +868,6 @@ public class Response implements HttpServletResponse {
 
 @Override
 public Collection getHeaderNames() {
-
 MimeHeaders headers = getCoyoteResponse().getMimeHeaders();
 int n = headers.size();
 List result = new ArrayList<>(n);
@@ -884,12 +881,11 @@ public class Response implements HttpServletResponse {
 
 @Override
 public Collection getHeaders(String name) {
-
 Enumeration enumeration =
 getCoyoteResponse().getMimeHeaders().values(name);
-Vector result = new Vector<>();
+List result = new ArrayList<>();
 while (enumeration.hasMoreElements()) {
-result.addElement(enumeration.nextElement());
+result.add(enumeration.nextElement());
 }
 return result;
 }
@@ -1404,8 +1400,9 @@ public class Response implements HttpServletResponse {
 
 char cc=name.charAt(0);
 if (cc=='C' || cc=='c') {
-if (checkSpecialHeader(name, value))
+if (checkSpecialHeader(name, value)) {
 return;
+}
 }
 
 getCoyoteResponse().setHeader(name, value);
@@ -1481,7 +1478,6 @@ public class Response implements HttpServletResponse {
 
 // -- Protected Methods
 
-
 /**
  * Return true if the specified URL should be encoded with
  * a session identifier.  This will be true if all of the following
@@ -1786,9 +1782,7 @@ public class Response implements HttpServletResponse {
 }
 
 private void copyChars(char[] c, int dest, int src, int len) {
-for (int pos = 0; pos < len; pos++) {

[tomcat] 06/07: Deprecate FastHttpDateFormat.formatDate(long, DateFormat)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit dedb056afbd9d76f6da8d4a0ed119b1d9e2196c1
Author: Mark Thomas 
AuthorDate: Mon Jul 29 21:32:20 2019 +0100

Deprecate FastHttpDateFormat.formatDate(long, DateFormat)
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 8 
 java/org/apache/tomcat/util/http/FastHttpDateFormat.java | 3 +++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 4c59ac2..ef5573d 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2068,7 +2068,7 @@ public class WebdavServlet extends DefaultServlet {
 generatedXML.writeElement("D", "displayname", XMLWriter.CLOSING);
 if (isFile) {
 generatedXML.writeProperty("D", "getlastmodified",
-FastHttpDateFormat.formatDate(lastModified, null));
+FastHttpDateFormat.formatDate(lastModified));
 generatedXML.writeProperty("D", "getcontentlength", 
Long.toString(contentLength));
 if (contentType != null) {
 generatedXML.writeProperty("D", "getcontenttype", 
contentType);
@@ -2152,7 +2152,7 @@ public class WebdavServlet extends DefaultServlet {
 String property = properties.nextElement();
 
 if (property.equals("creationdate")) {
-generatedXML.writeProperty ("D", "creationdate", 
getISOCreationDate(created));
+generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
 } else if (property.equals("displayname")) {
 generatedXML.writeElement("D", "displayname", 
XMLWriter.OPENING);
 generatedXML.writeData(resourceName);
@@ -2186,7 +2186,7 @@ public class WebdavServlet extends DefaultServlet {
 } else if (property.equals("getlastmodified")) {
 if (isFile) {
 generatedXML.writeProperty("D", "getlastmodified",
-FastHttpDateFormat.formatDate(lastModified, 
null));
+FastHttpDateFormat.formatDate(lastModified));
 } else {
 propertiesNotFound.addElement(property);
 }
@@ -2405,7 +2405,7 @@ public class WebdavServlet extends DefaultServlet {
 result.append("\nOwner:");
 result.append(owner);
 result.append("\nExpiration:");
-result.append(FastHttpDateFormat.formatDate(expiresAt, null));
+result.append(FastHttpDateFormat.formatDate(expiresAt));
 Enumeration tokensList = tokens.elements();
 while (tokensList.hasMoreElements()) {
 result.append("\nToken:");
diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java 
b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
index dd9bd2b..ee7f780 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -117,7 +117,10 @@ public final class FastHttpDateFormat {
  * @param threadLocalformat Ignored. The local ConcurrentDateFormat will
  *  always be used.
  * @return the HTTP date
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10
  */
+@Deprecated
 public static final String formatDate(long value, DateFormat 
threadLocalformat) {
 return formatDate(value);
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 07/07: Deprecate FastHttpDateFormat.parseDate(String, DateFormat[])

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit bb5db7713d1ce0097b08095d6a9f8fc7b4d30863
Author: Mark Thomas 
AuthorDate: Mon Jul 29 21:34:34 2019 +0100

Deprecate FastHttpDateFormat.parseDate(String,DateFormat[])
---
 java/org/apache/tomcat/util/http/FastHttpDateFormat.java | 4 
 1 file changed, 4 insertions(+)

diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java 
b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
index ee7f780..1fdb9f6 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -150,7 +150,11 @@ public final class FastHttpDateFormat {
  * @param threadLocalformats Ignored. The local array of
  *   ConcurrentDateFormat will always be used.
  * @return the date as a long
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10
+ * Use {@link #parseDate(String)}
  */
+@Deprecated
 public static final long parseDate(String value, DateFormat[] 
threadLocalformats) {
 return parseDate(value);
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/07: Align with master. Deprecate

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 111f0d1b952e5c6f428fd809e5978a75be57c8c7
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:34:15 2019 +0100

Align with master. Deprecate

Use org.apache.tomcat.util.http.ConcurrentDateFormat instead
---
 java/org/apache/catalina/authenticator/AuthenticatorBase.java | 5 ++---
 java/org/apache/catalina/servlets/WebdavServlet.java  | 2 +-
 java/org/apache/catalina/util/ConcurrentDateFormat.java   | 4 
 java/org/apache/catalina/webresources/AbstractResource.java   | 6 +++---
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index 6c0e5b2..d505c28 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -19,7 +19,6 @@ package org.apache.catalina.authenticator;
 import java.io.IOException;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
-import java.util.Date;
 import java.util.Map;
 import java.util.Set;
 
@@ -55,7 +54,6 @@ import 
org.apache.catalina.authenticator.jaspic.MessageInfoImpl;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.catalina.realm.GenericPrincipal;
-import org.apache.catalina.util.ConcurrentDateFormat;
 import org.apache.catalina.util.SessionIdGeneratorBase;
 import org.apache.catalina.util.StandardSessionIdGenerator;
 import org.apache.catalina.valves.ValveBase;
@@ -65,6 +63,7 @@ import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.descriptor.web.LoginConfig;
 import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -93,7 +92,7 @@ public abstract class AuthenticatorBase extends ValveBase
 /**
  * "Expires" header always set to Date(1), so generate once only
  */
-private static final String DATE_ONE = 
ConcurrentDateFormat.formatRfc1123(new Date(1));
+private static final String DATE_ONE = FastHttpDateFormat.formatDate(1);
 
 private static final AuthConfigProvider NO_PROVIDER_AVAILABLE = new 
NoOpAuthConfigProvider();
 
diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index f820e7e..4c59ac2 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -43,11 +43,11 @@ import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.catalina.WebResource;
 import org.apache.catalina.connector.RequestFacade;
-import org.apache.catalina.util.ConcurrentDateFormat;
 import org.apache.catalina.util.DOMWriter;
 import org.apache.catalina.util.URLEncoder;
 import org.apache.catalina.util.XMLWriter;
 import org.apache.tomcat.util.buf.UDecoder;
+import org.apache.tomcat.util.http.ConcurrentDateFormat;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.security.ConcurrentMessageDigest;
diff --git a/java/org/apache/catalina/util/ConcurrentDateFormat.java 
b/java/org/apache/catalina/util/ConcurrentDateFormat.java
index 4042b95..7408938 100644
--- a/java/org/apache/catalina/util/ConcurrentDateFormat.java
+++ b/java/org/apache/catalina/util/ConcurrentDateFormat.java
@@ -27,7 +27,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
  * A thread safe wrapper around {@link SimpleDateFormat} that does not make use
  * of ThreadLocal and - broadly - only creates enough SimpleDateFormat objects
  * to satisfy the concurrency requirements.
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10.
+ * Use {@link org.apache.tomcat.util.http.ConcurrentDateFormat}
  */
+@Deprecated
 public class ConcurrentDateFormat {
 
 private final String format;
diff --git a/java/org/apache/catalina/webresources/AbstractResource.java 
b/java/org/apache/catalina/webresources/AbstractResource.java
index 4160a96..ad6e8b2 100644
--- a/java/org/apache/catalina/webresources/AbstractResource.java
+++ b/java/org/apache/catalina/webresources/AbstractResource.java
@@ -17,12 +17,11 @@
 package org.apache.catalina.webresources;
 
 import java.io.InputStream;
-import java.util.Date;
 
 import org.apache.catalina.WebResource;
 import org.apache.catalina.WebResourceRoot;
-import org.apache.catalina.util.ConcurrentDateFormat;
 import org.apache.juli.logging.Log;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.res.StringManager;
 
 public abstract class AbstractResource implements WebResource {
@@ -56,9 +55,10 @@ public ab

[tomcat] 05/07: Deprecate FastDateFormat.RFC1123_DATE

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 7e5f26343a26a4589b6910015eea987dccfb4be2
Author: Mark Thomas 
AuthorDate: Mon Jul 29 21:05:15 2019 +0100

Deprecate FastDateFormat.RFC1123_DATE
---
 java/org/apache/catalina/connector/Request.java | 10 +-
 java/org/apache/catalina/connector/Response.java| 21 +
 .../apache/tomcat/util/http/FastHttpDateFormat.java |  3 +++
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/catalina/connector/Request.java 
b/java/org/apache/catalina/connector/Request.java
index 1e95e74..c58cda1 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -167,6 +167,10 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 
 // - Variables
 
+/**
+ * @deprecated Unused. This will be removed in Tomcat 10.
+ */
+@Deprecated
 protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
 
 
@@ -187,9 +191,13 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
  *
  * Notice that because SimpleDateFormat is not thread-safe, we can't
  * declare formats[] as a static variable.
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10
  */
+@Deprecated
 protected final SimpleDateFormat formats[];
 
+@Deprecated
 private static final SimpleDateFormat formatsTemplate[] = {
 new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, Locale.US),
 new SimpleDateFormat("EE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
@@ -2223,7 +2231,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 }
 
 // Attempt to convert the date header in a variety of formats
-long result = FastHttpDateFormat.parseDate(value, formats);
+long result = FastHttpDateFormat.parseDate(value);
 if (result != (-1L)) {
 return result;
 }
diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index b3c4f13..7410d5a 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -32,7 +32,6 @@ import java.util.Collection;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
-import java.util.TimeZone;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.ServletResponse;
@@ -91,7 +90,10 @@ public class Response implements HttpServletResponse {
 
 /**
  * The date format we will use for creating date headers.
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10
  */
+@Deprecated
 protected SimpleDateFormat format = null;
 
 
@@ -1003,14 +1005,7 @@ public class Response implements HttpServletResponse {
 return;
 }
 
-if (format == null) {
-format = new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE,
-  Locale.US);
-format.setTimeZone(TimeZone.getTimeZone("GMT"));
-}
-
-addHeader(name, FastHttpDateFormat.formatDate(value, format));
-
+addHeader(name, FastHttpDateFormat.formatDate(value));
 }
 
 
@@ -1366,13 +1361,7 @@ public class Response implements HttpServletResponse {
 return;
 }
 
-if (format == null) {
-format = new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE,
-  Locale.US);
-format.setTimeZone(TimeZone.getTimeZone("GMT"));
-}
-
-setHeader(name, FastHttpDateFormat.formatDate(value, format));
+setHeader(name, FastHttpDateFormat.formatDate(value));
 }
 
 
diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java 
b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
index 86376d2..dd9bd2b 100644
--- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
+++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
@@ -41,7 +41,10 @@ public final class FastHttpDateFormat {
 
 /**
  * The only date format permitted when generating HTTP headers.
+ *
+ * @deprecated Unused. This will be removed in Tomcat 10.
  */
+@Deprecated
 public static final String RFC1123_DATE = "EEE, dd MMM  HH:mm:ss zzz";
 
 // HTTP date formats


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated (276450e -> bb5db77)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 276450e  Refactor to aid re-use
 new 56a1cae  Prep for additional backports. Align with master (excluding 
deprecation)
 new 2182c04  Align with master
 new 111f0d1  Align with master. Deprecate
 new 6025ef7  Align with master. Spacing, Javadoc, remove unnecessary (...)
 new 7e5f263  Deprecate FastDateFormat.RFC1123_DATE
 new dedb056  Deprecate FastHttpDateFormat.formatDate(long, DateFormat)
 new bb5db77  Deprecate FastHttpDateFormat.parseDate(String,DateFormat[])

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../catalina/authenticator/AuthenticatorBase.java  |   5 +-
 java/org/apache/catalina/connector/Request.java|  13 ++-
 java/org/apache/catalina/connector/Response.java   |  45 +++-
 .../apache/catalina/servlets/WebdavServlet.java|  10 +-
 .../apache/catalina/util/ConcurrentDateFormat.java |   4 +
 .../catalina/webresources/AbstractResource.java|   6 +-
 .../apache/catalina/webresources/FileResource.java |   2 +-
 .../catalina/webresources/JarWarResourceSet.java   |   2 +-
 .../catalina/webresources/LocalStrings.properties  |   3 +-
 .../webresources}/LocalStrings_es.properties   |  11 +-
 .../webresources/LocalStrings_fr.properties|  59 ++
 .../webresources/LocalStrings_ja.properties|  59 ++
 .../util/http}/ConcurrentDateFormat.java   |  29 +++--
 .../tomcat/util/http/FastHttpDateFormat.java   | 128 ++---
 14 files changed, 243 insertions(+), 133 deletions(-)
 copy java/{javax/servlet => 
org/apache/catalina/webresources}/LocalStrings_es.properties (55%)
 create mode 100644 
java/org/apache/catalina/webresources/LocalStrings_fr.properties
 create mode 100644 
java/org/apache/catalina/webresources/LocalStrings_ja.properties
 copy java/org/apache/{catalina/util => 
tomcat/util/http}/ConcurrentDateFormat.java (79%)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated (cbf8b3a -> f78fedc)

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from cbf8b3a  Add missing doc.
 new c25615a  Polish
 new 448fcaf  Polish
 new f78fedc  Polish

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/connector/Response.java   | 7 ---
 java/org/apache/catalina/servlets/WebdavServlet.java   | 2 +-
 java/org/apache/tomcat/util/http/ConcurrentDateFormat.java | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/03: Polish

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit c25615a34af6164c12c8d00ab701ccad75e7c44f
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:16:45 2019 +0100

Polish
---
 java/org/apache/tomcat/util/http/ConcurrentDateFormat.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java 
b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
index b773704..9ce953f 100644
--- a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
+++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
@@ -36,8 +36,7 @@ public class ConcurrentDateFormat {
 private final TimeZone timezone;
 private final Queue queue = new 
ConcurrentLinkedQueue<>();
 
-public ConcurrentDateFormat(String format, Locale locale,
-TimeZone timezone) {
+public ConcurrentDateFormat(String format, Locale locale, TimeZone 
timezone) {
 this.format = format;
 this.locale = locale;
 this.timezone = timezone;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/03: Polish

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 448fcaff187acc6c375622c929fd2969d94658e4
Author: Mark Thomas 
AuthorDate: Mon Jul 29 20:52:02 2019 +0100

Polish
---
 java/org/apache/catalina/connector/Response.java | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 8fefce9..d06a46c 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -868,7 +868,7 @@ public class Response implements HttpServletResponse {
 public Collection getHeaderNames() {
 MimeHeaders headers = getCoyoteResponse().getMimeHeaders();
 int n = headers.size();
-ArrayList result = new ArrayList<>(n);
+List result = new ArrayList<>(n);
 for (int i = 0; i < n; i++) {
 result.add(headers.getName(i).toString());
 }
@@ -881,7 +881,7 @@ public class Response implements HttpServletResponse {
 public Collection getHeaders(String name) {
 Enumeration enumeration =
 getCoyoteResponse().getMimeHeaders().values(name);
-ArrayList result = new ArrayList<>();
+List result = new ArrayList<>();
 while (enumeration.hasMoreElements()) {
 result.add(enumeration.nextElement());
 }
@@ -1393,8 +1393,9 @@ public class Response implements HttpServletResponse {
 
 char cc=name.charAt(0);
 if (cc=='C' || cc=='c') {
-if (checkSpecialHeader(name, value))
+if (checkSpecialHeader(name, value)) {
 return;
+}
 }
 
 getCoyoteResponse().setHeader(name, value);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/03: Polish

2019-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit f78fedc9d02c649c1d4ccd5681573c2fd432dbcc
Author: Mark Thomas 
AuthorDate: Mon Jul 29 21:31:36 2019 +0100

Polish
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 1fafd73..ef5573d 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2152,7 +2152,7 @@ public class WebdavServlet extends DefaultServlet {
 String property = properties.nextElement();
 
 if (property.equals("creationdate")) {
-generatedXML.writeProperty ("D", "creationdate", 
getISOCreationDate(created));
+generatedXML.writeProperty("D", "creationdate", 
getISOCreationDate(created));
 } else if (property.equals("displayname")) {
 generatedXML.writeElement("D", "displayname", 
XMLWriter.OPENING);
 generatedXML.writeData(resourceName);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Add missing doc.

2019-07-30 Thread jfclere
This is an automated email from the ASF dual-hosted git repository.

jfclere pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new cbf8b3a  Add missing doc.
cbf8b3a is described below

commit cbf8b3a2e6e4ae267e57068ef24db2a68766bd3c
Author: Jean-Frederic Clere 
AuthorDate: Tue Jul 30 15:04:14 2019 +0200

Add missing doc.
---
 webapps/docs/config/valve.xml | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 27125b1..06dae09 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -2088,6 +2088,37 @@
 
 
 
+
+
+  
+
+The Health Check Valve responds to
+cloud orchestrators health checks
+  
+
+  
+
+The Health Check Valve supports the
+following configuration attributes:
+
+
+
+  
+Java class name of the implementation to use.  This MUST be set to
+org.apache.catalina.valves.HealthCheckValve.
+  
+
+  
+Path by the cloud orchestrators health check logic.
+The default value is /health.
+  
+
+
+
+  
+
+
+
 
 
 


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 63612] PooledConnection#connectUsingDriver, Thread.currentThread().getContextClassLoader() may be null

2019-07-30 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63612

--- Comment #6 from Konstantin Kolinko  ---
1. If "Thread.currentThread().getContextClassLoader()" is null, it essentially
means that this thread is not associated with a web application.

(Thus it cannot access the classes provided by web application, cannot use log
configuration specific to this web application and so on).


2. ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56) does a loop over an array
of ClassLoaders.

The following line

   throw new ClassNotFoundException("Classloader is null");

just simulates a ClassNotFoundException that is is thrown in the non-null
branch (by the "Class.forName(..)" call) when the class is not found.

3. The TCCL is the last ClassLoader in the array, so there are no more
classloaders to try.


The handling of the null value may be improved, but I see nothing more than
providing a different error message. The result will be the same
ClassNotFoundException.

I guess that this is not what you are looking for.


1. I think that you can avoid this error if you put the database driver into
the same classloader where tomcat-jdbc.jar was loaded from. That is: into the
"lib" directory of Tomcat, like people did in the good old times.

(I guess that you bundled the database driver with you web application.)

2. You would better find the rood cause behind the null TCCL in that thread.

Even if you avoid the driver loading issue, the thread may experience other
oddities. What comes to mind:
- a wrong logging configuration,
- being unable to access JNDI directory.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: PooledConnection#connectUsingDriver, Thread.currentThread().getContextClassLoader() is null

2019-07-30 Thread Romain Manni-Bucau
Yes, got caught by PooledConnection.class.getClassLoader() which tries to
load the driver from tomcat/lib first (common.loader actually) so if you
put your driver there it will work in your case. Stays the bug when the
driver is only in the webapp.


Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le mar. 30 juil. 2019 à 13:30, Clemens Wyss DEV  a
écrit :

> > recent tomcat version
>
> 9.0.22 has the same class loading code as 8.5.35
>
>
> https://jar-download.com/artifacts/org.apache.tomcat/tomcat-jdbc/9.0.22/source-code/org/apache/tomcat/jdbc/pool/PooledConnection.java
>
> driver = (java.sql.Driver)
>
> ClassLoaderUtil.*loadClass*(
>
> poolProperties.getDriverClassName(),
>
> PooledConnection.*class*.getClassLoader(),
>
> Thread.*currentThread*
> ().getContextClassLoader()
>
> ).getConstructor().newInstance();
>
>
>
>
>
> *Von:* Romain Manni-Bucau 
> *Gesendet:* Montag, 29. Juli 2019 09:35
> *An:* Tomcat Developers List 
> *Betreff:* Re: PooledConnection#connectUsingDriver,
> Thread.currentThread().getContextClassLoader() is null
>
>
>
> Can you give a try on a more recent tomcat version? Seems it works with
> master version since the tomcat-jdbc module classloader is tried first
> before the tccl?
>
> Tested with:
>
>
>
> *public class *PooledConnectionTest {
> @Test
> *public void *avoidNPEWhenTcclIsNull() *throws *SQLException {
> *final *PoolProperties poolProperties = *new *PoolProperties();
> poolProperties.setDriverClassName(*"org.h2.Driver"*);
> poolProperties.setUsername(*"sa"*);
> poolProperties.setPassword(*""*);
> 
> poolProperties.setUrl(*"jdbc:h2:mem:PooledConnectionTest_avoidNPEWhenTcclIsNull"*);
> poolProperties.setMaxIdle(1);
> poolProperties.setMinIdle(1);
> poolProperties.setInitialSize(1);
> poolProperties.setMaxActive(1);
>
> ensureDataSourceIsValid(poolProperties);
>
> *final *Thread thread = Thread.*currentThread*();
> *final *ClassLoader testLoader = thread.getContextClassLoader();
> thread.setContextClassLoader(*null*);
> *try *{
> ensureDataSourceIsValid(poolProperties);
> } *finally *{
> thread.setContextClassLoader(testLoader);
> }
> }
>
> *private void *ensureDataSourceIsValid(*final *PoolProperties 
> poolProperties) *throws *SQLException {
> *final *DataSource dataSource = *new *DataSource(poolProperties);
> *try *(*final *Connection connection = dataSource.getConnection()) {
> *assertTrue*(connection.isValid(5));
> } *finally *{
> dataSource.close();
> }
> }
> }
>
>
> Romain Manni-Bucau
> @rmannibucau  |  Blog
>  | Old Blog
>  | Github
>  | LinkedIn
>  | Book
> 
>
>
>
>
>
> Le lun. 29 juil. 2019 à 07:36, Clemens Wyss DEV  a
> écrit :
>
> https://bz.apache.org/bugzilla/show_bug.cgi?id=63612
>
>
> > with a small project reproducing it?
>
> Unfortunately not easily extractable/reproducible
>
> Maybe :
>
> th = new Thread() {
> @Override
>
> public void run() {
> « do something that requires a connection from the pool »
>
> }
> } ;
> th.set getContextClassLoader( null ) ;
> th.run() ;
>
>
>
> *Von:* Romain Manni-Bucau 
> *Gesendet:* Donnerstag, 25. Juli 2019 08:06
> *An:* Tomcat Developers List 
> *Betreff:* Re: PooledConnection#connectUsingDriver,
> Thread.currentThread().getContextClassLoader() is null
>
>
>
>
>
> Le jeu. 25 juil. 2019 à 07:46, Clemens Wyss DEV  a
> écrit :
>
> < mais c'était rapide 😉 >
> >+1
> should/can I file a bug?
>
>
>
> Guess so, with a small project reproducing it?
>
>
>
>
> > init at bootstrap the pool (initial size) to ensure it is in one tomcat
> classloader
> how would you achieve this? By setting «initialSize» to «maxSize» in
> PoolProperties?
>
>
>
> 1 should be sufficient, however tomcat-jdbc (vs dbcp2 for instance) loads
> it per connection and not once for all the pool (
> https://github.com/apache/tomcat/blob/master/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java#L196)
> which is likely 1. Bad for perf but moreover 2. Buggy if the classloader
> changes between usages of a connection in apps. Loader, driver should be
> loaded once and potentially the datasource be duplicated per app if needed
> (driver i

[Bug 63612] PooledConnection#connectUsingDriver, Thread.currentThread().getContextClassLoader() may be null

2019-07-30 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63612

--- Comment #5 from clemens...@mysign.ch ---
>Um... why would you do such a thing?
for the unit test only to force Thread.currentThread().getContextClassLoader()
to be null ;-)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



AW: PooledConnection#connectUsingDriver, Thread.currentThread().getContextClassLoader() is null

2019-07-30 Thread Clemens Wyss DEV
> recent tomcat version
9.0.22 has the same class loading code as 8.5.35
https://jar-download.com/artifacts/org.apache.tomcat/tomcat-jdbc/9.0.22/source-code/org/apache/tomcat/jdbc/pool/PooledConnection.java

driver = (java.sql.Driver)
ClassLoaderUtil.loadClass(
poolProperties.getDriverClassName(),
PooledConnection.class.getClassLoader(),
Thread.currentThread().getContextClassLoader()
).getConstructor().newInstance();


Von: Romain Manni-Bucau 
Gesendet: Montag, 29. Juli 2019 09:35
An: Tomcat Developers List 
Betreff: Re: PooledConnection#connectUsingDriver, 
Thread.currentThread().getContextClassLoader() is null

Can you give a try on a more recent tomcat version? Seems it works with master 
version since the tomcat-jdbc module classloader is tried first before the tccl?
Tested with:


public class PooledConnectionTest {
@Test
public void avoidNPEWhenTcclIsNull() throws SQLException {
final PoolProperties poolProperties = new PoolProperties();
poolProperties.setDriverClassName("org.h2.Driver");
poolProperties.setUsername("sa");
poolProperties.setPassword("");

poolProperties.setUrl("jdbc:h2:mem:PooledConnectionTest_avoidNPEWhenTcclIsNull");
poolProperties.setMaxIdle(1);
poolProperties.setMinIdle(1);
poolProperties.setInitialSize(1);
poolProperties.setMaxActive(1);

ensureDataSourceIsValid(poolProperties);

final Thread thread = Thread.currentThread();
final ClassLoader testLoader = thread.getContextClassLoader();
thread.setContextClassLoader(null);
try {
ensureDataSourceIsValid(poolProperties);
} finally {
thread.setContextClassLoader(testLoader);
}
}

private void ensureDataSourceIsValid(final PoolProperties poolProperties) 
throws SQLException {
final DataSource dataSource = new DataSource(poolProperties);
try (final Connection connection = dataSource.getConnection()) {
assertTrue(connection.isValid(5));
} finally {
dataSource.close();
}
}
}

Romain Manni-Bucau
@rmannibucau |  
Blog | Old 
Blog | Github 
| LinkedIn | 
Book


Le lun. 29 juil. 2019 à 07:36, Clemens Wyss DEV 
mailto:clemens...@mysign.ch>> a écrit :
https://bz.apache.org/bugzilla/show_bug.cgi?id=63612

> with a small project reproducing it?
Unfortunately not easily extractable/reproducible

Maybe :

th = new Thread() {
@Override
public void run() {
« do something that requires a connection from the pool »
}
} ;
th.set getContextClassLoader( null ) ;
th.run() ;

Von: Romain Manni-Bucau mailto:rmannibu...@gmail.com>>
Gesendet: Donnerstag, 25. Juli 2019 08:06
An: Tomcat Developers List mailto:dev@tomcat.apache.org>>
Betreff: Re: PooledConnection#connectUsingDriver, 
Thread.currentThread().getContextClassLoader() is null


Le jeu. 25 juil. 2019 à 07:46, Clemens Wyss DEV 
mailto:clemens...@mysign.ch>> a écrit :
< mais c'était rapide 😉 >
>+1
should/can I file a bug?

Guess so, with a small project reproducing it?


> init at bootstrap the pool (initial size) to ensure it is in one tomcat 
> classloader
how would you achieve this? By setting «initialSize» to «maxSize» in 
PoolProperties?

1 should be sufficient, however tomcat-jdbc (vs dbcp2 for instance) loads it 
per connection and not once for all the pool 
(https://github.com/apache/tomcat/blob/master/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java#L196)
 which is likely 1. Bad for perf but moreover 2. Buggy if the classloader 
changes between usages of a connection in apps. Loader, driver should be loaded 
once and potentially the datasource be duplicated per app if needed (driver in 
the app) IMHO. This would also fix your NPE transitively ;).




--
Von: Romain Manni-Bucau mailto:rmannibu...@gmail.com>>
Gesendet: Donnerstag, 25. Juli 2019 07:30
An: Tomcat Developers List mailto:dev@tomcat.apache.org>>
Betreff: Re: PooledConnection#connectUsingDriver, 
Thread.currentThread().getContextClassLoader() is null

+1, there is no real other option AFAIK until you init at bootstrap the pool 
(initial size) to ensure it is in one tomcat classloader.

Le jeu. 25 juil. 2019 à 07:08, Clemens Wyss DEV 
> a écrit :
I tried posting this in the tomcat-users-ml, but I guess it rather fits here:
--
Context:
Debian GNU/Linux 9 \n \l
java version 1.8.0_162
Tomcat 8.5.35

From time to time we a

Re: tcnative and JDK13/14

2019-07-30 Thread Rainer Jung

The HotSpot runtime team is investigating it. It was a surprise for them.

New ticket opened by David Holmes:

https://bugs.openjdk.java.net/browse/JDK-8228764

Mail thread starts at:

https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2019-July/035431.html

Original implementation ticket:

https://bugs.openjdk.java.net/browse/JDK-8222720

Backport to OpenJDK 11 (for 11.0.5, not yet released):

https://bugs.openjdk.java.net/browse/JDK-8226873

Regards,

Rainer

Am 29.07.2019 um 23:45 schrieb Rainer Jung:

OpenJDK 13/14 introduced change fb5b3981eac:

8222720: Provide extended VMWare/vSphere virtualization related info in 
the hs_error file on linux/windows x86_64


On SLES 12 (maybe also other Linuxes) the impl loads 
/usr/lib64/libguestlib.so.0 already during JVM startup. That library 
depends on /usr/lib64/libvmtools.so.0, which in turn depends on a lot of 
other libraries:


   NEEDED   libdnet.so.1
   NEEDED   libglib-2.0.so.0
   NEEDED   libicui18n.so.52.1
   NEEDED   libicuuc.so.52.1
   NEEDED   libpthread.so.0
   NEEDED   libdl.so.2
   NEEDED   libssl.so.1.0.0
   NEEDED   libcrypto.so.1.0.0
   NEEDED   libc.so.6
   NEEDED   ld-linux-x86-64.so.2
   NEEDED   libgcc_s.so.1

When building tcnative against OpenSSL 1.0.x, the JVM has already loaded 
OpenSSL 1.0 system libs via the above dependency and will not load our 
tcnative dependency. This lead to a subtle failure in my case:


/usr/local/jdk13/bin/java: symbol lookup error: 
/path/to/lib/libtcnative-1.so.0.2.23: undefined symbol: 
SSL_COMP_free_compression_methods


Even worse could be using OpenSSL 1.1.x for tcnative. Then the JVM would 
load the 1.0.x version, tcnative would load the 1.1.x version but 
symbols that exist in both would be resolved by the runtime linker in 
the older version, because it was loaded first (default symbol search 
order). All of that can be worked around by non-default linking tricks, 
but I wanted to point out this new behavior.


I have written to hotspot-runtime-...@openjdk.java.net about these new 
dependencies and potential problems.


Regards,

Rainer


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org