From b1419906611a7eac693a31f718c78b314a834b92 Mon Sep 17 00:00:00 2001 From: heavyrian2012 Date: Thu, 20 Oct 2022 15:44:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=B9=B3=E5=8F=B0=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=E6=94=B9?= =?UTF-8?q?=E6=88=90error=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/moquette/persistence/MemoryMessagesStore.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java index e9cb789d..50694eeb 100755 --- a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java +++ b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java @@ -3372,10 +3372,12 @@ public class MemoryMessagesStore implements IMessagesStore { if(robotData != null && !StringUtil.isNullOrEmpty(robotData.getCallback()) && !StringUtil.isNullOrEmpty(robotData.getSecret())) { try { URL url = new URL(robotData.getCallback()); - if(url.getHost().equals(host)) { + if(url.getHost() == null) { + LOG.error("get application auth code error, application callback is invalid url"); + } else if(url.getHost().equals(host)) { secret = robotData.getSecret(); } else { - LOG.warn("get application auth code error, request host is not the same host with callback host"); + LOG.error("get application auth code error, request host is not the same host with callback host"); } } catch (MalformedURLException e) { e.printStackTrace(); @@ -3396,10 +3398,12 @@ public class MemoryMessagesStore implements IMessagesStore { if(channelData != null && !StringUtil.isNullOrEmpty(channelData.getCallback()) && !StringUtil.isNullOrEmpty(channelData.getSecret())) { try { URL url = new URL(channelData.getCallback()); - if(url.getHost().equals(host)) { + if(url.getHost() == null) { + LOG.error("get application auth code error, application callback is invalid url"); + } else if(url.getHost().equals(host)) { secret = channelData.getSecret(); } else { - LOG.warn("get application auth code error, request host is not the same host with callback host"); + LOG.error("get application auth code error, request host is not the same host with callback host"); } } catch (MalformedURLException e) { e.printStackTrace();