From 71788469bc9b1fbc8d5744c063ed870868bd0f89 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Sat, 21 Jun 2025 14:02:24 -0500 Subject: [PATCH] Avoid crash when invalid URI is passed to test file write Signed-off-by: Mitch Gaffigan --- .../connect/connectors/file/FileConnectorServlet.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/com/mirth/connect/connectors/file/FileConnectorServlet.java b/server/src/com/mirth/connect/connectors/file/FileConnectorServlet.java index 66b09cf805..abef74c2c2 100644 --- a/server/src/com/mirth/connect/connectors/file/FileConnectorServlet.java +++ b/server/src/com/mirth/connect/connectors/file/FileConnectorServlet.java @@ -65,7 +65,12 @@ protected ConnectionTestResponse testReadOrWrite(String channelId, String channe int timeout = Integer.parseInt(timeoutString); FileConnector fileConnector = new FileConnector(channelId, connectorProperties, null); - URI address = fileConnector.getEndpointURI(host, scheme, schemeProperties, secure); + URI address; + try { + address = fileConnector.getEndpointURI(host, scheme, schemeProperties, secure); + } catch (Exception e) { + return new ConnectionTestResponse(ConnectionTestResponse.Type.FAILURE, "Unable to parse URL, Reason: " + e.getMessage()); + } String addressHost = address.getHost(); int port = address.getPort(); String dir = address.getPath();