MetaDataEntry set method traverses metaData even after key is found and data
set/cleared
----------------------------------------------------------------------------------------
Key: WICKET-3264
URL: https://issues.apache.org/jira/browse/WICKET-3264
Project: Wicket
Issue Type: Improvement
Components: wicket
Affects Versions: 1.5-M3
Environment: all
Reporter: Richard Emberson
Priority: Trivial
The for-loop in the MetaDataKey set method has a break statement that is only
called if metaData is set to null. The break statement should be after the
set = true;
statement.
Why? from what I can tell, per-key, data can only be entered into the
MetaDataEntry
array once. The data is added only if isSet == false, and this happens only if
the
key is not found in the array.
Also, he get method only returns the first entry found for a given key so
it makes no sense to actually have more than one entry.
So, change from:
else
{
metaData = null;
break;
}
}
set = true;
}
to:
else
{
metaData = null;
}
}
set = true;
break;
}
I've made the change on my copy and all of the tests pass.
If a user is directly playing with the data Object,
Object data = null;
in Component rather than using the given methods, then all bets are off anyway.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.