From 2a1c2c5019d48554d79a879641cd4173ec677d7c Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Tue, 11 Oct 2022 16:40:51 +0800 Subject: [PATCH 1/8] =?UTF-8?q?REPORT-81270=20=E8=BF=9C=E7=A8=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= =?UTF-8?q?IPV6=E6=A0=BC=E5=BC=8F=E7=9A=84url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/RemoteEnvPane.java | 4 +++ .../java/com/fr/env/RemoteWorkspaceURL.java | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 31bdaa979b..a4423c37dc 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -325,6 +325,10 @@ public class RemoteEnvPane extends BasicBeanPane { this.remoteWorkspaceURL = Strings.isNullOrEmpty(connection.getUrl()) ? RemoteWorkspaceURL.createDefaultURL() : new RemoteWorkspaceURL(connection.getUrl()); + //判断一下IP地址是不是IPV6的格式,如果是的话在拆分地址和端口的时候需要调整一下格式,用[ 或者 ] 判断 + if (!Strings.isNullOrEmpty(connection.getUrl()) && connection.getUrl().contains("[")) { + this.remoteWorkspaceURL.refreshIPV6Format(); + } String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY); String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY); String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY); diff --git a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java index 4ea950e845..b37bc4d051 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java +++ b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java @@ -129,6 +129,31 @@ public class RemoteWorkspaceURL implements FCloneable { return this.url; } + /** + * IPV6地址格式不同,处理字符串的方式不同,需要处理的是port和host + * 形如 http://[XXXX::XXXX:XXXX:XXXX:XXXX]:8080/webroot/decision + */ + public void refreshIPV6Format() { + String url = this.url; + // 第三次出现"/"的地方 + int webIndex = url.indexOf("/", url.indexOf("://") + 3); + int hostIndex = url.indexOf("["); + int portIndex = url.indexOf("]"); + isContainsRelatedIndex(webIndex, hostIndex, portIndex); + this.host = url.substring(hostIndex, portIndex + 1); + this.port = url.substring(portIndex + 2, webIndex); + } + + /** + * + * @param webIndex web指针 + * @param hostIndex 主机指针 + * @param portIndex 端口指针 + * @return 三个指针是否都存在 + */ + public boolean isContainsRelatedIndex(int webIndex, int hostIndex, int portIndex) { + return webIndex != -1 && hostIndex != -1 && portIndex != -1; + } public void setHttps(boolean https) { isHttps = https; From a6fcfbcde38a98f5e3b23263159abffd584865bd Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Tue, 11 Oct 2022 16:49:15 +0800 Subject: [PATCH 2/8] =?UTF-8?q?REPORT-81270=20=E8=BF=9C=E7=A8=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= =?UTF-8?q?IPV6=E6=A0=BC=E5=BC=8F=E7=9A=84url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index a4423c37dc..83b5e7b95c 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -75,6 +75,7 @@ public class RemoteEnvPane extends BasicBeanPane { private UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); private UILabel uiLabel = new UILabel(); + private String IPV6_JUDGE_SYMBOL = "["; /** * 是否启用 https 勾选框 @@ -326,7 +327,7 @@ public class RemoteEnvPane extends BasicBeanPane { ? RemoteWorkspaceURL.createDefaultURL() : new RemoteWorkspaceURL(connection.getUrl()); //判断一下IP地址是不是IPV6的格式,如果是的话在拆分地址和端口的时候需要调整一下格式,用[ 或者 ] 判断 - if (!Strings.isNullOrEmpty(connection.getUrl()) && connection.getUrl().contains("[")) { + if (!Strings.isNullOrEmpty(connection.getUrl()) && connection.getUrl().contains(IPV6_JUDGE_SYMBOL)) { this.remoteWorkspaceURL.refreshIPV6Format(); } String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY); From d3db2cb26c67f6b47d7759ac2e0fd5d23544df78 Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Tue, 11 Oct 2022 17:17:43 +0800 Subject: [PATCH 3/8] =?UTF-8?q?REPORT-81270=20=E8=BF=9C=E7=A8=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= =?UTF-8?q?IPV6=E6=A0=BC=E5=BC=8F=E7=9A=84url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/RemoteEnvPane.java | 5 ++- .../java/com/fr/env/RemoteWorkspaceURL.java | 32 ++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 83b5e7b95c..63854dc713 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -75,7 +75,7 @@ public class RemoteEnvPane extends BasicBeanPane { private UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); private UILabel uiLabel = new UILabel(); - private String IPV6_JUDGE_SYMBOL = "["; + private static final String IPV6_JUDGE_SYMBOL = "["; /** * 是否启用 https 勾选框 @@ -210,6 +210,9 @@ public class RemoteEnvPane extends BasicBeanPane { private void actionURLInputChange() { remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText()); + if (remoteWorkspaceURL.getURL().contains(IPV6_JUDGE_SYMBOL)) { + remoteWorkspaceURL.refreshIPV6Format(); + } fillIndividualField(); httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps()); diff --git a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java index b37bc4d051..15e1674b11 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java +++ b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java @@ -1,9 +1,15 @@ package com.fr.env; +import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.stable.FCloneable; import com.fr.stable.StringUtils; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; + /** * @author yaohwu */ @@ -135,24 +141,13 @@ public class RemoteWorkspaceURL implements FCloneable { */ public void refreshIPV6Format() { String url = this.url; - // 第三次出现"/"的地方 - int webIndex = url.indexOf("/", url.indexOf("://") + 3); - int hostIndex = url.indexOf("["); - int portIndex = url.indexOf("]"); - isContainsRelatedIndex(webIndex, hostIndex, portIndex); - this.host = url.substring(hostIndex, portIndex + 1); - this.port = url.substring(portIndex + 2, webIndex); - } - - /** - * - * @param webIndex web指针 - * @param hostIndex 主机指针 - * @param portIndex 端口指针 - * @return 三个指针是否都存在 - */ - public boolean isContainsRelatedIndex(int webIndex, int hostIndex, int portIndex) { - return webIndex != -1 && hostIndex != -1 && portIndex != -1; + try { + URI uri = new URI(url); + this.host = uri.getHost(); + this.port = String.valueOf(uri.getPort()); + } catch (URISyntaxException e) { + FineLoggerFactory.getLogger().info("error request url"); + } } public void setHttps(boolean https) { @@ -255,4 +250,5 @@ public class RemoteWorkspaceURL implements FCloneable { } } } + } \ No newline at end of file From 20fd8d2221ea8e567327085c0e8d944291f31dee Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Tue, 11 Oct 2022 17:19:23 +0800 Subject: [PATCH 4/8] =?UTF-8?q?REPORT-81270=20=E8=BF=9C=E7=A8=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= =?UTF-8?q?IPV6=E6=A0=BC=E5=BC=8F=E7=9A=84url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/RemoteWorkspaceURL.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java index 15e1674b11..0583d3cfc3 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java +++ b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java @@ -4,11 +4,9 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.stable.FCloneable; import com.fr.stable.StringUtils; - -import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; -import java.net.URL; + /** * @author yaohwu From f9e6aa55203923238b5595d1bc9f2a04e4eca6f5 Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Wed, 12 Oct 2022 10:02:06 +0800 Subject: [PATCH 5/8] =?UTF-8?q?REPORT-81270=20=E8=BF=9C=E7=A8=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= =?UTF-8?q?IPV6=E6=A0=BC=E5=BC=8F=E7=9A=84url--=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/RemoteEnvPane.java | 8 -------- .../java/com/fr/env/RemoteWorkspaceURL.java | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 63854dc713..31bdaa979b 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -75,7 +75,6 @@ public class RemoteEnvPane extends BasicBeanPane { private UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); private UILabel uiLabel = new UILabel(); - private static final String IPV6_JUDGE_SYMBOL = "["; /** * 是否启用 https 勾选框 @@ -210,9 +209,6 @@ public class RemoteEnvPane extends BasicBeanPane { private void actionURLInputChange() { remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText()); - if (remoteWorkspaceURL.getURL().contains(IPV6_JUDGE_SYMBOL)) { - remoteWorkspaceURL.refreshIPV6Format(); - } fillIndividualField(); httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps()); @@ -329,10 +325,6 @@ public class RemoteEnvPane extends BasicBeanPane { this.remoteWorkspaceURL = Strings.isNullOrEmpty(connection.getUrl()) ? RemoteWorkspaceURL.createDefaultURL() : new RemoteWorkspaceURL(connection.getUrl()); - //判断一下IP地址是不是IPV6的格式,如果是的话在拆分地址和端口的时候需要调整一下格式,用[ 或者 ] 判断 - if (!Strings.isNullOrEmpty(connection.getUrl()) && connection.getUrl().contains(IPV6_JUDGE_SYMBOL)) { - this.remoteWorkspaceURL.refreshIPV6Format(); - } String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY); String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY); String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY); diff --git a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java index 0583d3cfc3..9b019caa91 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java +++ b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java @@ -6,12 +6,15 @@ import com.fr.stable.FCloneable; import com.fr.stable.StringUtils; import java.net.URI; import java.net.URISyntaxException; - +import com.fr.third.guava.base.Strings; /** * @author yaohwu */ public class RemoteWorkspaceURL implements FCloneable { + private static final String IPV6_JUDGE_SYMBOL = "["; + + private static final String IPV6_JUDGE_SYMBOL2 = "]"; public static final String SYSTEM_LOGIN_PATH = "#management/system/login"; @@ -102,6 +105,7 @@ public class RemoteWorkspaceURL implements FCloneable { parserWebAndServlet(lefts); } } + this.refreshIPV6Format(); } public boolean hasDefaultHostName() { @@ -139,12 +143,18 @@ public class RemoteWorkspaceURL implements FCloneable { */ public void refreshIPV6Format() { String url = this.url; + if (Strings.isNullOrEmpty(url)) { + return; + } + if (!url.contains(IPV6_JUDGE_SYMBOL) || !url.contains(IPV6_JUDGE_SYMBOL2)) { + return; + } try { URI uri = new URI(url); this.host = uri.getHost(); this.port = String.valueOf(uri.getPort()); } catch (URISyntaxException e) { - FineLoggerFactory.getLogger().info("error request url"); + FineLoggerFactory.getLogger().info("error request url format"); } } @@ -249,4 +259,7 @@ public class RemoteWorkspaceURL implements FCloneable { } } + public static void main(String[] args) { + System.out.println("".contains("/")); + } } \ No newline at end of file From 58aee59400e8058abd2b5eecd39efaf45c67b3ed Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Wed, 12 Oct 2022 10:03:47 +0800 Subject: [PATCH 6/8] =?UTF-8?q?REPORT-81270=20=E8=BF=9C=E7=A8=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= =?UTF-8?q?IPV6=E6=A0=BC=E5=BC=8F=E7=9A=84url--=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/RemoteWorkspaceURL.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java index 9b019caa91..fb10a3200a 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java +++ b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java @@ -258,8 +258,4 @@ public class RemoteWorkspaceURL implements FCloneable { } } } - - public static void main(String[] args) { - System.out.println("".contains("/")); - } } \ No newline at end of file From fb314c80639e3167b481228f69eaab0b3a5febb5 Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Wed, 12 Oct 2022 11:36:21 +0800 Subject: [PATCH 7/8] =?UTF-8?q?REPORT-81270=20=E8=BF=9C=E7=A8=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= =?UTF-8?q?IPV6=E6=A0=BC=E5=BC=8F=E7=9A=84url--=E5=BF=BD=E7=95=A5=E5=BC=82?= =?UTF-8?q?=E5=B8=B8+=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/RemoteWorkspaceURL.java | 8 +++++--- .../test/java/com/fr/env/RemoteWorkspaceURLTest.java | 10 ++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java index fb10a3200a..1dcd2220f6 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java +++ b/designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java @@ -105,6 +105,7 @@ public class RemoteWorkspaceURL implements FCloneable { parserWebAndServlet(lefts); } } + //判断一下IPV6 this.refreshIPV6Format(); } @@ -149,12 +150,13 @@ public class RemoteWorkspaceURL implements FCloneable { if (!url.contains(IPV6_JUDGE_SYMBOL) || !url.contains(IPV6_JUDGE_SYMBOL2)) { return; } + URI uri = null; try { - URI uri = new URI(url); + uri = new URI(url); this.host = uri.getHost(); this.port = String.valueOf(uri.getPort()); - } catch (URISyntaxException e) { - FineLoggerFactory.getLogger().info("error request url format"); + } catch (URISyntaxException ignored) { + } } diff --git a/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java b/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java index f066ae6896..b9412a93d5 100644 --- a/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java +++ b/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java @@ -242,4 +242,14 @@ public class RemoteWorkspaceURLTest { assertEquals("servlet", b.getServlet()); //others begin } + + @Test + public void testIPV6Url() { + String trueUrl = "http://[fe80::4d83:cc10:9f6f:3303]:8080/webroot/decision"; + RemoteWorkspaceURL remoteWorkspaceURL1 = new RemoteWorkspaceURL(trueUrl); + assertEquals("[fe80::4d83:cc10:9f6f:3303]", remoteWorkspaceURL1.getHost()); + assertEquals("8080", remoteWorkspaceURL1.getPort()); + assertEquals("webroot", remoteWorkspaceURL1.getWeb()); + assertEquals("decision", remoteWorkspaceURL1.getServlet()); + } } From 16b56bb8ee42a2851d9344ff1e8be755f6b6345d Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 12 Oct 2022 21:16:51 +0800 Subject: [PATCH 8/8] =?UTF-8?q?REPORT-81416=20=E5=AF=BC=E5=85=A5=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/carton/EventDispatchThreadHangMonitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java b/designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java index f472d901a1..56ccaa2c48 100644 --- a/designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java +++ b/designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java @@ -7,7 +7,6 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.ProductConstantsBase; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.third.ibm.icu.text.SimpleDateFormat; import org.jetbrains.annotations.NotNull; import javax.swing.SwingUtilities; @@ -22,6 +21,7 @@ import java.io.IOException; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; +import java.text.SimpleDateFormat; import java.util.LinkedList; import java.util.Timer; import java.util.TimerTask;