Closed
Description
In gitlab4j 5.3.0, AbstractAPI accepts only Long since cf58df4
This causes unnecessary breakage for client who have passed integer Ids to any api, such as
public Pipeline triggerPipeline(Object projectIdOrPath, String token, String ref, List<Variable> variables)
Example code:
final int MY_PROJECT_ID = 1234;
var pipelineApi = gitLabApi.getPipelineApi();
pipelineApi.triggerPipeline(projectId, token, ref, variables)
Exception:
java.lang.RuntimeException: Cannot determine ID or path from provided Integer instance, must be Long, String, or a Project instance
at org.gitlab4j.api.AbstractApi.getProjectIdOrPath(AbstractApi.java:62)
at org.gitlab4j.api.PipelineApi.triggerPipeline(PipelineApi.java:812)
While I appreciate Ids can be long in the future, the weird code in getProjectIdOrPath() could continue to accept both Integer and Long, so I suggest something like:
} else if (obj instanceof Long) {
return (obj);
+ } else if (obj instanceof Integer) {
+ // Gitlab4j <5.x compatibility
+ return (obj);
Metadata
Metadata
Assignees
Labels
No labels