Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
31cd97f1
Commit
31cd97f1
authored
6 years ago
by
Greg Messner
Browse files
Options
Download
Email Patches
Plain Diff
Fixed updateProject() (#292).
parent
6ca487bf
main
5.0.x
5.0.x.jdk17
6.x
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/gitlab4j/api/ProjectApi.java
+7
-14
src/main/java/org/gitlab4j/api/ProjectApi.java
with
7 additions
and
14 deletions
+7
-14
src/main/java/org/gitlab4j/api/ProjectApi.java
+
7
-
14
View file @
31cd97f1
...
...
@@ -984,9 +984,9 @@ public class ProjectApi extends AbstractApi implements Constants {
* Updates a project. The following properties on the Project instance
* are utilized in the edit of the project, null values are not updated:
*
* id (required) - existing project id
* name (
required
) - project name
* path (optional) - project path
* id (required) - existing project id
, either id or path must be provided
* name (
optional
) - project name
* path (optional) - project path
, either id or path must be provided
* defaultBranch (optional) - master by default
* description (optional) - short project description
* visibility (optional) - Limit by visibility public, internal, or private
...
...
@@ -1026,18 +1026,11 @@ public class ProjectApi extends AbstractApi implements Constants {
throw
new
RuntimeException
(
"Project instance cannot be null."
);
}
Integer
id
=
project
.
getId
();
if
(
id
==
null
)
{
throw
new
RuntimeException
(
"Project ID cannot be null."
);
}
String
name
=
project
.
getName
();
if
(
name
==
null
||
name
.
trim
().
length
()
==
0
)
{
throw
new
RuntimeException
(
"Project name cannot be null or empty."
);
}
// This will throw an exception if both id and path are not present
Object
projectIdentifier
=
getProjectIdOrPath
(
project
);
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"name"
,
name
,
true
)
.
withParam
(
"name"
,
project
.
getName
()
)
.
withParam
(
"path"
,
project
.
getPath
())
.
withParam
(
"default_branch"
,
project
.
getDefaultBranch
())
.
withParam
(
"description"
,
project
.
getDescription
())
...
...
@@ -1078,7 +1071,7 @@ public class ProjectApi extends AbstractApi implements Constants {
}
}
Response
response
=
putWithFormData
(
Response
.
Status
.
OK
,
formData
,
"projects"
,
id
);
Response
response
=
putWithFormData
(
Response
.
Status
.
OK
,
formData
,
"projects"
,
projectIdentifier
);
return
(
response
.
readEntity
(
Project
.
class
));
}
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets