Issue Details (XML | Word | Printable)

Key: BEEHIVE-919
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: matt c
Reporter: Eddie O'Neil
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Beehive

controls-spring sample throws exception when refreshing the browser page familyTree.jsp

Created: 10/Sep/05 04:34 AM   Updated: 30/Oct/06 09:48 PM
Return to search
Component/s: Samples
Affects Version/s: v1m1
Fix Version/s: 1.0.2

Time Tracking:
Not Specified

Resolution Date: 30/Oct/06 09:48 PM


 Description  « Hide
The controls + spring integration sample works, but only the first time the JSP is run in a single HttpSession. Looks like a Control is being added with the same name into the same control context.

Not sure it's worth fixing for 1.0, but will take a look at it.

Repro:
1) build / run the controls-spring sample
2) view http://localhost:8080/springControls/familyTree.jsp
3) refresh the page

The result is this stack trace:
org.apache.beehive.controls.api.ControlException: Exception creating ControlBean[Exception creating ControlBean[Attempting to add control with duplicate ID: PersonBean0]]
org.apache.beehive.controls.api.bean.Controls.instantiate(Controls.java:108)
org.apache.beehive.samples.spring.control.AdultImpl.getChild(AdultImpl.java:47)
org.apache.beehive.samples.spring.control.PersonBean.getChild(PersonBean.java:161)
org.apache.jsp.familyTree_jsp.showPerson(familyTree_jsp.java:32)
org.apache.jsp.familyTree_jsp.showPerson(familyTree_jsp.java:35)
org.apache.jsp.familyTree_jsp._jspService(familyTree_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.beehive.controls.runtime.servlet.ControlFilter.doFilter(ControlFilter.java:131)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Chad Schoettger added a comment - 30/Oct/06 09:48 PM
Fixed, svn rev 469282

This exception was being caused because the Adult control was attempting to add a child control which was already present with the same control ID. This was occuring for children of the 'Dean' control bean, which do NOT have bean definitions in the application-context file.

All other beans do have entries in the application-context and their control ID's are injected via constructor at creation time. The children of 'Dean' don't get a control ID set at construction time so when the control bean is added to the control context, an ID is autogenerated by the context for them. This ID is not the same as the names in Dean's child list, hence the error.

There were a couple of options on how to fix this bug:

1) Add a bean descriptor to the application-context file for each of Dean's children.
2) Modify the Adult control to map child names -> control ids.

I chose option 2 as it seems to best fit with the original intent of the spring integration sample.