Fixed error in AbstractMessageRepository (archived messages couldn't be found)

This commit is contained in:
Christian Basler 2016-08-15 11:52:43 +02:00
parent 41c4447514
commit 1eac644813
2 changed files with 5 additions and 4 deletions

View File

@ -70,7 +70,11 @@ public abstract class AbstractMessageRepository implements MessageRepository, In
@Override @Override
public List<Plaintext> findMessages(Label label) { public List<Plaintext> 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 @Override

View File

@ -2,7 +2,6 @@ package ch.dissem.bitmessage.repository;
import ch.dissem.bitmessage.InternalContext; import ch.dissem.bitmessage.InternalContext;
import ch.dissem.bitmessage.entity.ObjectMessage; import ch.dissem.bitmessage.entity.ObjectMessage;
import ch.dissem.bitmessage.entity.Plaintext;
import ch.dissem.bitmessage.exception.ApplicationException; import ch.dissem.bitmessage.exception.ApplicationException;
import ch.dissem.bitmessage.factory.Factory; import ch.dissem.bitmessage.factory.Factory;
import ch.dissem.bitmessage.ports.ProofOfWorkRepository; import ch.dissem.bitmessage.ports.ProofOfWorkRepository;
@ -10,9 +9,7 @@ import ch.dissem.bitmessage.utils.Strings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.sql.*; import java.sql.*;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;