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 2018/11/15 10:50:52 UTC
svn commit: r1846635 - in
/tomcat/trunk/java/org/apache/tomcat/util/http/parser: HttpParser.java
LocalStrings.properties
Author: markt
Date: Thu Nov 15 10:50:52 2018
New Revision: 1846635
URL: http://svn.apache.org/viewvc?rev=1846635&view=rev
Log:
Make the error messages l10n friendly
Modified:
tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java
tomcat/trunk/java/org/apache/tomcat/util/http/parser/LocalStrings.properties
Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1846635&r1=1846634&r2=1846635&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java Thu Nov 15 10:50:52 2018
@@ -862,27 +862,27 @@ public class HttpParser {
private enum DomainParseState {
- NEW( true, false, false, false, " at the start of"),
- ALPHA( true, true, true, true, " after a letter in"),
- NUMERIC( true, true, true, true, " after a number in"),
- PERIOD( true, false, false, true, " after a period in"),
- HYPHEN( true, true, false, false, " after a hypen in"),
- COLON( false, false, false, false, " after a colon in"),
- END( false, false, false, false, " at the end of");
+ NEW( true, false, false, false, "http.invalidCharacterDomain.atStart"),
+ ALPHA( true, true, true, true, "http.invalidCharacterDomain.afterLetter"),
+ NUMERIC( true, true, true, true, "http.invalidCharacterDomain.afterNumber"),
+ PERIOD( true, false, false, true, "http.invalidCharacterDomain.afterPeriod"),
+ HYPHEN( true, true, false, false, "http.invalidCharacterDomain.afterHyphen"),
+ COLON( false, false, false, false, "http.invalidCharacterDomain.afterColon"),
+ END( false, false, false, false, "http.invalidCharacterDomain.atEnd");
private final boolean mayContinue;
private final boolean allowsHyphen;
private final boolean allowsPeriod;
private final boolean allowsEnd;
- private final String errorLocation;
+ private final String errorMsg;
private DomainParseState(boolean mayContinue, boolean allowsHyphen, boolean allowsPeriod,
- boolean allowsEnd, String errorLocation) {
+ boolean allowsEnd, String errorMsg) {
this.mayContinue = mayContinue;
this.allowsHyphen = allowsHyphen;
this.allowsPeriod = allowsPeriod;
this.allowsEnd = allowsEnd;
- this.errorLocation = errorLocation;
+ this.errorMsg = errorMsg;
}
public boolean mayContinue() {
@@ -898,15 +898,15 @@ public class HttpParser {
if (allowsPeriod) {
return PERIOD;
} else {
- throw new IllegalArgumentException(sm.getString("http.invalidCharacterDomain",
- Character.toString((char) c), errorLocation));
+ throw new IllegalArgumentException(sm.getString(errorMsg,
+ Character.toString((char) c)));
}
} else if (c == ':') {
if (allowsEnd) {
return COLON;
} else {
- throw new IllegalArgumentException(sm.getString("http.invalidCharacterDomain",
- Character.toString((char) c), errorLocation));
+ throw new IllegalArgumentException(sm.getString(errorMsg,
+ Character.toString((char) c)));
}
} else if (c == -1) {
if (allowsEnd) {
@@ -919,8 +919,8 @@ public class HttpParser {
if (allowsHyphen) {
return HYPHEN;
} else {
- throw new IllegalArgumentException(sm.getString("http.invalidCharacterDomain",
- Character.toString((char) c), errorLocation));
+ throw new IllegalArgumentException(sm.getString(errorMsg,
+ Character.toString((char) c)));
}
} else {
throw new IllegalArgumentException(sm.getString(
Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/LocalStrings.properties?rev=1846635&r1=1846634&r2=1846635&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/LocalStrings.properties [UTF-8] (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/LocalStrings.properties [UTF-8] Thu Nov 15 10:50:52 2018
@@ -23,7 +23,13 @@ http.illegalAfterIpv6=The character [{0}
http.illegalCharacterDomain=The character [{0}] is never valid in a domain name.
http.illegalCharacterIpv4=The character [{0}] is never valid in an IPv4 address.
http.illegalCharacterIpv6=The character [{0}] is never valid in an IPv6 address.
-http.invalidCharacterDomain=The character [{0}] is not valid{1} a domain name.
+http.invalidCharacterDomain.afterColon=The character [{0}] is not valid after a colon in a domain name.
+http.invalidCharacterDomain.afterHyphen=The character [{0}] is not valid after a hyphen in a domain name.
+http.invalidCharacterDomain.afterLetter=The character [{0}] is not valid after a letter in a domain name.
+http.invalidCharacterDomain.afterNumber=The character [{0}] is not valid after a number in a domain name.
+http.invalidCharacterDomain.afterPeriod=The character [{0}] is not valid after a period in a domain name.
+http.invalidCharacterDomain.atEnd=The character [{0}] is not valid at the end of a domain name.
+http.invalidCharacterDomain.atStart=The character [{0}] is not valid at the start of a domain name.
http.invalidHextet=Invalid hextet. A hextet must consist of 4 or less hex characters.
http.invalidIpv4Location=The IPv6 address contains an embedded IPv4 address at an invalid location.
http.invalidLeadingZero=An non-zero IPv4 octet may not contain a leading zero.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org