Community
Participate
Working Groups
Build Identifier: The current check is: boolean isKindMatch = (mask & eventKind ^ ServerEvent.SERVER_CHANGE ^ ServerEvent.MODULE_CHANGE) != 0; Say the mask is in binary: (MODULE_CHANGE) (SERVER_CHANGE) (NOT USED YET) (RESTART_STATE_CHANGE) (PUBLISH_STATE_CHANGE) (STATE_CHANGE) 100010, e.g. interested in MODULE_CHANGE | PUBLISH_STATE_CHANGE Now the server has a module state change, so 100001 is fired. The current code will give true for the kind check which is wrong. 1. mask & eventKind = 100010 & 100001 = 100000 2. 100000 ^ SERVER_CHANGE = 110000 3. 110000 ^ MODULE_CHANGE = 010000 which is != 0. The kind check gave a result of true which is wrong The correct check should take out the SERVER_CHANGE and MODULE_CHANGE bits first. int kindOnly = (eventKind | ServerEvent.SERVER_CHANGE | ServerEvent.MODULE_CHANGE) ^ ServerEvent.SERVER_CHANGE ^ ServerEvent.MODULE_CHANGE; Then do the kind check: boolean isKindMatch = (mask & kindOnly) != 0; Reproducible: Always
Created attachment 203308 [details] Patch v1.0 The changes are as Raymond has described in his description. Testing: I used a server adapter that supports events for server state, module state, and module status. A breakpoint was added into org.eclipse.wst.server.core.internal.ServerNotificationManager.broadcastChange(ServerEvent). When the breakpoint is hit, the stack was examined to determine which method had caused the broadcast. The broadcast will do a bitwise OR of the type of event and the kind of event. I examine the kind that was used to create the broadcast and compared it to the value of org.eclipse.wst.server.core.internal.ServerNotificationManager.broadcastChange(ServerEvent).kindOnly. The correct kind was extracted from the broadcast for : 1. fireModuleStateChangeEvent 2. fireModuleStatusChangeEvent 3. fireServerStateChangeEvent I also verified that the mask was applied correctly and would return false or true as appropriate.
Changes looks good and the test looks sufficient. Code released to 32M and HEAD
Code released to 32M
New Gerrit change created: https://git.eclipse.org/r/109071