diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderUtility.java index cc457c3..bbbfc5e 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderUtility.java @@ -41,12 +41,14 @@ public class HeaderUtility { String creator = org.gcube.informationsystem.model.embedded.Header.UNKNOWN_USER; try { Caller caller = AuthorizationProvider.instance.get(); - ClientInfo clientInfo = caller.getClient(); - String clientId = clientInfo.getId(); - if (clientId != null && clientId.compareTo("") != 0) { - creator = clientId; - } else { - throw new Exception("Username null or empty"); + if(caller!=null){ + ClientInfo clientInfo = caller.getClient(); + String clientId = clientInfo.getId(); + if (clientId != null && clientId.compareTo("") != 0) { + creator = clientId; + } else { + throw new Exception("Username null or empty"); + } } } catch (Exception e) { logger.error("Unable to retrieve user");