diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java b/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java index fd18017..e8face5 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java @@ -226,13 +226,13 @@ public class HTTPCall { if(responseCode == HttpURLConnection.HTTP_NOT_FOUND){ throw getElementNotFoundException(clz); } - if(responseCode == HttpURLConnection.HTTP_CONFLICT){ + if(responseCode == HttpURLConnection.HTTP_FORBIDDEN){ throw getElementAvailableInAnotherContextException(clz); } } - if (responseCode != HttpURLConnection.HTTP_OK) { + if (responseCode >= HttpURLConnection.HTTP_BAD_REQUEST) { InputStream inputStream = connection.getErrorStream(); StringBuilder result = getStringBuilder(inputStream);