Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Fix GenericItemProvider missing added event on startup #4163

Merged
merged 1 commit into from
Sep 1, 2017

Conversation

htreu
Copy link
Contributor

@htreu htreu commented Aug 30, 2017

This patch makes the GenericItemProvider independent from the ADDED event the ModelRepositoryImpl emits on startup. When the GenericItemProvider reads its models it will add the items to its internal map and prevent NPEs on further modified events.

Fixes #4162.

Also:

Signed-off-by: Henning Treu henning.treu@telekom.de

@@ -157,6 +157,8 @@ public void removeBindingConfigReader(BindingConfigReader reader) {
}
}
}
itemsMap.put(modelName, items);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a brute force fix to me. Note that the itemsMap is also filled in modelChanged, so you are now doing it several times.
Wouldn't the better place the getAll() method as this is the one that gets called (once) before added events are received? And if this would additionally check, whether an entry in the map already exists, it would be even nicer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right and in addition the line introduces just another bug when multiple *.items models are present. Only one model would be written to itemsMap. Update is on the way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh noes, wrote that before I had the first coffee... Its a map idiot (<- note to myself).

- fixes eclipse-archived#4162
- also fixes duplicate added events for items see eclipse-archived#4161 (comment) and closes eclipse-archived#617
- minor cosmetics

Signed-off-by: Henning Treu <henning.treu@telekom.de>
@kaikreuzer kaikreuzer merged commit 484cc84 into eclipse-archived:master Sep 1, 2017
@htreu htreu deleted the fix-4162 branch September 1, 2017 09:28
@kaikreuzer kaikreuzer added this to the 0.9.0 milestone Nov 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants