Howdy --
I have what is I guess a noob question, but I simply can't figure out these
seemingly important lines of code in RequestProcessor.java:


646        ActionMapping mapping = (ActionMapping)
647            moduleConfig.findActionConfig(path);


This appears on lines 646-7 in both 1.02 and 1.1. ActionMapping is a
*subclass* of ActionConfig, so how does this execute without throwing a
ClassCastException? I can cast an ActionMapping as an ActionConfig but not
the other way around. Yet, somehow, RequestProcessor seems to be doing just
that. Below is some sample code to illustrate my question. Can anyone shed
some light on this? It's too much majic for me.

 -- Carlos


-- snip --
import org.apache.struts.action.*;
import org.apache.struts.config.*;
import org.apache.struts.config.impl.*;

//config the module
ModuleConfig module = new ModuleConfigImpl("");
ActionConfig LOGIN = new ActionConfig();
LOGIN.setPath("/login");
LOGIN.setType("org.foo.LoginAction");
LOGIN.setInput("/login.jsp");
module.addActionConfig(LOGIN);
module.freeze();

//this throws a CCE
ActionMapping mapping = (ActionMapping) module.findActionConfig("/login");

-- snip --

Reply via email to