public static java.util.ResourceBundle getMessageResourceBundle();
public static String getMessage(String key) throws java.util.MissingResourceException;
public static String getMessage(String key, String var) throws java.util.MissingResourceException;
public static String getMessage(String key, String var1, String var2) throws java.util.MissingResourceException;
public static String getMessage(String key, String[] vars) throws java.util.MissingResourceException;
AXIS programmers can work with the resource bundle directly via a call
to JavaUtils.getMessageResourceBundle,
but the getMessage
methods should be used instead for two reasons:
If you have a message with variables, use the syntax "{X}"
where X is
the number of the variable, starting at 0. For example:
You could also call the String array version of getMessage:
The String array version of getMessage
is all that is necessary, but the vast majority of messages will have 0,
1 or 2 variables, so the other getMessage
methods are provided as a convenience to avoid the complexity of the String
array version.
Note that the getMessage methods throw MissingResourceException if the resource cannot be found. And ParseException if there are more {X} entries than arguments. These exceptions are RuntimeException's, so the caller doesn't have to explicitly catch them.
The resource bundle properties file is org/apache/axis/utils/resources.properties.
Entries in the properties file must follow the pattern: <string><2-digit suffix>.
Entries should be ordered in the properties file alphabetically by key.
Entries in the properties file must never be changed. If a code change requires a message change, don't change the existing message; instead create a new entry, incrementing the 2-digit suffix. This must be done for two reasons: 1. You don't know whether the message is being used elsewhere. 2. So the translator only has to be aware of, and translate, the new strings. Without this restriction, every time translators are given the properties file to translate, they would have to translate all strings all the time.
if ( operationName == null )
throw new AxisFault( "No operation name specified" );
We will have to add an entry into org/apache/axis/utils/resources.properties. Something like:
noOperation=No operation name specified.
And change the code to read:
if ( operationName == null )
throw new AxisFault(JavaUtils.getMessage("noOperation"));