aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-ws/src/main/java/com/juick')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/XMPPConnection.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
index ca792a1a..1f1e07c7 100644
--- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
+++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
@@ -21,7 +21,10 @@ import rocks.xmpp.core.stanza.model.Message;
import rocks.xmpp.extensions.component.accept.ExternalComponent;
import javax.inject.Inject;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
import java.io.IOException;
+import java.io.StringWriter;
import java.util.List;
import java.util.stream.Collectors;
@@ -71,8 +74,12 @@ public class XMPPConnection implements AutoCloseable {
Message msg = e.getMessage();
com.juick.Message jmsg = msg.getExtension(com.juick.Message.class);
if (jmsg != null) {
- if (logger.isInfoEnabled()) // prevent writeValueAsString execution if log is disabled
- logger.info("got msg: {}", ms.writeValueAsString(jmsg));
+ if (logger.isInfoEnabled()) { // prevent writeValueAsString execution if log is disabled
+ Marshaller marshaller = xmpp.createMarshaller();
+ StringWriter stanzaWriter = new StringWriter();
+ marshaller.marshal(msg, stanzaWriter);
+ logger.info("got msg: {}", stanzaWriter.toString());
+ }
if (jmsg.getMid() == 0) {
int uid_to = NumberUtils.toInt(msg.getTo().getLocal(), 0);
if (uid_to > 0) {
@@ -89,6 +96,8 @@ public class XMPPConnection implements AutoCloseable {
}
} catch (JsonProcessingException ex) {
logger.error("mapper exception", ex);
+ } catch (JAXBException exc) {
+ logger.error("jaxb exception", exc);
}
});
try {