From 3edd75bf7243dee25b395f091baa13158bec5bcb Mon Sep 17 00:00:00 2001 From: c-schuler Date: Thu, 19 Feb 2026 12:32:59 -0700 Subject: [PATCH] Spotless --- src/main/java/HealthCheck.java | 67 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/src/main/java/HealthCheck.java b/src/main/java/HealthCheck.java index 35c9841..919162c 100644 --- a/src/main/java/HealthCheck.java +++ b/src/main/java/HealthCheck.java @@ -6,41 +6,40 @@ import java.util.regex.Pattern; public class HealthCheck { - public static void main(String[] args) { - try { - var port = System.getenv().getOrDefault("SERVER_PORT", "8080"); - var url = new URL("http://localhost:" + port + "/fhir/metadata"); - var conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("GET"); - conn.setRequestProperty("Accept", "application/fhir+json"); - conn.setConnectTimeout(10000); - conn.setReadTimeout(10000); + public static void main(String[] args) { + try { + var port = System.getenv().getOrDefault("SERVER_PORT", "8080"); + var url = new URL("http://localhost:" + port + "/fhir/metadata"); + var conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + conn.setRequestProperty("Accept", "application/fhir+json"); + conn.setConnectTimeout(10000); + conn.setReadTimeout(10000); - var status = conn.getResponseCode(); - if (status != 200) { - System.err.println("Health check failed: HTTP " + status); - System.exit(1); - } + var status = conn.getResponseCode(); + if (status != 200) { + System.err.println("Health check failed: HTTP " + status); + System.exit(1); + } - var body = new StringBuilder(); - try (var reader = - new BufferedReader(new InputStreamReader(conn.getInputStream()))) { - String line; - while ((line = reader.readLine()) != null) { - body.append(line); - } - } + var body = new StringBuilder(); + try (var reader = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { + String line; + while ((line = reader.readLine()) != null) { + body.append(line); + } + } - var pattern = Pattern.compile("\"resourceType\"\\s*:\\s*\"CapabilityStatement\""); - if (pattern.matcher(body.toString()).find()) { - System.exit(0); - } else { - System.err.println("Health check failed: CapabilityStatement not found in response"); - System.exit(1); - } - } catch (Exception e) { - System.err.println("Health check failed: " + e.getMessage()); - System.exit(1); - } - } + var pattern = Pattern.compile("\"resourceType\"\\s*:\\s*\"CapabilityStatement\""); + if (pattern.matcher(body.toString()).find()) { + System.exit(0); + } else { + System.err.println("Health check failed: CapabilityStatement not found in response"); + System.exit(1); + } + } catch (Exception e) { + System.err.println("Health check failed: " + e.getMessage()); + System.exit(1); + } + } }