Removed unnecessary log message from LocalDB, logging Sync

This commit is contained in:
Kai S. K. Engelbart 2019-12-21 18:29:59 +01:00
parent ab13d5adb4
commit 5f3fce1f71
2 changed files with 19 additions and 25 deletions

View File

@ -1,7 +1,9 @@
package envoy.client; package envoy.client;
import java.io.StringWriter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity; import javax.ws.rs.client.Entity;
@ -11,6 +13,7 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller; import javax.xml.bind.Marshaller;
import envoy.client.util.EnvoyLog;
import envoy.exception.EnvoyException; import envoy.exception.EnvoyException;
import envoy.schema.ObjectFactory; import envoy.schema.ObjectFactory;
import envoy.schema.Sync; import envoy.schema.Sync;
@ -33,6 +36,8 @@ public class Client {
private User sender, recipient; private User sender, recipient;
private boolean online = false; private boolean online = false;
private static final Logger logger = EnvoyLog.getLogger(Client.class.getSimpleName());
/** /**
* Initializes the client. At this state, the client user has yet to be * Initializes the client. At this state, the client user has yet to be
* initialized, which can be done by calling {@link Client#onlineInit(String)}. * initialized, which can be done by calling {@link Client#onlineInit(String)}.
@ -163,7 +168,9 @@ public class Client {
jc = JAXBContext.newInstance("envoy.schema"); jc = JAXBContext.newInstance("envoy.schema");
Marshaller m = jc.createMarshaller(); Marshaller m = jc.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.marshal(sync, System.out); StringWriter stringWriter = new StringWriter();
m.marshal(sync, stringWriter);
logger.fine("Sending sync:\n" + stringWriter.toString());
} catch (JAXBException e) { } catch (JAXBException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -1,16 +1,8 @@
package envoy.client; package envoy.client;
import java.io.File; import java.io.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeConfigurationException;
@ -20,11 +12,8 @@ import envoy.client.event.EventBus;
import envoy.client.event.MessageCreationEvent; import envoy.client.event.MessageCreationEvent;
import envoy.client.util.EnvoyLog; import envoy.client.util.EnvoyLog;
import envoy.exception.EnvoyException; import envoy.exception.EnvoyException;
import envoy.schema.Message; import envoy.schema.*;
import envoy.schema.Message.Metadata.MessageState; import envoy.schema.Message.Metadata.MessageState;
import envoy.schema.ObjectFactory;
import envoy.schema.Sync;
import envoy.schema.User;
/** /**
* Project: <strong>envoy-client</strong><br> * Project: <strong>envoy-client</strong><br>
@ -249,10 +238,8 @@ public class LocalDB {
// Updating UserStatus of all users in LocalDB // Updating UserStatus of all users in LocalDB
for (User user : returnSync.getUsers()) for (User user : returnSync.getUsers())
for (Chat chat : getChats()) for (Chat chat : getChats())
if (user.getID() == chat.getRecipient().getID()) { if (user.getID() == chat.getRecipient().getID())
chat.getRecipient().setStatus(user.getStatus()); chat.getRecipient().setStatus(user.getStatus());
logger.info(chat.getRecipient().getStatus().toString());
}
sync.getMessages().clear(); sync.getMessages().clear();
sync.getUsers().clear(); sync.getUsers().clear();