Browse Source

REPORT-81270 远程连接配置界面处理IPV6格式的url--忽略异常+单元测试

release/11.0
John.Ying 2 years ago
parent
commit
fb314c8063
  1. 8
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  2. 10
      designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java

8
designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -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) {
}
}

10
designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java vendored

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

Loading…
Cancel
Save