You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/02/28 20:36:19 UTC
svn commit: r1662993 - in /tomcat/tc7.0.x/trunk:
java/org/apache/catalina/connector/Request.java webapps/docs/changelog.xml
Author: markt
Date: Sat Feb 28 19:36:19 2015
New Revision: 1662993
URL: http://svn.apache.org/r1662993
Log: (empty)
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java?rev=1662993&r1=1662992&r2=1662993&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java Sat Feb 28 19:36:19 2015
@@ -85,6 +85,7 @@ import org.apache.tomcat.util.buf.B2CCon
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.buf.UDecoder;
+import org.apache.tomcat.util.compat.JreCompat;
import org.apache.tomcat.util.http.Cookies;
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.Parameters;
@@ -3346,6 +3347,8 @@ public class Request
parser.setString(value);
}
+ JreCompat jreCompat = JreCompat.getInstance();
+
// Process each comma-delimited language specification
int length = parser.getLength();
while (true) {
@@ -3386,33 +3389,11 @@ public class Request
continue; // FIXME - "*" entries are not handled
}
- // Extract the language and country for this entry
- String language = null;
- String country = null;
- String variant = null;
- int dash = entry.indexOf('-');
- if (dash < 0) {
- language = entry;
- country = "";
- variant = "";
- } else {
- language = entry.substring(0, dash);
- country = entry.substring(dash + 1);
- int vDash = country.indexOf('-');
- if (vDash > 0) {
- String cTemp = country.substring(0, vDash);
- variant = country.substring(vDash + 1);
- country = cTemp;
- } else {
- variant = "";
- }
- }
- if (!isAlpha(language) || !isAlpha(country) || !isAlpha(variant)) {
+ Locale locale = jreCompat.forLanguageTag(entry);
+ if (locale == null) {
continue;
}
- // Add a new Locale to the list of Locales for this quality level
- Locale locale = new Locale(language, country, variant);
Double key = new Double(-quality); // Reverse the order
ArrayList<Locale> values = locales.get(key);
if (values == null) {
@@ -3424,17 +3405,6 @@ public class Request
}
- protected static final boolean isAlpha(String value) {
- for (int i = 0; i < value.length(); i++) {
- char c = value.charAt(i);
- if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) {
- return false;
- }
- }
- return true;
- }
-
-
// ----------------------------------------------------- Special attributes handling
private static interface SpecialAttributeAdapter {
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1662993&r1=1662992&r2=1662993&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sat Feb 28 19:36:19 2015
@@ -71,6 +71,10 @@
cipher suite ordering. This feature requires Java 8.
Based upon patches provided by Ognjen Blagojevic. (schultz)
</fix>
+ <fix>
+ <bug>56848</bug>: Use <code>Locale.forLanguageTag</code> to process
+ Locale headers when running on a Java 7 or later JRE. (markt)
+ </fix>
<add>
<bug>57021</bug>: Improve logging in AprLifecycleListener and
jni.Library when Tomcat-Native DLL fails to load. Based on a patch by
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org