Skip to content

Introduction with empty message raises exception

when making an introduction and leaving the introduction message blank I get this exception:

java.lang.IllegalArgumentException: null
	at org.briarproject.briar.introduction.MessageEncoderImpl.encodeRequestMessage(MessageEncoderImpl.java:114)
	at org.briarproject.briar.introduction.AbstractProtocolEngine.sendRequestMessage(AbstractProtocolEngine.java:115)
	at org.briarproject.briar.introduction.IntroducerProtocolEngine.onLocalRequest(IntroducerProtocolEngine.java:230)
	at org.briarproject.briar.introduction.IntroducerProtocolEngine.onRequestAction(IntroducerProtocolEngine.java:76)
	at org.briarproject.briar.introduction.IntroductionManagerImpl.makeIntroduction(IntroductionManagerImpl.java:363)
	at org.briarproject.briar.desktop.introduction.IntroductionViewModel$makeIntroduction$1.invoke(IntroductionViewModel.kt:77)
	at org.briarproject.briar.desktop.introduction.IntroductionViewModel$makeIntroduction$1.invoke(IntroductionViewModel.kt:74)
	at org.briarproject.briar.desktop.viewmodel.DbViewModel$runOnDbThread$1.invoke(DbViewModel.kt:29)
	at org.briarproject.briar.desktop.viewmodel.DbViewModel$runOnDbThread$1.invoke(DbViewModel.kt:26)
	at org.briarproject.briar.desktop.threading.BriarExecutorsImpl.onDbThread$lambda-0(BriarExecutorsImpl.kt:15)
	at org.briarproject.bramble.TimeLoggingExecutor.lambda$execute$0(TimeLoggingExecutor.java:35)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

where I read:

    @Override
	public Message encodeRequestMessage(GroupId contactGroupId, long timestamp,
			@Nullable MessageId previousMessageId, Author author,
			@Nullable String text) {
		if (text != null && text.isEmpty()) {
			throw new IllegalArgumentException();
		}
		BdfList body = BdfList.of(
				REQUEST.getValue(),
				previousMessageId,
				clientHelper.toList(author),
				text
		);
		return createMessage(contactGroupId, timestamp, body);
	}

We copied from Android that the message is optional, and I just confirmed it is optional there, however, I don't know how. Maybe we replace a null message with an empty string there.

Edited by Sebastian