Fixed Java9+ deprecated code

This commit is contained in:
Mauro Mugnaini 2022-09-30 17:03:01 +02:00
parent 1de7db65c0
commit 74c026dbe9
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package org.gcube.keycloak.avatar;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
@ -51,8 +52,10 @@ public abstract class AbstractAvatarResource {
DEFAULT_IMPLEMENTATION.getName());
try {
asp = (AvatarStorageProvider) DEFAULT_IMPLEMENTATION.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
asp = (AvatarStorageProvider) DEFAULT_IMPLEMENTATION.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
logger.error("Cannot instatiate storage implementation class", e);
}
}
@ -73,7 +76,6 @@ public abstract class AbstractAvatarResource {
return is != null ? output -> IOUtils.copy(is, output) : null;
}
protected Response fetchAndCreateResponse(RealmModel realm, UserModel user) {
StreamingOutput so = fetchUserImage(realm, user);
if (so == null) {

View File

@ -31,7 +31,7 @@ public class OrchestratorEventPublisherProviderFactory implements EventListenerP
public static URL KEYCLOAK_ENDPOINT;
public static String KEYCLOAK_CLIENT_SECRET;
protected Long lastEndpointCheck = new Long(0);
protected Long lastEndpointCheck = Long.valueOf(0);
protected OrchestratorEventPublisherProvider oepp;
public OrchestratorEventPublisherProviderFactory() {