Skip to content

Commit

Permalink
[fix](es-catalog)fix exception when querying ES table #26788 (#29023)
Browse files Browse the repository at this point in the history
  • Loading branch information
liugddx authored Dec 26, 2023
1 parent 8288762 commit bd4d1f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ public EsNodeInfo(String id, String seed) {
String[] scratch = seed.split(":");
int port = 80;
if (scratch.length == 3) {
port = Integer.parseInt(scratch[2]);
String portStr = scratch[2];
if (portStr.contains("/")) {
portStr = portStr.substring(0, portStr.indexOf('/'));
}
port = Integer.parseInt(portStr);
}
String remoteHost = scratch[0] + ":" + scratch[1];
this.name = remoteHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,15 @@ public void parsePublishAddressTest() throws Exception {
}
}
}

@Test
public void testEsNodeInfo() {
EsNodeInfo node = new EsNodeInfo("0", "http://127.0.0.1:9200/");
Assert.assertEquals("http://127.0.0.1", node.getHost());
Assert.assertEquals(9200, node.getPublishAddress().getPort());
node = new EsNodeInfo("0", "http://127.0.0.1:9200");
Assert.assertEquals("http://127.0.0.1", node.getHost());
Assert.assertEquals(9200, node.getPublishAddress().getPort());

}
}

0 comments on commit bd4d1f4

Please sign in to comment.