Skip to content

Commit

Permalink
Merge pull request #76 from Darius-Wattimena/guava_fix
Browse files Browse the repository at this point in the history
Replaced the deprecated getHostText with getHost
  • Loading branch information
dimitrispallas authored Jun 1, 2023
2 parents 37e9adb + a8d6384 commit 31920f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public long getPacketsRead() {
public String getHosts() {
List<String> l = new ArrayList<>();
for (HostAndPort hap : reader.hosts) {
l.add(hap.getHostText());
l.add(hap.getHost());
}
return Joiner.on(',').join(l);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected void connect() throws IOException {
try {
LOG.info("Connecting to source " + currentHost());
clientSocket.set(new Socket());
InetSocketAddress address = new InetSocketAddress(currentHost().getHostText(), currentHost().getPort());
InetSocketAddress address = new InetSocketAddress(currentHost().getHost(), currentHost().getPort());
clientSocket.get().connect(address);
if (timeout > 0) {
clientSocket.get().setSoTimeout(timeout * 1000);
Expand All @@ -159,7 +159,7 @@ protected void connect() throws IOException {
outputStream = clientSocket.get().getOutputStream();
LOG.info("Connected to source " + currentHost());
} catch (UnknownHostException e) {
LOG.error("Unknown host: " + currentHost().getHostText() + ": " + e.getMessage());
LOG.error("Unknown host: " + currentHost().getHost() + ": " + e.getMessage());
throw e;
} catch (IOException e) {
if (!isShutdown()) {
Expand Down Expand Up @@ -248,7 +248,7 @@ public void setTimeout(int timeout) {
* @return hostname hostname
*/
public String getHostname() {
return currentHost().getHostText();
return currentHost().getHost();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void parseOneHost() {
@Test
public void parseTwoHosts() {
AisTcpReader tr = AisReaders.parseSource("sdsd=ff:123, dd:1235");
assertEquals("ff", tr.hosts.get(0).getHostText());
assertEquals("dd", tr.hosts.get(1).getHostText());
assertEquals("ff", tr.hosts.get(0).getHost());
assertEquals("dd", tr.hosts.get(1).getHost());
assertEquals(123, tr.hosts.get(0).getPort());
assertEquals(1235, tr.hosts.get(1).getPort());
assertEquals(2, tr.getHostCount());
Expand Down

0 comments on commit 31920f0

Please sign in to comment.