-
Notifications
You must be signed in to change notification settings - Fork 486
Closed
Description
Hello! First of all thank you for all the work on this library!
Here is my issue. I'm using gitlab4j-api version 5.1.0 to make requests against Gitlab version 15.10.0.
The code is as follows:
gitlabApi.getSearchApi().projectSearchStream(projectId, Constants.ProjectSearchScope.BLOBS, query, branch)
Most of the time it works fine, but for some searches I get a crash like this:
com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.lang.Long` from String "22ef943c82ed01be9aeb7439ba1d5d41d652e759": not a valid Long value
at [Source: (org.glassfish.jersey.client.internal.HttpUrlConnector$2); line: 1, column: 1297] (through reference chain: java.util.ArrayList[0]->org.gitlab4j.api.models.SearchBlob["id"])
at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1702)
at com.fasterxml.jackson.databind.DeserializationContext.handleWeirdStringValue(DeserializationContext.java:947)
at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$LongDeserializer._parseLong(NumberDeserializers.java:589)
at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$LongDeserializer.deserialize(NumberDeserializers.java:562)
at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$LongDeserializer.deserialize(NumberDeserializers.java:540)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:291)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:250)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4524)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3519)
at org.gitlab4j.api.Pager.<init>(Pager.java:95)
at org.gitlab4j.api.SearchApi.projectSearch(SearchApi.java:326)
at org.gitlab4j.api.SearchApi.projectSearchStream(SearchApi.java:269)
It turns out that most of the time Gitlab uses null as id field in the response, but in some cases (I don't know exactly which) the id has the form of a string like 22ef943c82ed01be9aeb7439ba1d5d41d652e759.
However, in the SearchBlob class provided by gitlab4j, the id field is of type Long (was Integer in some earlier versions). Hence the error.
I think that either the type of the id field should be changed to String, or the field should be removed entirely, as it's usually null.
Metadata
Metadata
Assignees
Labels
No labels