You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/06/13 04:40:30 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionServlet.java

craigmcc    00/06/12 19:40:30

  Modified:    src/share/org/apache/struts/action ActionServlet.java
  Log:
  Use the static factory method to retrieve MessageResources objects.
  
  Revision  Changes    Path
  1.4       +13 -16    jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java
  
  Index: ActionServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActionServlet.java	2000/06/05 05:28:49	1.3
  +++ ActionServlet.java	2000/06/13 02:40:29	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.3 2000/06/05 05:28:49 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/06/05 05:28:49 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.4 2000/06/13 02:40:29 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/06/13 02:40:29 $
    *
    * ====================================================================
    *
  @@ -140,7 +140,7 @@
    * <p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/06/05 05:28:49 $
  + * @version $Revision: 1.4 $ $Date: 2000/06/13 02:40:29 $
    */
   
   public class ActionServlet
  @@ -237,11 +237,9 @@
       public void init() throws ServletException {
   
   	// Load our internationalized resource bundle
  -	try {
  -	    internal = new MessageResources(internalName);
  -	} catch (MissingResourceException e) {
  +	internal = MessageResources.getMessageResources(internalName);
  +	if (internal == null)
   	    throw new UnavailableException("Cannot load internal resources");
  -	}
   
   	// Process our servlet initialization parameters
   	String value;
  @@ -263,17 +261,16 @@
   
   	// Load the application resource bundle (if any)
   	if (applicationName != null) {
  -	    try {
  -		if (debug >= 1)
  -		    log("Loading application resources from bundle " + applicationName);
  -		application = new MessageResources(applicationName);
  -		getServletContext().setAttribute(Action.MESSAGES_KEY,
  -					       application);
  -	    } catch (MissingResourceException e) {
  +	    if (debug >= 1)
  +		log("Loading application resources from bundle " + applicationName);
  +	    application =
  +		MessageResources.getMessageResources(applicationName);
  +	    if (application == null)
   		throw new UnavailableException
   		    (internal.getMessage("applicationResources",
   					 applicationName));
  -	    }
  +	    getServletContext().setAttribute(Action.MESSAGES_KEY,
  +					     application);
   	}
   
   	// Process our configuration resource