-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0
-
sparc
-
solaris_2.6
Name: ktR10099 Date: 12/04/2000
Specification for those methods say nothing on method behavior in case
they recieve Event of correct class but with wrong id (out of range,
defined for this class of Events).
======================================================================
Name: ktR10099 Date: 12/05/2000
Please, find below description of the problem, supplied by the customer:
*******Customer email ***********
We do this initial check for performance reasons. Lots of events are
processed (e.g. mouse events), and the instanceOf check is relatively
expensive. We find that the majority of events normally fail the
instanceOf
check. Hence we do an initial check of the ID, and only if this passes do
we
use instanceOf.
So, for example, from
pjck12\tests\api\java_awt\CheckBoxMenuItem\ItemListenerTests.java:
/**
* Assertion testing for method addItemListener(ItemListener il)
* <br><b>Expected results</b>: Will return true
*/
public Status CheckboxMenuItem2008() {
String testCaseID = "CheckboxMenuItem2008";
ref.println("====== "+testCaseID+" ======");
ItemEvent ie = new ItemEvent(new Checkbox(), 0, new Object(),
ItemEvent.SELECTED);
DummyItemListener il = new DummyItemListener();
ChildCheckboxMenuItem cbmi = new
ChildCheckboxMenuItem("Label");
cbmi.addItemListener(il);
cbmi.processEvent(ie);
if (il.changed && !il.changedtwice)
return Status.passed("OKAY");
return Status.failed(testCaseID + " failed");
}
CheckboxMenuItem.processEvent(ie) makes a call to
CheckboxMenuItem.processItemEvent(ie) which checks if the event id is
equal
to ItemEvent.Item_State_Changed (the only valid item event type in this
case). Since the event id is 0 the event is ignored and hence the test
fails
because il.changed will be false.
Requiring that we remove the initial check will hit our performance quite
badly. There seems no justification for the tests using 0 as the ID other
than the programmer did not look up the correct ID.
*******End Customer email ***********
======================================================================
- relates to
-
JDK-4394128 incomplete spec for java.awt.event.XXXEvent constructors
-
- Closed
-