From e3e47dae484150d0de249fd2560f5e59a5c3b7e9 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 9 Oct 2019 08:27:33 -0300 Subject: [PATCH] [core] throw AssertionError if SessionId is missing Also remove stale comment --- .../briar/introduction/IntroductionManagerImpl.java | 8 +++++--- .../briar/introduction/IntroductionIntegrationTest.java | 5 ----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/briar-core/src/main/java/org/briarproject/briar/introduction/IntroductionManagerImpl.java b/briar-core/src/main/java/org/briarproject/briar/introduction/IntroductionManagerImpl.java index 9ad3c5370..f7083956b 100644 --- a/briar-core/src/main/java/org/briarproject/briar/introduction/IntroductionManagerImpl.java +++ b/briar-core/src/main/java/org/briarproject/briar/introduction/IntroductionManagerImpl.java @@ -583,9 +583,11 @@ class IntroductionManagerImpl extends ConversationClientImpl throw new DbException(e); } if (m.getSessionId() == null) { - // this can only be an unhandled REQUEST message - // that does not yet have a SessionId assigned - continue; + // This can only be an unhandled REQUEST message. + // Its session is created and stored in incomingMessage(), + // and getMessageMetadata() only returns delivered messages, + // so the session ID should have been assigned. + throw new AssertionError("missing session ID"); } // get session from map or database DeletableSession session = sessions.get(m.getSessionId()); diff --git a/briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java b/briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java index bd63b9635..84b73c2d4 100644 --- a/briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java +++ b/briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java @@ -1349,11 +1349,6 @@ public class IntroductionIntegrationTest assertFalse(deleteAllMessages0From2()); } - /** - * This test is testing that a session's deletable flag gets reset - * when the session is used again, - * so that it can not cause a session to get deleted prematurely. - */ @Test public void testDeletingOneSideOfSession() throws Exception { addListeners(false, false);