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()); + } }