lantern icon indicating copy to clipboard operation
lantern copied to clipboard

DefaultXmppHandler base64Cert debug output messed up terminal display

Open ed2k opened this issue 11 years ago • 5 comments

suggest to remove that debug.

diff --git a/src/main/java/org/lantern/DefaultXmppHandler.java b/src/main/java/org/lantern/DefaultXmppHandler.java
index 6f50cf7..458462b 100644
--- a/src/main/java/org/lantern/DefaultXmppHandler.java
+++ b/src/main/java/org/lantern/DefaultXmppHandler.java
@@ -795,12 +795,10 @@ public class DefaultXmppHandler implements XmppHandler {
         //final String mac = (String) msg.getProperty(P2PConstants.MAC);
         final String base64Cert = (String) msg.getProperty(P2PConstants.CERT);

-        LOG.debug("Base 64 cert: {}", base64Cert);

         if (StringUtils.isNotBlank(base64Cert)) {
-            LOG.trace("Got certificate for {}:\n{}", uri, 
-                new String(Base64.decodeBase64(base64Cert),
-                    LanternConstants.UTF8).replaceAll("\u0007", "[bell]")); // don't ring any bells
+            LOG.trace("Got certificate for {}: ", uri); 
+            LOG.debug("Base 64 cert: {}", base64Cert);
             // Add the peer if we're able to add the cert.
             this.kscopeAdHandler.onBase64Cert(uri, base64Cert);
         } else {

ed2k avatar Dec 22 '14 04:12 ed2k

problem is String(Base64.decodeBase64(base64Cert), LanternConstants.UTF8).replaceAll("\u0007", "[bell]") it is converting base64 to binary.

ed2k avatar Dec 22 '14 17:12 ed2k

It actually looks like it's converting to a utf-8 encoded string.

oxtoacart avatar Dec 22 '14 17:12 oxtoacart

Did you see this causing a problem? If so, what did you observe?

oxtoacart avatar Dec 22 '14 17:12 oxtoacart

yes, it could output terminal display control characters, which would messup all the ascii output after that. you will have to reset the terminal.

ed2k avatar Dec 22 '14 17:12 ed2k

Gotcha. Let me see if I can find out why we're decoding it at all.

oxtoacart avatar Dec 22 '14 17:12 oxtoacart