diff --git a/core/src/main/java/ch/dissem/bitmessage/ports/AbstractMessageRepository.java b/core/src/main/java/ch/dissem/bitmessage/ports/AbstractMessageRepository.java index e037c4f..e0448c7 100644 --- a/core/src/main/java/ch/dissem/bitmessage/ports/AbstractMessageRepository.java +++ b/core/src/main/java/ch/dissem/bitmessage/ports/AbstractMessageRepository.java @@ -70,7 +70,11 @@ public abstract class AbstractMessageRepository implements MessageRepository, In @Override public List findMessages(Label label) { - return find("id IN (SELECT message_id FROM Message_Label WHERE label_id=" + label.getId() + ")"); + if (label == null) { + return find("id NOT IN (SELECT message_id FROM Message_Label)"); + } else { + return find("id IN (SELECT message_id FROM Message_Label WHERE label_id=" + label.getId() + ")"); + } } @Override diff --git a/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcProofOfWorkRepository.java b/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcProofOfWorkRepository.java index ac6e69f..0fda3fa 100644 --- a/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcProofOfWorkRepository.java +++ b/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcProofOfWorkRepository.java @@ -2,7 +2,6 @@ package ch.dissem.bitmessage.repository; import ch.dissem.bitmessage.InternalContext; import ch.dissem.bitmessage.entity.ObjectMessage; -import ch.dissem.bitmessage.entity.Plaintext; import ch.dissem.bitmessage.exception.ApplicationException; import ch.dissem.bitmessage.factory.Factory; import ch.dissem.bitmessage.ports.ProofOfWorkRepository; @@ -10,9 +9,7 @@ import ch.dissem.bitmessage.utils.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.InputStream; import java.sql.*; import java.util.LinkedList; import java.util.List;