craigmcc    01/02/19 19:11:20

  Modified:    src/share/org/apache/struts/taglib/html ErrorsTag.java
  Log:
  Throw a runtime exception if we cannot identify the format in which error
  messages were transmitted to this tag.  Among other things, this should catch
  the case where class loader problems in WebLogic 5.1 cause the "instanceof"
  test for ActionErrors to fail, resulting in no messages at all being rendered.
  
  Submitted by: Jason Songhurst <[EMAIL PROTECTED]>
  PR: Bugzilla #467
  
  Revision  Changes    Path
  1.7       +17 -4     
jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java
  
  Index: ErrorsTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ErrorsTag.java    2001/02/20 01:48:46     1.6
  +++ ErrorsTag.java    2001/02/20 03:11:20     1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v 1.6 
2001/02/20 01:48:46 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/02/20 01:48:46 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v 1.7 
2001/02/20 03:11:20 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/02/20 03:11:20 $
    *
    * ====================================================================
    *
  @@ -98,7 +98,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2001/02/20 01:48:46 $
  + * @version $Revision: 1.7 $ $Date: 2001/02/20 03:11:20 $
    */
   
   public class ErrorsTag extends TagSupport {
  @@ -142,6 +142,13 @@
   
   
       /**
  +     * The message resources for this package.
  +     */
  +    protected static MessageResources messages =
  +     MessageResources.getMessageResources(Constants.Package + ".LocalStrings");
  +
  +
  +    /**
        * The request attribute key for our error messages (if any).
        */
       protected String name = Action.ERROR_KEY;
  @@ -205,6 +212,12 @@
                                  new ActionError(keys[i]));
               } else if (value instanceof ActionErrors) {
                   errors = (ActionErrors) value;
  +            } else {
  +                JspException e = new JspException
  +                    (messages.getMessage("errorsTag.errors",
  +                                         value.getClass().getName()));
  +                RequestUtils.saveException(pageContext, e);
  +                throw e;
            }
           } catch (Exception e) {
               ;
  
  
  

Reply via email to