project with a global.Global class that does not extend SharedFlowController or
the derecated GlobalApp causes runtime exceptions
---------------------------------------------------------------------------------------------------------------------------------
Key: BEEHIVE-1205
URL: https://issues.apache.org/jira/browse/BEEHIVE-1205
Project: Beehive
Issue Type: Bug
Components: NetUI
Affects Versions: 1.0.2, 1.0.1, 1.0
Reporter: Carlin Rogers
Assignee: Carlin Rogers
Priority: Minor
Fix For: V.Next
To reproduce:
- Add a simple POJO named Global.java in a /global package.
- Build/compile the project. Note that the generated Struts module config files
for the page flow controllers in the project (that do not have references to
shared flows) will have a property defined by the
<set-property property="sharedFlows" value="__global=global.Global"/>
element with in the <controller>
- Deploy the app on a server and hit a page flow controller begin action. Note
the exception.
java.lang.ClassCastException: global.Global
at
org.apache.beehive.netui.pageflow.FlowControllerFactory.createSharedFlow(FlowControllerFactory.java:426)
at
org.apache.beehive.netui.pageflow.FlowControllerFactory.createSharedFlow(FlowControllerFactory.java:406)
at
org.apache.beehive.netui.pageflow.FlowControllerFactory.addSharedFlow(FlowControllerFactory.java:815)
at
org.apache.beehive.netui.pageflow.FlowControllerFactory.getSharedFlowsForPath(FlowControllerFactory.java:498)
at
org.apache.beehive.netui.pageflow.FlowControllerFactory.getSharedFlowsForRequest(FlowControllerFactory.java:456)
at
org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:505)
at
org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
at
org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
at
org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
The global.Global class in this scenario is just a POJO and not a Shared Flow.
When the application is compiled, the NetUI annotation processor (AP) assumes
that it is a Shared Flow to support the old deprecated Global.app and generates
a Struts module config file that includes a property for this class as a shared
flow.
The <controller> element in the generated Struts module config includes the
following property...
<set-property property="sharedFlows" value="__global=global.Global"/>
The NetUI AP first looks for any shared flows referenced by a given page flow.
If there are none, then it just looks to see if there is a global.Global type
declaration, but does not check that it is an instance of
org.apache.beehive.netui.pageflow.GlobalApp or a SharedFlowController. Since it
finds the global.Global class in this scenario, it adds it as a default Shared
Flow.
Then at runtime when we try to load shared flows for the page flow, we fail
with a ClassCastException.
Note, this will only occur if a user defines a global.Global class in their
NetUI project.
The fix requires a change to
org.apache.beehive.netui.compiler.FlowControllerInfo.setSharedFlowInfo() to
check that the class inherits from GlobalApp or SharedFlowController.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.