From 3a43ac4a3e9a3713fc63b659a3d0527a0adfa1e0 Mon Sep 17 00:00:00 2001 From: Rodrigo Pastrana Date: Fri, 23 Aug 2024 11:47:08 -0400 Subject: [PATCH] HPCC4J-631 Provide meaningful version error message - Ensures version response is not HTML based - Adds relevant message to parsing errors Signed-off-by: Rodrigo Pastrana --- .../ws/client/BaseHPCCWsClient.java | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java b/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java index 0dfe94b5e..2ee1461a9 100644 --- a/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java +++ b/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java @@ -1,6 +1,7 @@ package org.hpccsystems.ws.client; import java.io.ByteArrayInputStream; +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; @@ -159,24 +160,44 @@ private String getTargetHPCCBuildVersionString() throws Exception if (wsconn == null) throw new Exception("Cannot get target HPCC build version, client connection has not been initialized."); - String response = wsconn.sendGetRequest("WsSMC/Activity?rawxml_");//throws + String response = wsconn.sendGetRequest("WsSMC/Activity?rawxml_");//throws IOException if http != ok if (response == null || response.isEmpty()) throw new Exception("Cannot get target HPCC build version, received empty " + wsconn.getBaseUrl() + " wssmc/activity response"); + String header = response.substring(0, 100).trim(); //crude, but can prevent wasteful overhead + if (header.startsWith("