mrdon       2004/04/08 15:07:56

  Modified:    src/share/org/apache/struts/action ActionServlet.java
                        DynaActionFormClass.java
               src/share/org/apache/struts/config FormBeanConfig.java
               src/share/org/apache/struts/config/impl
                        ModuleConfigImpl.java
               src/share/org/apache/struts/util RequestUtils.java
  Log:
  Fixed inappropriate serialization of ModuleConfig when a DynaActionForm
  was put in the session.
  
  PR: 22207
  Reviewed by: Rob Leland
  
  Revision  Changes    Path
  1.175     +5 -5      
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.174
  retrieving revision 1.175
  diff -u -r1.174 -r1.175
  --- ActionServlet.java        14 Mar 2004 06:23:42 -0000      1.174
  +++ ActionServlet.java        8 Apr 2004 22:07:56 -0000       1.175
  @@ -674,7 +674,7 @@
           FormBeanConfig fbs[] = config.findFormBeanConfigs();
           for (int i = 0; i < fbs.length; i++) {
               if (fbs[i].getDynamic()) {
  -                DynaActionFormClass.createDynaActionFormClass(fbs[i]);
  +                DynaActionFormClass.createDynaActionFormClass(fbs[i], config);
               }
           }
   
  
  
  
  1.18      +7 -6      
jakarta-struts/src/share/org/apache/struts/action/DynaActionFormClass.java
  
  Index: DynaActionFormClass.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/DynaActionFormClass.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DynaActionFormClass.java  14 Mar 2004 06:23:42 -0000      1.17
  +++ DynaActionFormClass.java  8 Apr 2004 22:07:56 -0000       1.18
  @@ -256,19 +256,20 @@
        *
        * @param config The FormBeanConfig instance describing the properties
        *  of the bean to be created
  +     * @param moduleConfig The ModuleConfig instance containing all the
  +     *  configuration information for the current module
        *
        * @exception IllegalArgumentException if the bean implementation class
        *  specified in the configuration is not DynaActionForm (or a subclass
        *  of DynaActionForm)
        */
       public static DynaActionFormClass
  -        createDynaActionFormClass(FormBeanConfig config) {
  +        createDynaActionFormClass(FormBeanConfig config, ModuleConfig moduleConfig) 
{
   
           synchronized (lock) {
               if (dynaClasses == null) {
                   dynaClasses = new HashMap();
               }
  -            ModuleConfig moduleConfig = config.getModuleConfig();
               String key = config.getName();
               if (moduleConfig != null) {
                   key += moduleConfig.getPrefix();
  
  
  
  1.13      +4 -35     
jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java
  
  Index: FormBeanConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FormBeanConfig.java       14 Mar 2004 06:23:47 -0000      1.12
  +++ FormBeanConfig.java       8 Apr 2004 22:07:56 -0000       1.13
  @@ -79,37 +79,6 @@
           ; // No action required
       }
   
  -
  -    /**
  -     * The [EMAIL PROTECTED] ModuleConfig} with which this form bean definition
  -     * is associated.
  -     */
  -    protected ModuleConfig moduleConfig = null;
  -
  -
  -    /**
  -     * Return the [EMAIL PROTECTED] ModuleConfig} with which this form bean 
definition
  -     * is associated.
  -     */
  -    public ModuleConfig getModuleConfig() {
  -        return (this.moduleConfig);
  -    }
  -
  -
  -    /**
  -     * Set the [EMAIL PROTECTED] ModuleConfig} with which this form bean definition
  -     * is associated.
  -     *
  -     * @param moduleConfig The new [EMAIL PROTECTED] ModuleConfig} or 
<code>null</code>
  -     *  to disassociate this form bean configuration from any module
  -     */
  -    public void setModuleConfig(ModuleConfig moduleConfig) {
  -        if (configured) {
  -            throw new IllegalStateException("Configuration is frozen");
  -        }
  -        this.moduleConfig = moduleConfig;
  -    }
  -
       /**
        * The unique identifier of this form bean, which is used to reference this
        * bean in <code>ActionMapping</code> instances as well as for the name of
  
  
  
  1.12      +4 -6      
jakarta-struts/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java
  
  Index: ModuleConfigImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ModuleConfigImpl.java     14 Mar 2004 06:23:53 -0000      1.11
  +++ ModuleConfigImpl.java     8 Apr 2004 22:07:56 -0000       1.12
  @@ -233,7 +233,6 @@
           if (configured) {
               throw new IllegalStateException("Configuration is frozen");
           }
  -        config.setModuleConfig(this);
           formBeans.put(config.getName(), config);
   
       }
  @@ -579,7 +578,6 @@
           if (configured) {
               throw new IllegalStateException("Configuration is frozen");
           }
  -        config.setModuleConfig(null);
           formBeans.remove(config.getName());
   
       }
  
  
  
  1.149     +9 -7      
jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
  
  Index: RequestUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
  retrieving revision 1.148
  retrieving revision 1.149
  diff -u -r1.148 -r1.149
  --- RequestUtils.java 14 Mar 2004 06:23:51 -0000      1.148
  +++ RequestUtils.java 8 Apr 2004 22:07:56 -0000       1.149
  @@ -190,7 +190,7 @@
               return (null);
           }
   
  -        return createActionForm(config, servlet);
  +        return createActionForm(config, moduleConfig, servlet);
       }
   
   
  @@ -275,11 +275,13 @@
        * which could be reused.</p>
        *
        * @param config The configuration for the Form bean which is to be created.
  +     * @param moduleConfig The configuration for the current module.
        * @param servlet The action servlet
        *
        * @return ActionForm instance associated with this request
        */
  -    public static ActionForm createActionForm(FormBeanConfig config, ActionServlet 
servlet)
  +    public static ActionForm createActionForm(FormBeanConfig config, ModuleConfig 
moduleConfig,
  +                                              ActionServlet servlet)
       {
           if (config == null)
           {
  @@ -291,7 +293,7 @@
           if (config.getDynamic()) {
               try {
                   DynaActionFormClass dynaClass =
  -                        DynaActionFormClass.createDynaActionFormClass(config);
  +                        DynaActionFormClass.createDynaActionFormClass(config, 
moduleConfig);
                   instance = (ActionForm) dynaClass.newInstance();
                   ((DynaActionForm) instance).initialize(config);
                   if (log.isDebugEnabled()) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to