Skip to content

Commit

Permalink
fix(oxtrust-server): fix sector uri nullpointer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhar16 committed Sep 30, 2023
1 parent b649521 commit 15c74a1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2040,13 +2042,14 @@ public List<SelectableEntity<CustomScript>> 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++) {
Expand Down Expand Up @@ -2080,8 +2083,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;
Expand Down

0 comments on commit 15c74a1

Please sign in to comment.