Skip to content

Commit b8ed1ba

Browse files
committed
Now throws exception when tag lists are referenced when using the V3 API (#172).
1 parent 358f422 commit b8ed1ba

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Diff for: src/main/java/org/gitlab4j/api/ProjectApi.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,7 @@ public Project createProject(Project project, String importUrl) throws GitLabApi
651651
formData.withParam("public", isPublic);
652652

653653
if (project.getTagList() != null && !project.getTagList().isEmpty()) {
654-
// What would be the preferred way to deal with this, as the V3 API doesn't
655-
// appear to do anything if you send in the tag_list? Could either just ignore,
656-
// or throw an exception.
654+
throw new IllegalArgumentException("GitLab API v3 does not support tag lists when creating projects");
657655
}
658656
} else {
659657
Visibility visibility = (project.getVisibility() != null ? project.getVisibility() :
@@ -892,9 +890,7 @@ public Project updateProject(Project project) throws GitLabApiException {
892890
formData.withParam("public", isPublic);
893891

894892
if (project.getTagList() != null && !project.getTagList().isEmpty()) {
895-
// What would be the preferred way to deal with this, as the V3 API doesn't
896-
// appear to do anything if you send in the tag_list? Could either just ignore,
897-
// or throw an exception.
893+
throw new IllegalArgumentException("GitLab API v3 does not support tag lists when updating projects");
898894
}
899895
} else {
900896
Visibility visibility = (project.getVisibility() != null ? project.getVisibility() :

Diff for: src/test/java/org/gitlab4j/api/TestProjectApi.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public void testCreate() throws GitLabApiException {
171171
.withWikiEnabled(true)
172172
.withSnippetsEnabled(true)
173173
.withVisibility(Visibility.PUBLIC)
174-
.withTagList(Arrays.asList("tag1","tag2"));
174+
.withTagList(Arrays.asList("tag1", "tag2"));
175175

176176
Project newProject = gitLabApi.getProjectApi().createProject(project);
177177
assertNotNull(newProject);
@@ -196,7 +196,7 @@ public void testUpdate() throws GitLabApiException {
196196
.withWikiEnabled(true)
197197
.withSnippetsEnabled(true)
198198
.withVisibility(Visibility.PUBLIC)
199-
.withTagList(Arrays.asList("tag1","tag2"));
199+
.withTagList(Arrays.asList("tag1", "tag2"));
200200

201201
Project newProject = gitLabApi.getProjectApi().createProject(project);
202202
assertNotNull(newProject);

0 commit comments

Comments
 (0)