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 2017/05/30 08:31:32 UTC
svn commit: r1796789 -
/tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java
Author: markt
Date: Tue May 30 08:31:32 2017
New Revision: 1796789
URL: http://svn.apache.org/viewvc?rev=1796789&view=rev
Log:
Simplify with varargs
Modified:
tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java?rev=1796789&r1=1796788&r2=1796789&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java Tue May 30 08:31:32 2017
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.jasper.compiler;
import java.text.MessageFormat;
@@ -35,8 +34,7 @@ public class Localizer {
static {
try {
- bundle = ResourceBundle.getBundle(
- "org.apache.jasper.resources.LocalStrings");
+ bundle = ResourceBundle.getBundle("org.apache.jasper.resources.LocalStrings");
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
t.printStackTrace();
@@ -71,83 +69,11 @@ public class Localizer {
* localized error messages, it is used as the error message.
*
* @param errCode Error code to localize
- * @param arg Argument for parametric replacement
- *
- * @return Localized error message
- */
- public static String getMessage(String errCode, String arg) {
- return getMessage(errCode, new Object[] {arg});
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- * @param arg1 First argument for parametric replacement
- * @param arg2 Second argument for parametric replacement
- *
- * @return Localized error message
- */
- public static String getMessage(String errCode, String arg1, String arg2) {
- return getMessage(errCode, new Object[] {arg1, arg2});
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- * @param arg1 First argument for parametric replacement
- * @param arg2 Second argument for parametric replacement
- * @param arg3 Third argument for parametric replacement
- *
- * @return Localized error message
- */
- public static String getMessage(String errCode, String arg1, String arg2,
- String arg3) {
- return getMessage(errCode, new Object[] {arg1, arg2, arg3});
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- * @param arg1 First argument for parametric replacement
- * @param arg2 Second argument for parametric replacement
- * @param arg3 Third argument for parametric replacement
- * @param arg4 Fourth argument for parametric replacement
- *
- * @return Localized error message
- */
- public static String getMessage(String errCode, String arg1, String arg2,
- String arg3, String arg4) {
- return getMessage(errCode, new Object[] {arg1, arg2, arg3, arg4});
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
* @param args Arguments for parametric replacement
*
* @return Localized error message
*/
- public static String getMessage(String errCode, Object[] args) {
+ public static String getMessage(String errCode, Object... args) {
String errMsg = getMessage(errCode);
if (args != null && args.length > 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org