From 2a0ebc1f03b9c2587c3b28721835d931c2a2ed9f Mon Sep 17 00:00:00 2001 From: shekhar16 Date: Thu, 10 Aug 2023 00:18:38 +0530 Subject: [PATCH] fix(oxtrust-server): fix sector identifier nullpointer #2360 --- .../java/org/gluu/oxtrust/action/UpdateClientAction.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java b/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java index 6c4fb47e5..df7661db0 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.io.Serializable; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -1995,13 +1997,14 @@ public List> getAvailableSpontaneousScripts() { } private boolean loadSector(String sectorIdentifierUri) throws ClientProtocolException, IOException { + try { String sectoruriContent = downloadSectorIdentifierUri(sectorIdentifierUri); if (sectoruriContent == null) { return false; } - try { + JSONArray uris = new JSONArray(sectoruriContent); this.loginUris.clear(); for (int i = 0; i < uris.length(); i++) { @@ -2035,8 +2038,9 @@ private String getResponseContent(HttpResponse httpResponse) throws IOException return new String(responseBytes, StandardCharsets.UTF_8); } - private String downloadSectorIdentifierUri(String sectorIdentifierUri) throws IOException, ClientProtocolException { + private String downloadSectorIdentifierUri(String sectorIdentifierUri) throws IOException, ClientProtocolException, URISyntaxException { HttpGet httpGet = new HttpGet(); + httpGet.setURI(new URI(sectorIdentifierUri)); httpGet.setHeader("Accept", "application/json"); String fileContent = null;