Skip to content

Commit

Permalink
Throw exception if OpenEO credentials are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
inigo-cobian committed Jun 18, 2024
1 parent 6937743 commit d0e3204
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.integratedmodelling.klab.api.runtime.monitoring.IMonitor;
import org.integratedmodelling.klab.auth.Authorization;
import org.integratedmodelling.klab.exceptions.KlabIOException;
import org.integratedmodelling.klab.exceptions.KlabMissingCredentialsException;
import org.integratedmodelling.klab.exceptions.KlabRemoteException;
import org.integratedmodelling.klab.rest.ExternalAuthenticationCredentials;
import org.integratedmodelling.klab.rest.Notification;
Expand Down Expand Up @@ -396,10 +397,11 @@ public void encodeSelf(String url) {

public OpenEO(String endpoint) {
ExternalAuthenticationCredentials credentials = Authentication.INSTANCE.getCredentials(endpoint);
this.endpoint = credentials.getURL();
if (credentials != null) {
this.authorization = new Authorization(credentials, endpoint);
if (credentials == null) {
throw new KlabMissingCredentialsException(endpoint);
}
this.endpoint = credentials.getURL();
this.authorization = new Authorization(credentials, endpoint);
this.executor.scheduleAtFixedRate(() -> {
Set<Job> finished = new HashSet<>();
for (Job job : jobs) {
Expand Down

0 comments on commit d0e3204

Please sign in to comment.