Skip to content
Snippets Groups Projects
Unverified Commit 54272c88 authored by akwizgran's avatar akwizgran
Browse files

MessageFactory never throws IOException.

parent fd99dd75
No related branches found
No related tags found
1 merge request!94Move subscription updates to the client layer
package org.briarproject.api.sync;
import java.io.IOException;
public interface MessageFactory {
Message createMessage(GroupId groupId, long timestamp, byte[] body)
throws IOException;
Message createMessage(GroupId groupId, long timestamp, byte[] body);
}
......@@ -110,8 +110,6 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch (FormatException e) {
throw new RuntimeException(e);
} catch (IOException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} finally {
lock.writeLock().unlock();
}
......@@ -123,7 +121,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
private void storeMessage(GroupId g, DeviceId dev, TransportId t,
TransportProperties p, long version, boolean local, boolean shared)
throws DbException, IOException {
throws DbException, FormatException {
byte[] body = encodeProperties(dev, t, p, version);
long now = clock.currentTimeMillis();
Message m = messageFactory.createMessage(g, now, body);
......
......@@ -10,8 +10,6 @@ import org.briarproject.api.sync.MessageFactory;
import org.briarproject.api.sync.MessageId;
import org.briarproject.util.ByteUtils;
import java.io.IOException;
import static org.briarproject.api.sync.SyncConstants.MAX_MESSAGE_BODY_LENGTH;
import static org.briarproject.api.sync.SyncConstants.MESSAGE_HEADER_LENGTH;
......@@ -25,8 +23,7 @@ class MessageFactoryImpl implements MessageFactory {
}
@Override
public Message createMessage(GroupId groupId, long timestamp, byte[] body)
throws IOException {
public Message createMessage(GroupId groupId, long timestamp, byte[] body) {
if (body.length > MAX_MESSAGE_BODY_LENGTH)
throw new IllegalArgumentException();
byte[] raw = new byte[MESSAGE_HEADER_LENGTH + body.length];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment