Skip to content

Commit

Permalink
Return empty result instead of a runtime exception when failing
Browse files Browse the repository at this point in the history
This means that we can also get rid of the McpException class
  • Loading branch information
oliverhaagh committed Nov 30, 2023
1 parent 8fbebc1 commit 981b341
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import com.fasterxml.jackson.core.type.TypeReference;
import lombok.extern.jbosslog.JBossLog;
import net.maritimeconnectivity.identityregistry.keycloak.spi.exceptions.McpException;
import net.maritimeconnectivity.pki.PKIIdentity;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
Expand Down Expand Up @@ -375,7 +374,7 @@ protected String getContent(HttpEntity entity) {
entity.writeTo(os);
} catch (IOException e) {
log.error("Could not get content", e);
throw new McpException(e);
return "";
}
return os.toString();
}
Expand All @@ -396,7 +395,7 @@ protected CloseableHttpClient buildHttpClient() {
}
} catch (NoSuchAlgorithmException | CertificateException | IOException | KeyStoreException e) {
log.error("Could not load keystore or truststore", e);
throw new McpException(e);
return null;
} finally {
try {
if (instreamTruststore != null) {
Expand All @@ -419,7 +418,7 @@ protected CloseableHttpClient buildHttpClient() {
sslcontext = sslContextBuilder.build();
} catch (KeyManagementException | UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException e) {
log.error("Could not build ssl context", e);
throw new McpException(e);
return null;
}
SSLConnectionSocketFactory sslsf;
if (trustStore != null) {
Expand Down

This file was deleted.

0 comments on commit 981b341

Please sign in to comment.