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 b5c04d5e369d37599a7f9547a2eae944e8b9240d Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Jul 29 10:49:01 2019 +0100 Align with master. Back-port i18n support. --- .../valves/rewrite/LocalStrings.properties | 20 +++++++++++++++++ .../valves/rewrite/LocalStrings_fr.properties | 20 +++++++++++++++++ .../valves/rewrite/LocalStrings_ja.properties | 20 +++++++++++++++++ .../catalina/valves/rewrite/RewriteValve.java | 26 +++++++++++----------- 4 files changed, 73 insertions(+), 13 deletions(-) diff --git a/java/org/apache/catalina/valves/rewrite/LocalStrings.properties b/java/org/apache/catalina/valves/rewrite/LocalStrings.properties new file mode 100644 index 0000000..63ecfb3 --- /dev/null +++ b/java/org/apache/catalina/valves/rewrite/LocalStrings.properties @@ -0,0 +1,20 @@ +# 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. + +rewriteValve.closeError=Error closing configuration +rewriteValve.invalidFlags=Invalid flag in [{0}] flags [{1}] +rewriteValve.invalidLine=Invalid line [{0}] +rewriteValve.invalidMapClassName=Invalid map class name [{0}] +rewriteValve.readError=Error reading configuration diff --git a/java/org/apache/catalina/valves/rewrite/LocalStrings_fr.properties b/java/org/apache/catalina/valves/rewrite/LocalStrings_fr.properties new file mode 100644 index 0000000..aac8da4 --- /dev/null +++ b/java/org/apache/catalina/valves/rewrite/LocalStrings_fr.properties @@ -0,0 +1,20 @@ +# 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. + +rewriteValve.closeError=Erreur lors de la fermeture de la configuration +rewriteValve.invalidFlags=Indicateur invalide dans [{0}] indicateurs [{1}] +rewriteValve.invalidLine=Ligne invalide [{0}] +rewriteValve.invalidMapClassName=Le nom de la classe [{0}] de la structure est invalide +rewriteValve.readError=Erreur lors de la lecture de la configuration diff --git a/java/org/apache/catalina/valves/rewrite/LocalStrings_ja.properties b/java/org/apache/catalina/valves/rewrite/LocalStrings_ja.properties new file mode 100644 index 0000000..88604f1 --- /dev/null +++ b/java/org/apache/catalina/valves/rewrite/LocalStrings_ja.properties @@ -0,0 +1,20 @@ +# 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. + +rewriteValve.closeError=構成を閉じる際のエラー +rewriteValve.invalidFlags=[{0}]に無効なフラグ [{1}]があります。 +rewriteValve.invalidLine=無効な行[{0}] +rewriteValve.invalidMapClassName=Mapクラス名[{0}]が無効です。 +rewriteValve.readError=構成の読み取りエラー diff --git a/java/org/apache/catalina/valves/rewrite/RewriteValve.java b/java/org/apache/catalina/valves/rewrite/RewriteValve.java index 52996a4..284a585 100644 --- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java +++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java @@ -188,12 +188,12 @@ public class RewriteValve extends ValveBase { BufferedReader reader = new BufferedReader(isr)) { parse(reader); } catch (IOException ioe) { - containerLog.error("Error closing configuration", ioe); + containerLog.error(sm.getString("rewriteValve.closeError"), ioe); } finally { try { is.close(); } catch (IOException e) { - containerLog.error("Error closing configuration", e); + containerLog.error(sm.getString("rewriteValve.closeError"), e); } } @@ -273,7 +273,7 @@ public class RewriteValve extends ValveBase { } } } catch (IOException e) { - containerLog.error("Error reading configuration", e); + containerLog.error(sm.getString("rewriteValve.readError"), e); } } this.rules = rules.toArray(new RewriteRule[0]); @@ -638,7 +638,7 @@ public class RewriteValve extends ValveBase { // RewriteCond TestString CondPattern [Flags] RewriteCond condition = new RewriteCond(); if (tokenizer.countTokens() < 2) { - throw new IllegalArgumentException("Invalid line: " + line); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidLine", line)); } condition.setTestString(tokenizer.nextToken()); condition.setCondPattern(tokenizer.nextToken()); @@ -658,7 +658,7 @@ public class RewriteValve extends ValveBase { // RewriteRule Pattern Substitution [Flags] RewriteRule rule = new RewriteRule(); if (tokenizer.countTokens() < 2) { - throw new IllegalArgumentException("Invalid line: " + line); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidLine", line)); } rule.setPatternString(tokenizer.nextToken()); rule.setSubstitutionString(tokenizer.nextToken()); @@ -677,7 +677,7 @@ public class RewriteValve extends ValveBase { } else if (token.equals("RewriteMap")) { // RewriteMap name rewriteMapClassName whateverOptionalParameterInWhateverFormat if (tokenizer.countTokens() < 2) { - throw new IllegalArgumentException("Invalid line: " + line); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidLine", line)); } String name = tokenizer.nextToken(); String rewriteMapClassName = tokenizer.nextToken(); @@ -686,7 +686,7 @@ public class RewriteValve extends ValveBase { map = (RewriteMap) (Class.forName( rewriteMapClassName).getConstructor().newInstance()); } catch (Exception e) { - throw new IllegalArgumentException("Invalid map className: " + line); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidMapClassName", line)); } if (tokenizer.hasMoreTokens()) { map.setParameters(tokenizer.nextToken()); @@ -698,7 +698,7 @@ public class RewriteValve extends ValveBase { } else if (token.startsWith("#")) { // it's a comment, ignore it } else { - throw new IllegalArgumentException("Invalid line: " + line); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidLine", line)); } } return null; @@ -717,7 +717,7 @@ public class RewriteValve extends ValveBase { } else if (flag.equals("OR") || flag.equals("ornext")) { condition.setOrnext(true); } else { - throw new IllegalArgumentException("Invalid flag in: " + line + " flags: " + flag); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidFlags", line, flag)); } } @@ -742,7 +742,7 @@ public class RewriteValve extends ValveBase { } StringTokenizer tokenizer = new StringTokenizer(flag, ":"); if (tokenizer.countTokens() < 2) { - throw new IllegalArgumentException("Invalid flag in: " + line); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidFlags", line, flag)); } rule.setCookieName(tokenizer.nextToken()); rule.setCookieValue(tokenizer.nextToken()); @@ -753,7 +753,7 @@ public class RewriteValve extends ValveBase { try { rule.setCookieLifetime(Integer.parseInt(tokenizer.nextToken())); } catch (NumberFormatException e) { - throw new IllegalArgumentException("Invalid flag in: " + line, e); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidFlags", line, flag), e); } } if (tokenizer.hasMoreTokens()) { @@ -774,7 +774,7 @@ public class RewriteValve extends ValveBase { } int pos = flag.indexOf(':'); if (pos == -1 || (pos + 1) == flag.length()) { - throw new IllegalArgumentException("Invalid flag in: " + line); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidFlags", line, flag)); } rule.addEnvName(flag.substring(0, pos)); rule.addEnvValue(flag.substring(pos + 1)); @@ -839,7 +839,7 @@ public class RewriteValve extends ValveBase { rule.setType(true); rule.setTypeValue(flag); } else { - throw new IllegalArgumentException("Invalid flag in: " + line + " flag: " + flag); + throw new IllegalArgumentException(sm.getString("rewriteValve.invalidFlags", line, flag)); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org