Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
b8ed1ba8
Commit
b8ed1ba8
authored
Apr 14, 2018
by
Greg Messner
Browse files
Now throws exception when tag lists are referenced when using the V3 API (#172).
parent
358f4221
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
b8ed1ba8
...
@@ -651,9 +651,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -651,9 +651,7 @@ public class ProjectApi extends AbstractApi implements Constants {
formData
.
withParam
(
"public"
,
isPublic
);
formData
.
withParam
(
"public"
,
isPublic
);
if
(
project
.
getTagList
()
!=
null
&&
!
project
.
getTagList
().
isEmpty
())
{
if
(
project
.
getTagList
()
!=
null
&&
!
project
.
getTagList
().
isEmpty
())
{
// What would be the preferred way to deal with this, as the V3 API doesn't
throw
new
IllegalArgumentException
(
"GitLab API v3 does not support tag lists when creating projects"
);
// appear to do anything if you send in the tag_list? Could either just ignore,
// or throw an exception.
}
}
}
else
{
}
else
{
Visibility
visibility
=
(
project
.
getVisibility
()
!=
null
?
project
.
getVisibility
()
:
Visibility
visibility
=
(
project
.
getVisibility
()
!=
null
?
project
.
getVisibility
()
:
...
@@ -892,9 +890,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -892,9 +890,7 @@ public class ProjectApi extends AbstractApi implements Constants {
formData
.
withParam
(
"public"
,
isPublic
);
formData
.
withParam
(
"public"
,
isPublic
);
if
(
project
.
getTagList
()
!=
null
&&
!
project
.
getTagList
().
isEmpty
())
{
if
(
project
.
getTagList
()
!=
null
&&
!
project
.
getTagList
().
isEmpty
())
{
// What would be the preferred way to deal with this, as the V3 API doesn't
throw
new
IllegalArgumentException
(
"GitLab API v3 does not support tag lists when updating projects"
);
// appear to do anything if you send in the tag_list? Could either just ignore,
// or throw an exception.
}
}
}
else
{
}
else
{
Visibility
visibility
=
(
project
.
getVisibility
()
!=
null
?
project
.
getVisibility
()
:
Visibility
visibility
=
(
project
.
getVisibility
()
!=
null
?
project
.
getVisibility
()
:
...
...
src/test/java/org/gitlab4j/api/TestProjectApi.java
View file @
b8ed1ba8
...
@@ -171,7 +171,7 @@ public class TestProjectApi {
...
@@ -171,7 +171,7 @@ public class TestProjectApi {
.
withWikiEnabled
(
true
)
.
withWikiEnabled
(
true
)
.
withSnippetsEnabled
(
true
)
.
withSnippetsEnabled
(
true
)
.
withVisibility
(
Visibility
.
PUBLIC
)
.
withVisibility
(
Visibility
.
PUBLIC
)
.
withTagList
(
Arrays
.
asList
(
"tag1"
,
"tag2"
));
.
withTagList
(
Arrays
.
asList
(
"tag1"
,
"tag2"
));
Project
newProject
=
gitLabApi
.
getProjectApi
().
createProject
(
project
);
Project
newProject
=
gitLabApi
.
getProjectApi
().
createProject
(
project
);
assertNotNull
(
newProject
);
assertNotNull
(
newProject
);
...
@@ -196,7 +196,7 @@ public class TestProjectApi {
...
@@ -196,7 +196,7 @@ public class TestProjectApi {
.
withWikiEnabled
(
true
)
.
withWikiEnabled
(
true
)
.
withSnippetsEnabled
(
true
)
.
withSnippetsEnabled
(
true
)
.
withVisibility
(
Visibility
.
PUBLIC
)
.
withVisibility
(
Visibility
.
PUBLIC
)
.
withTagList
(
Arrays
.
asList
(
"tag1"
,
"tag2"
));
.
withTagList
(
Arrays
.
asList
(
"tag1"
,
"tag2"
));
Project
newProject
=
gitLabApi
.
getProjectApi
().
createProject
(
project
);
Project
newProject
=
gitLabApi
.
getProjectApi
().
createProject
(
project
);
assertNotNull
(
newProject
);
assertNotNull
(
newProject
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment