Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(oxtrust-server): fix sector identifier nullpointer #2360 #2361

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1995,13 +1997,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 @@ -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;
Expand Down
Loading