diff --git a/src/main/java/com/google/openthread/LoggerInitializer.java b/src/main/java/com/google/openthread/LoggerInitializer.java index 6d50eee..f4af99c 100644 --- a/src/main/java/com/google/openthread/LoggerInitializer.java +++ b/src/main/java/com/google/openthread/LoggerInitializer.java @@ -55,5 +55,7 @@ public static void Init(boolean verbose) { break; } } + + ((Logger)LoggerFactory.getLogger(CALIFORNIUM)).setLevel(levelLibrary); } } diff --git a/src/main/java/com/google/openthread/main/OtRegistrarConfig.java b/src/main/java/com/google/openthread/main/OtRegistrarConfig.java index 386ca70..2a59d27 100644 --- a/src/main/java/com/google/openthread/main/OtRegistrarConfig.java +++ b/src/main/java/com/google/openthread/main/OtRegistrarConfig.java @@ -45,7 +45,7 @@ static OtRegistrarConfig DefaultPledge() { config.domainName = null; config.keyStoreFile = "./credentials/default_pledge.p12"; config.masaUri = null; - config.registrarUri = "localhost:5684"; + config.registrarUri = "coaps://localhost:5684"; config.logVerbose = false; return config; } diff --git a/src/main/java/com/google/openthread/pledge/PledgeException.java b/src/main/java/com/google/openthread/pledge/PledgeException.java index 22a2a85..0d8b6c2 100644 --- a/src/main/java/com/google/openthread/pledge/PledgeException.java +++ b/src/main/java/com/google/openthread/pledge/PledgeException.java @@ -34,12 +34,13 @@ public class PledgeException extends Exception { /** - * An optional CoAP response code, from a CoAP response, that was unexpected or related to the - * exception. + * An optional CoAP response code, from a CoAP response, that was unexpected or related to the exception. */ public ResponseCode code = null; - /** An optional CoAP diagnostic message, from a CoAP response, to clarify what went wrong. */ + /** + * An optional CoAP diagnostic message, from a CoAP response, to clarify what went wrong. + */ public String diagMsg = null; public PledgeException(String msg) { @@ -47,18 +48,18 @@ public PledgeException(String msg) { } public PledgeException(String msg, CoapResponse resp) { - super( - msg - + ((resp.getCode() != null) ? (" (" + resp.getCode().toString() + ")") : "") - + ((resp.getCode() != null && resp.getPayload() != null) - ? (" - CoAP diagnostic: '" + new String(resp.getPayload()) + "'") - : "")); + super(msg + ((resp.getCode() != null) ? (" (" + resp.getCode().toString() + ")") : "") + + ((resp.getCode() != null && resp.getPayload() != null) + ? (" - CoAP diagnostic: '" + new String(resp.getPayload()) + "'") : "")); this.code = resp.getCode(); - if (!ResponseCode.isSuccess(this.code) && resp.getPayload() != null) + if (!ResponseCode.isSuccess(this.code) && resp.getPayload() != null) { this.diagMsg = new String(resp.getPayload()); + } } - public PledgeException(String msg, ResponseCode coapCode, String coapDiagnosticMsg) {} + public PledgeException(String msg, ResponseCode coapCode, String coapDiagnosticMsg) { + // FIXME + } private static final long serialVersionUID = -1980574489782019605L; } diff --git a/src/main/java/com/google/openthread/pledge/PledgeMain.java b/src/main/java/com/google/openthread/pledge/PledgeMain.java index 980a360..cec8f85 100644 --- a/src/main/java/com/google/openthread/pledge/PledgeMain.java +++ b/src/main/java/com/google/openthread/pledge/PledgeMain.java @@ -101,7 +101,8 @@ private static void runCli(Pledge pledge) { System.out.println("Done"); } catch (Exception e) { - logger.error("error: {}", e.getMessage(), e); + logger.error("error: {}", e.getMessage()); + logger.debug("details:", e); } } }