struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bueno Carlos M <>
Subject ActionMapping/ActionConfig cast in
Date Fri, 24 Jan 2003 21:18:49 GMT
Howdy --
I have what is I guess a noob question, but I simply can't figure out these
seemingly important lines of code in

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();

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

-- snip --

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message