[cvs]
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller
ControllerResponse.java
JCorporate Ltd
jcorp at jcorp2.servlets.net
Sun Sep 12 13:42:16 PDT 2004
Update of /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller
In directory jcorp2.servlets.net:/tmp/cvs-serv31580/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller
Modified Files:
ControllerResponse.java
Log Message:
getString() should not throw if string not found
Index: ControllerResponse.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerResponse.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** ControllerResponse.java 12 Sep 2004 08:09:52 -0000 1.47
--- ControllerResponse.java 12 Sep 2004 20:42:14 -0000 1.48
***************
*** 751,755 ****
/**
! * Pass on a call to retrieve an appropriate localized string from the
* correct Schema object. This version of the call is overridden with more
* sophisticated versions in DBController (which knows the username)
--- 751,755 ----
/**
! * retrieve an appropriate localized string from the
* correct Schema object. This version of the call is overridden with more
* sophisticated versions in DBController (which knows the username)
***************
*** 757,763 ****
* @param stringCode the String code to retrieve
* @param args the formatting arguments
! * @return java.lang.String
* @throws ControllerException upon error
- * @throws IllegalArgumentException if there was no string found.
*/
public String getString(String stringCode, Object[] args)
--- 757,762 ----
* @param stringCode the String code to retrieve
* @param args the formatting arguments
! * @return translated string or stringCode if not found
* @throws ControllerException upon error
*/
public String getString(String stringCode, Object[] args)
***************
*** 775,809 ****
Stack s = this.getSchemaStack();
try {
! return Messages.getStringRequired(s, this.responseLocale, stringCode, args);
! } catch (IllegalArgumentException ex) {
! throw new IllegalArgumentException("Unable to locate string " + stringCode + " for any schema");
! }
! }
!
! /**
! * Pass on a call to retrieve an appropriate localized string from the
! * correct Schema object. This version of the call is overridden with more
! * sophisticated versions in DBController (which knows the username)
! *
! * @param stringCode the String code to retrieve
! * @param args the formatting arguments
! * @return translated string, or stringCode if not found
! * @throws ControllerException upon error
! */
! public String getStringUnrequired(String stringCode, Object[] args)
! throws ControllerException {
! StringUtil.assertNotBlank(stringCode, "You must specify a string key");
!
! if (myRequest == null) {
! log.error("No request object was established for this controller response, " +
! " for controller class '" +
! StringUtil.notNull(myControllerClass) + "'");
!
! return null;
! }
!
! Stack s = this.getSchemaStack();
! try {
! return Messages.getStringUnrequired(s, this.responseLocale, stringCode, args);
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException("Unable to locate string " + stringCode + " for any schema");
--- 774,778 ----
Stack s = this.getSchemaStack();
try {
! return Messages.getString(s, this.responseLocale, stringCode, args);
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException("Unable to locate string " + stringCode + " for any schema");
***************
*** 828,837 ****
/**
! * Convenience method of getString(String,Object[]) for one parameter
! * strings
*
* @param stringCode the string code to retrieve
! * @param string1 a single parameter for message format
! * @return java.lang.String
* @throws ControllerException upon error
*/
--- 797,805 ----
/**
! * Convenience method of getString(String,Object[]) where first (and only) param of args will be string1
*
* @param stringCode the string code to retrieve
! * @param string1 a single parameter for message format (the first argument to replace)
! * @return translated string or stringCode if not found
* @throws ControllerException upon error
*/
More information about the cvs
mailing list