Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
1.3.4
-
None
-
None
Description
You add two behaviors to the Component. First behavior is temporary and the second is normal.
Now the wicket creates the url by "urlFor(final Component component, final IBehavior behaviour, final RequestListenerInterface listener)" for second behavior with behaviourId=1. On the end of request the wicket removes the temporary behavior. Now the component contains only 1 but not 2 behaviors. And in the next request in method "public final void processEvents(final RequestCycle requestCycle)" the wicket tries to find the behavior by its id. But the problem is with if (component.getBehaviors().size() > idAsInt) condition, and with the fact that index of behavior is incorrect.
The problematic classes with their methods:
org.apache.wicket.RequestCycle:
public final CharSequence urlFor(final Component component, final IBehavior behaviour,
final RequestListenerInterface listener)
{
int index = component.getBehaviors().indexOf(behaviour);
if (index == -1)
RequestParameters params = new RequestParameters();
params.setBehaviorId(String.valueOf(index));
...
==============================================================================================
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget
public final void processEvents(final RequestCycle requestCycle)
{
// Preprocess like standard component request. Do all the initialization
// necessary
onProcessEvents(requestCycle);
// Get the IBehavior for the component based on the request parameters
final Component component = getTarget();
final String id = getRequestParameters().getBehaviorId();
if (id == null)
final int idAsInt = Integer.parseInt(id);
IBehaviorListener behaviorListener = null;
if (component.getBehaviors().size() > idAsInt)
Attachments
Issue Links
- duplicates
-
WICKET-1483 Unusual ClassCastException (SimpleAttributeModifier to IBehaviorListener) processing onError.
- Resolved