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
31cd97f1
Commit
31cd97f1
authored
Jan 31, 2019
by
Greg Messner
Browse files
Fixed updateProject() (#292).
parent
6ca487bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
31cd97f1
...
@@ -984,9 +984,9 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -984,9 +984,9 @@ public class ProjectApi extends AbstractApi implements Constants {
* Updates a project. The following properties on the Project instance
* Updates a project. The following properties on the Project instance
* are utilized in the edit of the project, null values are not updated:
* are utilized in the edit of the project, null values are not updated:
*
*
* id (required) - existing project id
* id (required) - existing project id
, either id or path must be provided
* name (
required
) - project name
* name (
optional
) - project name
* path (optional) - project path
* path (optional) - project path
, either id or path must be provided
* defaultBranch (optional) - master by default
* defaultBranch (optional) - master by default
* description (optional) - short project description
* description (optional) - short project description
* visibility (optional) - Limit by visibility public, internal, or private
* visibility (optional) - Limit by visibility public, internal, or private
...
@@ -1026,18 +1026,11 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1026,18 +1026,11 @@ public class ProjectApi extends AbstractApi implements Constants {
throw
new
RuntimeException
(
"Project instance cannot be null."
);
throw
new
RuntimeException
(
"Project instance cannot be null."
);
}
}
Integer
id
=
project
.
getId
();
// This will throw an exception if both id and path are not present
if
(
id
==
null
)
{
Object
projectIdentifier
=
getProjectIdOrPath
(
project
);
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."
);
}
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"name"
,
name
,
true
)
.
withParam
(
"name"
,
project
.
getName
()
)
.
withParam
(
"path"
,
project
.
getPath
())
.
withParam
(
"path"
,
project
.
getPath
())
.
withParam
(
"default_branch"
,
project
.
getDefaultBranch
())
.
withParam
(
"default_branch"
,
project
.
getDefaultBranch
())
.
withParam
(
"description"
,
project
.
getDescription
())
.
withParam
(
"description"
,
project
.
getDescription
())
...
@@ -1078,7 +1071,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -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
));
return
(
response
.
readEntity
(
Project
.
class
));
}
}
...
...
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