From fb314c80639e3167b481228f69eaab0b3a5febb5 Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Wed, 12 Oct 2022 11:36:21 +0800 Subject: [PATCH] =?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()); + } }