diff --git a/build.gradle b/build.gradle index bfcae8d..0998b03 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ plugins { } ext.moduleName = 'qupath.extension.omero' -version = "0.1.0-rc3" +version = "0.1.0-rc4" description = "QuPath extension to support image reading using OMERO APIs." ext.qupathVersion = gradle.ext.qupathVersion ext.qupathJavaVersion = 17 diff --git a/src/main/java/qupath/ext/omero/core/RequestSender.java b/src/main/java/qupath/ext/omero/core/RequestSender.java index 5b3911b..241c7b7 100644 --- a/src/main/java/qupath/ext/omero/core/RequestSender.java +++ b/src/main/java/qupath/ext/omero/core/RequestSender.java @@ -71,7 +71,7 @@ private RequestSender() { * @return whether the provided link is reachable */ public static CompletableFuture isLinkReachableWithGet(URI uri) { - return getGETRequest(uri) + return getGETRequest(uri, false) .map(RequestSender::isLinkReachable) .orElse(CompletableFuture.completedFuture(false)); } @@ -95,7 +95,7 @@ public static CompletableFuture isLinkReachableWithOptions(URI uri) { * @return the raw HTTP response with in text format, or an empty Optional if the request failed */ public static CompletableFuture> get(URI uri) { - return getGETRequest(uri) + return getGETRequest(uri, true) .map(RequestSender::request) .orElse(CompletableFuture.completedFuture(Optional.empty())); } @@ -165,7 +165,7 @@ public static CompletableFuture> getPaginated(URI uri) { * @return the HTTP response converted to an image, or an empty Optional if the request or the conversion failed */ public static CompletableFuture> getImage(URI uri) { - var getRequest = getGETRequest(uri); + var getRequest = getGETRequest(uri, true); if (getRequest.isPresent()) { return httpClient .sendAsync(getRequest.get(), HttpResponse.BodyHandlers.ofByteArray()) @@ -352,7 +352,7 @@ private static CompletableFuture> request(HttpRequest request) ); } - private static Optional getGETRequest(URI uri) { + private static Optional getGETRequest(URI uri, boolean logIfError) { try { return Optional.ofNullable(HttpRequest.newBuilder() .uri(uri) @@ -361,7 +361,9 @@ private static Optional getGETRequest(URI uri) { .timeout(Duration.of(REQUEST_TIMEOUT, SECONDS)) .build()); } catch (Exception e) { - logger.error("Error when creating GET request", e); + if (logIfError) { + logger.error("Error when creating GET request", e); + } return Optional.empty(); } } diff --git a/src/main/java/qupath/ext/omero/core/imageserver/OmeroImageServerBuilder.java b/src/main/java/qupath/ext/omero/core/imageserver/OmeroImageServerBuilder.java index 2ac676c..87c2d6c 100644 --- a/src/main/java/qupath/ext/omero/core/imageserver/OmeroImageServerBuilder.java +++ b/src/main/java/qupath/ext/omero/core/imageserver/OmeroImageServerBuilder.java @@ -94,10 +94,11 @@ private static Optional getClientAndCheckURIReachable(URI uri, String if (client.getStatus().equals(WebClient.Status.SUCCESS)) { return Optional.of(client); } else { - logger.error("Client creation failed"); + logger.debug("Client creation failed"); return Optional.empty(); } } else { + logger.debug(String.format("Link %s not reachable; OMERO can't open it", uri)); return Optional.empty(); } } catch (InterruptedException | ExecutionException e) {