Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
[kernel] Add assertions for testing NPE.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jan 12, 2015
1 parent 67874b6 commit 8e75adf
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,20 @@ public synchronized boolean containsContext(UUID contextID) {
*/
@Override
public synchronized AgentContext createContext(UUID contextID, UUID defaultSpaceUUID) {
assert (contextID != null) : "The contextID cannot be null"; //$NON-NLS-1$
assert (defaultSpaceUUID != null) : "The defaultSpaceUUID cannot be null"; //$NON-NLS-1$
AgentContext context = this.contexts.get(contextID);
if (context == null) {
Context ctx = this.contextFactory.newInstance(
contextID,
defaultSpaceUUID,
this.spaceRepositoryFactory,
new SpaceEventProxy());
assert (ctx != null) : "The internal Context cannot be null"; //$NON-NLS-1$
this.contexts.put(contextID, ctx);
fireContextCreated(ctx);
Space defaultSpace = ctx.postConstruction();
assert (defaultSpace != null) : "The default space in the context " + contextID + " cannot be null"; //$NON-NLS-1$ //$NON-NLS-2$
this.defaultSpaces.putIfAbsent(ctx.getID(), defaultSpace.getID());
return ctx;
}
Expand Down

0 comments on commit 8e75adf

Please sign in to comment.