Skip to content

Commit

Permalink
Do not ignore unparseable URIs in node management
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jul 14, 2023
1 parent 3befdbb commit 0ebd6cc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.weakref.jmx.Nested;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ScheduledThreadPoolExecutor;
Expand Down Expand Up @@ -183,11 +182,7 @@ private URI getHttpUri(ServiceDescriptor descriptor)
{
String url = descriptor.getProperties().get(httpsRequired ? "https" : "http");
if (url != null) {
try {
return new URI(url);
}
catch (URISyntaxException ignored) {
}
return URI.create(url);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -266,11 +265,7 @@ private URI getHttpUri(ServiceDescriptor descriptor)
{
String url = descriptor.getProperties().get(httpsRequired ? "https" : "http");
if (url != null) {
try {
return new URI(url);
}
catch (URISyntaxException ignored) {
}
return URI.create(url);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.weakref.jmx.Managed;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -387,11 +386,7 @@ private static URI getHttpUri(ServiceDescriptor descriptor, boolean httpsRequire
{
String url = descriptor.getProperties().get(httpsRequired ? "https" : "http");
if (url != null) {
try {
return new URI(url);
}
catch (URISyntaxException ignored) {
}
return URI.create(url);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.testng.annotations.Test;

import java.net.URI;
import java.net.URISyntaxException;

import static com.google.common.collect.Iterables.getOnlyElement;
import static io.trino.tests.product.TestGroups.HDFS_IMPERSONATION;
Expand Down Expand Up @@ -89,13 +88,7 @@ private static String getTableLocation(QueryExecutor executor, String tableName)
{
String location = getOnlyElement(executor.executeQuery(format("SELECT DISTINCT regexp_replace(\"$path\", '/[^/]*$', '') FROM %s", tableName)).column(1));
if (location.startsWith("hdfs://")) {
try {
URI uri = new URI(location);
return uri.getPath();
}
catch (URISyntaxException e) {
throw new RuntimeException(e);
}
return URI.create(location).getPath();
}
return location;
}
Expand Down

0 comments on commit 0ebd6cc

Please sign in to comment.