java-gitlab-api icon indicating copy to clipboard operation
java-gitlab-api copied to clipboard

Delete user doesn't work properly

Open islisava opened this issue 8 years ago • 0 comments

The code I used:

GitlabAPI api = GitlabAPI.connect(getRepositoryURI(), token);
api.deleteUser(id);

The next error occurs:

Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
 at [Source: ; line: 1, column: 0]
	at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3838)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3783)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2842)
	at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:330)
	at org.gitlab.api.http.GitlabHTTPRequestor.to(GitlabHTTPRequestor.java:144)
	... 31 more

The error happens in GitlabHTTPRequestor.java:330 when empty response "" is attempted to be mapped to class class java.lang.Void

Void type is set in deleteUser method in GitlabAPI class

public void deleteUser(Integer targetUserId) throws IOException {
        String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId;
        retrieve().method("DELETE").to(tailUrl, Void.class);
    }

islisava avatar Aug 31 '17 13:08 islisava