Throw an exception if a raw message has been deleted.

This commit is contained in:
akwizgran
2018-08-23 14:51:56 +01:00
parent d84e176bb4
commit fbd38dbb94
18 changed files with 37 additions and 53 deletions

View File

@@ -94,7 +94,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
}
@Override
public void addingContact(Transaction txn, Contact c) throws DbException {
public void addingContact(Transaction txn, Contact c) {
}
@Override
@@ -311,7 +311,6 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
// Get body of message to be wrapped
BdfList body = clientHelper.getMessageAsList(txn, header.getId());
if (body == null) throw new DbException();
long timestamp = header.getTimestamp();
Message wrappedMessage;
@@ -459,9 +458,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
@Override
public String getPostBody(MessageId m) throws DbException {
try {
BdfList message = clientHelper.getMessageAsList(m);
if (message == null) throw new DbException();
return getPostBody(message);
return getPostBody(clientHelper.getMessageAsList(m));
} catch (FormatException e) {
throw new DbException(e);
}

View File

@@ -204,10 +204,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
@Override
public String getPostBody(MessageId m) throws DbException {
try {
// Parent ID, author, forum post body, signature
BdfList body = clientHelper.getMessageAsList(m);
if (body == null) throw new DbException();
return getPostBody(body);
return getPostBody(clientHelper.getMessageAsList(m));
} catch (FormatException e) {
throw new DbException(e);
}

View File

@@ -463,7 +463,6 @@ class IntroductionManagerImpl extends ConversationClientImpl
author = session.getRemote().author;
} else throw new AssertionError();
Message msg = clientHelper.getMessage(txn, m);
if (msg == null) throw new AssertionError();
BdfList body = clientHelper.toList(msg);
RequestMessage rm = messageParser.parseRequestMessage(msg, body);
String message = rm.getMessage();

View File

@@ -217,9 +217,7 @@ class MessagingManagerImpl extends ConversationClientImpl
public String getMessageBody(MessageId m) throws DbException {
try {
// 0: private message body
BdfList message = clientHelper.getMessageAsList(m);
if (message == null) throw new DbException();
return message.getString(0);
return clientHelper.getMessageAsList(m).getString(0);
} catch (FormatException e) {
throw new DbException(e);
}

View File

@@ -301,9 +301,7 @@ class PrivateGroupManagerImpl extends BdfIncomingMessageHook
@Override
public String getMessageBody(MessageId m) throws DbException {
try {
BdfList body = clientHelper.getMessageAsList(m);
if (body == null) throw new DbException();
return getMessageBody(body);
return getMessageBody(clientHelper.getMessageAsList(m));
} catch (FormatException e) {
throw new DbException(e);
}

View File

@@ -91,7 +91,6 @@ class MessageParserImpl implements MessageParser {
public InviteMessage getInviteMessage(Transaction txn, MessageId m)
throws DbException, FormatException {
Message message = clientHelper.getMessage(txn, m);
if (message == null) throw new DbException();
BdfList body = clientHelper.toList(message);
return parseInviteMessage(message, body);
}

View File

@@ -78,7 +78,6 @@ abstract class MessageParserImpl<S extends Shareable>
public InviteMessage<S> getInviteMessage(Transaction txn, MessageId m)
throws DbException, FormatException {
Message message = clientHelper.getMessage(txn, m);
if (message == null) throw new DbException();
BdfList body = clientHelper.toList(message);
return parseInviteMessage(message, body);
}