From 1eac64481376fd8ccc21d6160845ad7df0707ccd Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Mon, 15 Aug 2016 11:52:43 +0200 Subject: [PATCH] Fixed error in AbstractMessageRepository (archived messages couldn't be found) --- .../dissem/bitmessage/ports/AbstractMessageRepository.java | 6 +++++- .../bitmessage/repository/JdbcProofOfWorkRepository.java | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) 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;